Merge branch 'master' of https://github.com/Faerbit/swp
Conflicts: Levels/ObjectSetups/Compositions.xml Levels/ObjectSetups/Level1.png Levels/ObjectSetups/Level1.xcf Levels/ObjectSetups/Level1.xml
This commit is contained in:
commit
637568fd26
@ -115,7 +115,7 @@
|
||||
<object>
|
||||
<modelPath>switch_inner.obj</modelPath>
|
||||
<xOffset>0.0</xOffset>
|
||||
<yOffset>0.0</yOffset>
|
||||
<yOffset>3</yOffset>
|
||||
<zOffset>0.0</zOffset>
|
||||
<scale>1.0</scale>
|
||||
<mass>1.0</mass>
|
||||
@ -123,7 +123,7 @@
|
||||
<object>
|
||||
<modelPath>switch_outer.obj</modelPath>
|
||||
<xOffset>0.0</xOffset>
|
||||
<yOffset>0.0</yOffset>
|
||||
<yOffset>2</yOffset>
|
||||
<zOffset>0.0</zOffset>
|
||||
<scale>1.0</scale>
|
||||
<mass>0.0</mass>
|
||||
@ -150,7 +150,7 @@
|
||||
<ignoreHeightmap>true</ignoreHeightmap>
|
||||
<object>
|
||||
<modelPath>block.obj</modelPath>
|
||||
<xOffset>0.0</xOffset>
|
||||
<xOffset>0.0</xOffset>
|
||||
<yOffset>20.0</yOffset>
|
||||
<zOffset>0.0</zOffset>
|
||||
<scale>1.5</scale>
|
||||
@ -188,6 +188,9 @@
|
||||
<ignoreHeightmap>true</ignoreHeightmap>
|
||||
<object>
|
||||
<modelPath>simpleWall.obj</modelPath>
|
||||
<xRot>0.0</xRot>
|
||||
<yRot>0.0</yRot>
|
||||
<zRot>0.0</zRot>
|
||||
<xOffset>0.0</xOffset>
|
||||
<yOffset>20.0</yOffset>
|
||||
<zOffset>0.0</zOffset>
|
||||
@ -196,8 +199,22 @@
|
||||
</object>
|
||||
</composition>
|
||||
|
||||
|
||||
|
||||
<!-- Light Block -->
|
||||
<composition>
|
||||
<typeID>200</typeID>
|
||||
<ignoreHeightmap>false</ignoreHeightmap>
|
||||
<object>
|
||||
<modelPath>block.obj</modelPath>
|
||||
<xOffset>0.0</xOffset>
|
||||
<yOffset>20.0</yOffset>
|
||||
<zOffset>0.0</zOffset>
|
||||
<xRot>0.0</xRot>
|
||||
<yRot>0.0</yRot>
|
||||
<zRot>0.0</zRot>
|
||||
<scale>1.5</scale>
|
||||
<mass>2.0</mass>
|
||||
</object>
|
||||
</composition>
|
||||
|
||||
|
||||
|
||||
@ -242,14 +259,14 @@
|
||||
</objectData>
|
||||
|
||||
<objectData>
|
||||
<modelPath>torch.obj</modelPath>
|
||||
<modelPath>torch.obj</modelPath>
|
||||
<texturePath>torchTexture.png</texturePath>
|
||||
<ambientFactor>0.1</ambientFactor>
|
||||
<diffuseFactor>0.3</diffuseFactor>
|
||||
<specularFactor>0.7</specularFactor>
|
||||
<shininess>10.0</shininess>
|
||||
<physicType>TriangleMesh</physicType>
|
||||
<dampningL>1.0</dampningL>
|
||||
<dampningL>1</dampningL>
|
||||
<dampningA>1.0</dampningA>
|
||||
</objectData>
|
||||
|
||||
@ -258,13 +275,13 @@
|
||||
<texturePath>switchTextureInner.png</texturePath>
|
||||
<ambientFactor>0.1</ambientFactor>
|
||||
<diffuseFactor>0.6</diffuseFactor>
|
||||
<specularFactor>0.4</specularFactor>
|
||||
<specularFactor>0.4</specularFactor>
|
||||
<shininess>2.0</shininess>
|
||||
<physicType>Box</physicType>
|
||||
<width>0.5</width>
|
||||
<height>0.5</height>
|
||||
<length>0.5</length>
|
||||
<dampningL>1.0</dampningL>
|
||||
<physicType>Button</physicType>
|
||||
<width>2</width>
|
||||
<height>1</height>
|
||||
<length>2</length>
|
||||
<dampningL>0.5</dampningL>
|
||||
<dampningA>1.0</dampningA>
|
||||
</objectData>
|
||||
|
||||
@ -276,8 +293,8 @@
|
||||
<specularFactor>0.4</specularFactor>
|
||||
<shininess>2.0</shininess>
|
||||
<physicType>TriangleMesh</physicType>
|
||||
<dampningL>1.0</dampningL>
|
||||
<dampningA>1.0</dampningA>
|
||||
<dampningL>0.555</dampningL>
|
||||
<dampningA>0.5</dampningA>
|
||||
</objectData>
|
||||
|
||||
<objectData>
|
||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 75 B |
@ -47,7 +47,6 @@ vec2 poissonDisk[16] = vec2[](
|
||||
);
|
||||
|
||||
float sampleDirectionalShadow(sampler2DShadow shadowMap, vec4 shadowCoord) {
|
||||
float nearPlane = 0.1;
|
||||
float visibility = 1.0;
|
||||
float bias = 0.001*tan(acos(clamp(dot(vNormal, -directionalLightVector), 0.0, 1.0)));
|
||||
bias = clamp(bias, 0.0, 0.01);
|
||||
@ -67,8 +66,12 @@ float sampleDirectionalShadow(sampler2DShadow shadowMap, vec4 shadowCoord) {
|
||||
}
|
||||
|
||||
float samplePointShadow(samplerCubeShadow shadowMap, vec3 lightDirection) {
|
||||
float nearPlane = 0.1;
|
||||
float A = -(farPlane+nearPlane)/(farPlane-nearPlane);
|
||||
float B = -2*(farPlane*nearPlane)/(farPlane - nearPlane);
|
||||
float compValue = 0.5*(-A*length(lightDirection) + B)/length(lightDirection) + 0.5;
|
||||
float bias = 0.005;
|
||||
return texture(shadowMap, vec4(lightDirection.xyz , length(lightDirection) - bias));
|
||||
return texture(shadowMap, vec4(lightDirection.xyz , compValue - bias));
|
||||
}
|
||||
|
||||
float distanceToBorder(vec2 vector) {
|
||||
@ -121,7 +124,7 @@ void main()
|
||||
vec3 finalColor = specularColor + diffuseColor + ambientColor;
|
||||
float distanceCameraCenter = distance(cameraCenter, vec3(fragPosition));
|
||||
float fogFactor = clamp((1.0 - ((farPlane - 35.0) -distanceCameraCenter)/30.0), 0.0, 1.0);
|
||||
fogFactor *= clamp((1.0-((fragPosition.y-8.0)/30.0)), 0.0, 1.0);
|
||||
fogFactor *= clamp((1.0-((fragPosition.y-40.0)/30.0)), 0.0, 1.0);
|
||||
|
||||
vec4 texture = texture(uTexture, vTexCoord).rgba;
|
||||
oColor = vec4(finalColor, 1.0f)*texture;
|
||||
|
25
camera.cc
25
camera.cc
@ -48,8 +48,8 @@ void Camera::updateRotation(glm::vec2 rotation) {
|
||||
}
|
||||
|
||||
void Camera:: updateDistance(float distance) {
|
||||
if (this->distance + distance <= 1.0f) {
|
||||
this->distance = 1.0f;
|
||||
if (this->distance + distance <= 2.5f) {
|
||||
this->distance = 2.5f;
|
||||
}
|
||||
else if (this->distance + distance >= 30.0f) {
|
||||
this->distance = 30.f;
|
||||
@ -60,6 +60,27 @@ void Camera:: updateDistance(float distance) {
|
||||
updatePosition();
|
||||
}
|
||||
|
||||
void Camera::setPosition(glm::vec3 pos)
|
||||
{
|
||||
position = pos;
|
||||
}
|
||||
|
||||
glm::vec3 Camera::getPosition()
|
||||
{
|
||||
return position;
|
||||
}
|
||||
|
||||
void Camera::setDirection(glm::vec3 dir)
|
||||
{
|
||||
direction = dir;
|
||||
}
|
||||
|
||||
glm::vec3 Camera::getDirection()
|
||||
{
|
||||
return direction;
|
||||
}
|
||||
|
||||
|
||||
void Camera::updatePosition() {
|
||||
glm::vec4 cameraVector = glm::vec4(0.0f, 0.0f, distance, 0.0f);
|
||||
// rotate vector
|
||||
|
@ -15,11 +15,18 @@ class Camera {
|
||||
void setRotation(glm::vec2 rotation);
|
||||
void updateRotation(glm::vec2 rotation); //adds to current rotation
|
||||
glm::vec3 getVector();
|
||||
void setPosition(glm::vec3 pos);
|
||||
glm::vec3 getPosition();
|
||||
void setDirection(glm::vec3 dir);
|
||||
glm::vec3 getDirection();
|
||||
|
||||
private:
|
||||
void updatePosition();
|
||||
float distance;
|
||||
glm::vec2 rotation;
|
||||
glm::vec3 vector;
|
||||
glm::vec3 position;
|
||||
glm::vec3 direction;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
23
graphics.cc
23
graphics.cc
@ -61,6 +61,15 @@ void Graphics::init(Level* level) {
|
||||
}
|
||||
|
||||
framebuffer_cube = SharedFrameBufferObject(new FrameBufferObject());
|
||||
|
||||
depthTexture_cube = SharedTexture2D( new Texture2D(windowSize, GL_DEPTH_COMPONENT16));
|
||||
depthTexture_cube->setMinFilter(GL_NEAREST);
|
||||
depthTexture_cube->setMagFilter(GL_NEAREST);
|
||||
depthTexture_cube->setWrapS(GL_CLAMP_TO_EDGE);
|
||||
depthTexture_cube->setWrapT(GL_CLAMP_TO_EDGE);
|
||||
depthTexture_cube->setCompareMode(GL_COMPARE_REF_TO_TEXTURE);
|
||||
framebuffer_cube2 = SharedFrameBufferObject(new FrameBufferObject());
|
||||
framebuffer_cube2->setDepthTexture(depthTexture_cube);
|
||||
}
|
||||
|
||||
GLFWwindow* Graphics::getWindow() {
|
||||
@ -86,11 +95,20 @@ void Graphics::render()
|
||||
for (unsigned int i_pointlight = 0; i_pointlight<1 && i_pointlight<level->getLights()->size(); i_pointlight++) {
|
||||
// render each side of the cube
|
||||
for (int i_face = 0; i_face<6; i_face++) {
|
||||
framebuffer_cube2->bind();
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
framebuffer_cube->bind();
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i_face, depth_cubeMaps.at(i_pointlight)->getObjectName(), 0);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glm::mat4 depthViewProjectionMatrix_face = depthProjectionMatrix_pointlights * glm::lookAt(level->getLights()->at(i_pointlight).getPosition(),
|
||||
level->getLights()->at(i_pointlight).getPosition() + looking_directions[i_face], glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
//level->render(depthShader, false, &depthViewProjectionMatrix_face);
|
||||
level->render(depthShader, false, &depthViewProjectionMatrix_face);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer_cube->getObjectName());
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer_cube2->getObjectName());
|
||||
glBlitFramebuffer(0, 0, cube_size, cube_size, cube_size, cube_size, 0, 0, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer_cube2->getObjectName());
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer_cube->getObjectName());
|
||||
glBlitFramebuffer(0, 0, cube_size, cube_size, 0, 0, cube_size, cube_size, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||
if (!framebuffer_cube->isFrameBufferObjectComplete()) {
|
||||
printf("Framebuffer incomplete, unknown error occured during shadow generation!\n");
|
||||
}
|
||||
@ -194,8 +212,11 @@ void Graphics::resize(glm::uvec2 windowSize) {
|
||||
|
||||
glm::mat4 Graphics::buildViewMatrix(Level* level) {
|
||||
//construct lookAt (cameraPosition = cameraCenter + cameraVector)
|
||||
//return glm::lookAt(level->getCamera()->getPosition(), level->getCamera()->getPosition() + level->getCamera()->getDirection(), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
|
||||
return glm::lookAt((level->getCameraCenter()->getPosition() + level->getCamera()->getVector()),
|
||||
level->getCameraCenter()->getPosition(), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
|
||||
}
|
||||
|
||||
float Graphics::getFarPlane() {
|
||||
|
@ -32,6 +32,8 @@ class Graphics {
|
||||
ACGL::OpenGL::SharedFrameBufferObject framebuffer;
|
||||
std::vector<ACGL::OpenGL::SharedTextureCubeMap> depth_cubeMaps;
|
||||
ACGL::OpenGL::SharedFrameBufferObject framebuffer_cube;
|
||||
ACGL::OpenGL::SharedFrameBufferObject framebuffer_cube2;
|
||||
ACGL::OpenGL::SharedTexture2D depthTexture_cube;
|
||||
static const int cube_size;
|
||||
Level* level;
|
||||
};
|
||||
|
20
level.cc
20
level.cc
@ -248,6 +248,7 @@ void Level::load() {
|
||||
float mass;
|
||||
errorCheck(xmlObject->FirstChildElement("mass")->QueryFloatText(&mass));
|
||||
float dampningL, dampningA;
|
||||
bool rotate = true;
|
||||
errorCheck(objectData->FirstChildElement("dampningL")->QueryFloatText(&dampningL));
|
||||
errorCheck(objectData->FirstChildElement("dampningA")->QueryFloatText(&dampningA));
|
||||
if (physicType.compare("Player") == 0){
|
||||
@ -259,13 +260,20 @@ void Level::load() {
|
||||
errorCheck(objectData->FirstChildElement("width")->QueryFloatText(&width));
|
||||
errorCheck(objectData->FirstChildElement("height")->QueryFloatText(&height));
|
||||
errorCheck(objectData->FirstChildElement("length")->QueryFloatText(&length));
|
||||
this->physics.addBox(width, height, length, *object, mass, dampningL, dampningA, physicObjects.size());
|
||||
this->physics.addBox(width, height, length, *object, mass, dampningL, dampningA, physicObjects.size(), rotate);
|
||||
}else if (physicType.compare("Button") == 0){
|
||||
float width, height, length;
|
||||
errorCheck(objectData->FirstChildElement("width")->QueryFloatText(&width));
|
||||
errorCheck(objectData->FirstChildElement("height")->QueryFloatText(&height));
|
||||
errorCheck(objectData->FirstChildElement("length")->QueryFloatText(&length));
|
||||
this->physics.addButton(width, height, length, *object, mass, dampningL, dampningA, physicObjects.size(), rotate);
|
||||
}else if (physicType.compare("TriangleMesh") == 0){
|
||||
|
||||
this->physics.addTriangleMeshBody(*object, modelPath, mass, dampningL, dampningA, physicObjects.size());
|
||||
this->physics.addTriangleMeshBody(*object, modelPath, mass, dampningL, dampningA, physicObjects.size(), rotate);
|
||||
} else{
|
||||
printf("XMLError: Not a valid physicType.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
if(compositionType == 20){
|
||||
cameraCenter = object;
|
||||
@ -422,7 +430,7 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
||||
glm::mat4* viewProjectionMatrix, std::vector<glm::mat4>* shadowVPs) {
|
||||
for(unsigned int i = 0; i<objects.size(); i++) {
|
||||
// do not project shadow of skydome
|
||||
if(lightingPass || objects.at(i) != skydome) {
|
||||
if(lightingPass || (objects.at(i) != skydome /*&& i!=0*/)) {
|
||||
objects.at(i)->render(shader, lightingPass, viewProjectionMatrix, shadowVPs);
|
||||
}
|
||||
}
|
||||
@ -438,6 +446,10 @@ void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPre
|
||||
else {
|
||||
mouseDelta.x = -mouseDelta.x;
|
||||
camera.updateRotation(mouseDelta/100.0f);
|
||||
physics.updateCameraPos(mouseDelta, 0.01f);
|
||||
|
||||
camera.setPosition(physics.getCameraPosition());
|
||||
camera.setDirection(physics.getCameraToPlayer());
|
||||
}
|
||||
|
||||
if(wPressed){
|
||||
|
67
physics.cc
67
physics.cc
@ -25,12 +25,21 @@ void Physics::takeUpdateStep(float timeDiff)
|
||||
{
|
||||
if(allPositionConstraints[i].position != allPositionConstraints[i].body->getCenterOfMassPosition())
|
||||
{
|
||||
btVector3 dir = allPositionConstraints[i].body->getCenterOfMassPosition() - allPositionConstraints[i].position;
|
||||
btVector3 dir = allPositionConstraints[i].position - allPositionConstraints[i].body->getCenterOfMassPosition();
|
||||
allPositionConstraints[i].body->applyCentralForce(dir*allPositionConstraints[i].strength);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
btVector3 position = playerBall->getCenterOfMassPosition() ;
|
||||
position.normalize();
|
||||
position *=5;
|
||||
position += playerBall->getCenterOfMassPosition(); //is the position 5 units away from the player in the direction of the camera
|
||||
|
||||
|
||||
btVector3 dir = cameraBody->getCenterOfMassPosition() - position;
|
||||
cameraBody->applyCentralForce(dir);
|
||||
cameraBody->applyCentralForce(btVector3(0,10,0));
|
||||
|
||||
/*- cameraBody->getCenterOfMassPosition(); // gives vector from player to camera
|
||||
position.normalize();
|
||||
position *=5;
|
||||
@ -40,6 +49,7 @@ void Physics::takeUpdateStep(float timeDiff)
|
||||
btVector3 dir = cameraBody->getCenterOfMassPosition() - position;
|
||||
cameraBody->applyCentralForce(dir);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void Physics::removePositionConstraint(int bodyIndice)
|
||||
@ -162,10 +172,11 @@ void Physics::addPlayer(float friction, float rad, Entity entity, float mass, fl
|
||||
playerBall->setSleepingThresholds(0,0);
|
||||
if(bodies.size() != indice)
|
||||
throw std::invalid_argument( "Bodies out of Sync" );
|
||||
|
||||
|
||||
addCamera();
|
||||
}
|
||||
|
||||
void Physics::addTriangleMeshBody(Entity entity, std::string path, float mass, float dampningL, float dampningA,unsigned indice)
|
||||
void Physics::addTriangleMeshBody(Entity entity, std::string path, float mass, float dampningL, float dampningA,unsigned indice,bool rotate)
|
||||
{//TODO look at convexHullShapes
|
||||
|
||||
if(bodies.size() == indice)
|
||||
@ -236,21 +247,23 @@ void Physics::addTriangleMeshBody(Entity entity, std::string path, float mass, f
|
||||
throw std::invalid_argument( "Bodies out of Sync" );
|
||||
}
|
||||
|
||||
void Physics::addButton(float radius, float height, Entity entity, float mass, float dampningL, float dampningA, unsigned indice)
|
||||
void Physics::addButton(float width, float height, float length, Entity entity, float mass, float dampningL, float dampningA, unsigned indice,bool rotate)
|
||||
{
|
||||
|
||||
if(bodies.size() == indice)
|
||||
throw std::invalid_argument( "Bodies out of Sync" );
|
||||
btCylinderShape* shape = new btCylinderShape(btVector3(height/2, radius,radius));
|
||||
|
||||
btBoxShape* box = new btBoxShape(btVector3(width/2,height/2,length/2));
|
||||
|
||||
btDefaultMotionState* motion = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(entity.getPosition().x,entity.getPosition().y,entity.getPosition().z)));
|
||||
|
||||
btVector3 inertia(0,0,0);
|
||||
if(mass != 0.0)
|
||||
{
|
||||
shape->calculateLocalInertia((btScalar)mass,inertia);
|
||||
box->calculateLocalInertia((btScalar)mass,inertia);
|
||||
}
|
||||
|
||||
btRigidBody::btRigidBodyConstructionInfo info(mass,motion,shape,inertia);
|
||||
btRigidBody::btRigidBodyConstructionInfo info(mass,motion,box,inertia);
|
||||
|
||||
btRigidBody* body = new btRigidBody(info);
|
||||
|
||||
@ -264,7 +277,7 @@ void Physics::addButton(float radius, float height, Entity entity, float mass, f
|
||||
throw std::invalid_argument( "Bodies out of Sync" );
|
||||
}
|
||||
|
||||
void Physics::addBox(float width, float height, float length, Entity entity, float mass, float dampningL, float dampningA, unsigned indice)
|
||||
void Physics::addBox(float width, float height, float length, Entity entity, float mass, float dampningL, float dampningA, unsigned indice,bool rotate)
|
||||
{
|
||||
|
||||
if(bodies.size() == indice)
|
||||
@ -294,7 +307,7 @@ void Physics::addBox(float width, float height, float length, Entity entity, flo
|
||||
throw std::invalid_argument( "Bodies out of Sync" );
|
||||
}
|
||||
|
||||
void Physics::addSphere(float rad, Entity entity, float mass, float dampningL, float dampningA, unsigned indice)
|
||||
void Physics::addSphere(float rad, Entity entity, float mass, float dampningL, float dampningA, unsigned indice,bool rotate)
|
||||
{
|
||||
if(bodies.size() == indice)
|
||||
throw std::invalid_argument( "Bodies out of Sync" );
|
||||
@ -353,28 +366,28 @@ void Physics::addTriangleMeshBody(Entity entity, float mass, float dampningL, fl
|
||||
|
||||
}*/
|
||||
|
||||
void Physics::addCamera(float rad, float distance)
|
||||
void Physics::addCamera()
|
||||
{
|
||||
btSphereShape* sphere = new btSphereShape(rad);
|
||||
btSphereShape* sphere = new btSphereShape(0.5f);
|
||||
|
||||
btVector3 inertia(0,0,0);
|
||||
btDefaultMotionState* motion = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,0,0)));
|
||||
btDefaultMotionState* motion = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),playerBall->getCenterOfMassPosition()+btVector3(5,5,5)));
|
||||
|
||||
btRigidBody::btRigidBodyConstructionInfo info(1/(playerBall->getInvMass()/100),motion,sphere,inertia);
|
||||
|
||||
cameraBody = new btRigidBody(info);
|
||||
|
||||
cameraBody->setDamping(0.9f,1.0f);
|
||||
cameraBody->setDamping(1,0.5);
|
||||
|
||||
world->addRigidBody(cameraBody,COL_OBJECTS, objectsPhysicsCollision);
|
||||
|
||||
cameraBody->setSleepingThresholds(0,0);
|
||||
|
||||
|
||||
btVector3 pivotInA(5,0,0);
|
||||
/*btVector3 pivotInA(5,0,0);
|
||||
btVector3 pivotInB(-5, 0, 0);
|
||||
btDistanceConstraint* pdc = new btDistanceConstraint(*cameraBody,*playerBall,pivotInA,pivotInB, distance);
|
||||
world->addConstraint(pdc);
|
||||
world->addConstraint(pdc);*/
|
||||
}
|
||||
|
||||
|
||||
@ -386,6 +399,13 @@ glm::vec3 Physics::getCameraPosition()
|
||||
return save;
|
||||
}
|
||||
|
||||
glm::vec3 Physics::getCameraToPlayer()
|
||||
{
|
||||
btVector3 origin = playerBall->getCenterOfMassPosition() - cameraBody->getCenterOfMassPosition();
|
||||
glm::vec3 save(origin.getX(),origin.getY(),origin.getZ());
|
||||
return save;
|
||||
}
|
||||
|
||||
glm::vec3 Physics::getPos(int i)
|
||||
{
|
||||
btVector3 origin = bodies[i]->getCenterOfMassPosition();
|
||||
@ -404,6 +424,20 @@ glm::mat4 Physics::getRotation(int i)
|
||||
return matrix;
|
||||
}
|
||||
|
||||
void Physics::updateCameraPos(glm::vec2 mouseMovement, float strength)
|
||||
{
|
||||
btVector3 change = playerBall->getCenterOfMassPosition()-cameraBody->getCenterOfMassPosition();;
|
||||
change.setY(0);
|
||||
change.normalize();
|
||||
change *= mouseMovement.x;
|
||||
change = btCross(btVector3(0,1,0),change);
|
||||
change.setY(mouseMovement.y);
|
||||
change*=strength;
|
||||
|
||||
cameraBody->applyCentralForce(change);
|
||||
|
||||
}
|
||||
|
||||
void Physics::rollForward(glm::vec3 camPos,float strength)
|
||||
{
|
||||
btVector3 pos(camPos.x,0,camPos.z);
|
||||
@ -438,6 +472,7 @@ void Physics::rollRight(glm::vec3 camPos,float strength)
|
||||
playerBall->applyTorque(-pos);
|
||||
}
|
||||
|
||||
|
||||
//not used right now
|
||||
|
||||
void Physics::addStaticGroundPlane()
|
||||
|
12
physics.hh
12
physics.hh
@ -54,18 +54,20 @@ class Physics {
|
||||
glm::vec3 getPos(int i);
|
||||
glm::mat4 getRotation(int i);
|
||||
void addStaticGroundPlane();
|
||||
void addCamera(float rad, float distance); //Do NOT impliment before Player has been created;
|
||||
void addCamera(); //Do NOT impliment before Player has been created;
|
||||
void updateCameraPos(glm::vec2 mouseMovement, float strength);
|
||||
glm::vec3 getCameraPosition();
|
||||
void addRigidBodyFromFile(Entity entity, float mass, float dampningL, float dampningA, std::string modelLocation, unsigned indice);
|
||||
void addTriangleMeshBody(Entity entity, std::string path, float mass, float dampningL, float dampningA, unsigned indice);
|
||||
void addTriangleMeshBody(Entity entity, std::string path, float mass, float dampningL, float dampningA, unsigned indice,bool rotate);
|
||||
void addTerrain(int width, int length, float** heightData);
|
||||
void addTerrainTriangles(int width, int length, float** heightData); //add the terrain as a trimesh instead of a heightmap
|
||||
void addPlayer(float friction, float rad, Entity entity, float mass, float dampningL, float dampningA, unsigned indice); //use these AFTER physicObjects.push_back(object)! if mass == 0 then the object is unmoveable
|
||||
void addSphere(float rad, Entity entity, float mass, float dampningL, float dampningA, unsigned indice); //The Indice should be set to physicObjects.size()
|
||||
void addBox(float width, float height, float length, Entity entity, float mass, float dampningL, float dampningA, unsigned indice); //this is used to ensuer that the system is synchronized
|
||||
void addSphere(float rad, Entity entity, float mass, float dampningL, float dampningA, unsigned indice,bool rotate); //The Indice should be set to physicObjects.size()
|
||||
void addBox(float width, float height, float length, Entity entity, float mass, float dampningL, float dampningA, unsigned indice,bool rotate); //this is used to ensuer that the system is synchronized
|
||||
void addPositionConstraint(int bodyIndice, float strength, glm::vec3 position);
|
||||
void removePositionConstraint(int bodyIndice);
|
||||
void addButton(float radius, float height, Entity entity, float mass, float dampningL, float dampningA, unsigned indice);
|
||||
void addButton(float width, float height, float length, Entity entity, float mass, float dampningL, float dampningA, unsigned indice,bool rotate);
|
||||
glm::vec3 getCameraToPlayer();
|
||||
|
||||
struct positionConstraint{btRigidBody* body; float strength; btVector3 position;};
|
||||
|
||||
|
BIN
slides/images/demo_m3.png
Normal file
BIN
slides/images/demo_m3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 827 KiB |
BIN
slides/slides_m3.pdf
Normal file
BIN
slides/slides_m3.pdf
Normal file
Binary file not shown.
125
slides/slides_m3.tex
Executable file
125
slides/slides_m3.tex
Executable file
@ -0,0 +1,125 @@
|
||||
%*****************************************************************************%
|
||||
% This LaTeX-Template is based on the beamer package: %
|
||||
% http://latex-beamer.sourceforge.net %
|
||||
% %
|
||||
% For further details on how to create beamer slides you can check their %
|
||||
% documentation: %
|
||||
% http://mirror.ctan.org/macros/latex/contrib/beamer/doc/beameruserguide.pdf %
|
||||
% %
|
||||
% The layout fits the current standard of the acg color scheme. %
|
||||
% Version: 1.0 %
|
||||
% Authors: Lars Krecklau <krecklau@informatik.rwth-aachen.de> %
|
||||
%*****************************************************************************%
|
||||
\documentclass{beamer}
|
||||
|
||||
\usepackage{graphicx}
|
||||
\usepackage[german]{babel}
|
||||
|
||||
% Place in these lines your title and the author's names:
|
||||
\newcommand{\myTitle}{Milestone 3 - Marble Race Game - Group C}
|
||||
\newcommand{\myAutors}{Fabian Klemp, Steffen F\"undgens, Simon Froitzheim, Jasper Manousek}
|
||||
\newcommand{\myAutorsFoot}{\myAutors}
|
||||
|
||||
% If you want to draw images by latex:
|
||||
% http://www.texample.net/tikz/
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{arrows,shapes}
|
||||
|
||||
% Apply the acg layout
|
||||
\include{layoutacg}
|
||||
|
||||
% Setup the title page
|
||||
\title{\myTitle}
|
||||
\author{\myAutors}
|
||||
\institute{RWTH Aachen University}
|
||||
\date{\today}
|
||||
\subject{\myTitle}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\begin{frame}
|
||||
\titlepage
|
||||
\end{frame}
|
||||
|
||||
\section{\myTitle}
|
||||
|
||||
\subsection{Steffen}
|
||||
|
||||
\begin{frame}
|
||||
\begin{itemize}
|
||||
\item Triggers:
|
||||
\begin{itemize}
|
||||
\item Trigger Scripts are now written in Lua
|
||||
\item No more hardcoded trigger events
|
||||
\item Could be changed at runtime
|
||||
\end{itemize}
|
||||
\uncover<2->{Converter
|
||||
\begin{itemize}
|
||||
\item Added various features
|
||||
\end{itemize}}
|
||||
\uncover<3->{ Future Work:
|
||||
\begin{itemize}
|
||||
\item Debug Converter
|
||||
\item Implement a seperate loading thread (split up level and only load closest stuff)
|
||||
\end{itemize}}
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\subsection{Japser}
|
||||
|
||||
\begin{frame}
|
||||
\begin{itemize}
|
||||
\item Physics:
|
||||
\begin{itemize}
|
||||
\item Added spring constraints (can be used by Doors and Buttons for example)
|
||||
\item Implemented collision masks
|
||||
\item General collision fixes
|
||||
\end{itemize}
|
||||
\uncover<2->{ Future Work:
|
||||
\begin{itemize}
|
||||
\item Make Physics more roboust
|
||||
\item Camera collision(already started)
|
||||
\end{itemize}}
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\subsection{Simon}
|
||||
\begin{frame}
|
||||
\begin{itemize}
|
||||
\item Level Design:
|
||||
\begin{itemize}
|
||||
\item Worked on our own heightmap
|
||||
\item Added a bridge to our level
|
||||
\end{itemize}
|
||||
\uncover<2->{ Future Work:
|
||||
\begin{itemize}
|
||||
\item Finish the level
|
||||
\end{itemize}}
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\subsection{Fabian}
|
||||
|
||||
\begin{frame}
|
||||
\begin{itemize}
|
||||
\item Graphics:
|
||||
\begin{itemize}
|
||||
\item \grqq{Improved}\grqq{} shadows
|
||||
\item Removed cascaded shadow mapping
|
||||
\item Improved point light shadows(see demo)
|
||||
\end{itemize}
|
||||
\uncover<2->{ Future Work:
|
||||
\begin{itemize}
|
||||
\item Finish working on shadows
|
||||
\item Implement bump mapping
|
||||
\item Particle Systems
|
||||
\item (Screen Space Ambient Occlusion)
|
||||
\end{itemize}}
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
\subsection{Demo}
|
||||
\begin{frame}
|
||||
\includegraphics[width=11cm]{images/demo_m3}
|
||||
\end{frame}
|
||||
|
||||
\end{document}
|
Loading…
Reference in New Issue
Block a user