This commit is contained in:
sfroitzheim 2015-03-02 16:47:54 +01:00
commit 0dd10f423a
18 changed files with 185 additions and 73 deletions

View File

@ -1,52 +1,52 @@
# Blender v2.72 (sub 0) OBJ File: 'Gate.blend' # Blender v2.72 (sub 0) OBJ File: ''
# www.blender.org # www.blender.org
o Wall_Cube.001 o Wall_Cube.000
v 0.537791 -3.045326 3.045326
v 0.537791 -3.045326 -3.045326
v -0.537791 -3.045326 -3.045326
v -0.537791 -3.045326 3.045326
v 0.537791 3.045326 3.045326
v 0.537791 3.045326 -3.045326 v 0.537791 3.045326 -3.045326
v -0.537791 3.045326 -3.045326 v 0.537791 -3.045326 -3.045326
v 0.537791 -3.045326 3.045326
v -0.537791 3.045326 3.045326 v -0.537791 3.045326 3.045326
v -0.537791 -3.045326 3.045326
v -0.537791 -3.045326 -3.045326
v 0.537791 3.045326 3.045326
v -0.537791 3.045326 -3.045326
vt 1.000000 0.000000 vt 1.000000 0.000000
vt 1.000000 -1.000000
vt 0.000000 -1.000000 vt 0.000000 -1.000000
vt 1.000000 -1.000000
vt -1.000000 0.000000 vt -1.000000 0.000000
vt -1.000000 -1.000000 vt -1.000000 -1.000000
vt 0.000000 0.000000 vt 0.000000 0.000000
vt 0.039666 1.000166 vt 0.039666 1.000166
vt 0.039666 0.000166
vt 0.000334 0.000166 vt 0.000334 0.000166
vt 0.039666 0.000166
vt 0.960071 -0.007992 vt 0.960071 -0.007992
vt 0.959736 0.992008
vt 0.993184 0.992028 vt 0.993184 0.992028
vt 0.959736 0.992008
vt 0.002338 0.996941 vt 0.002338 0.996941
vt 0.032299 0.996953
vt 0.032522 -0.000041 vt 0.032522 -0.000041
vt 0.032299 0.996953
vt 0.995477 0.006970 vt 0.995477 0.006970
vt 0.952679 0.006970
vt 0.952679 0.987810 vt 0.952679 0.987810
vt 0.952679 0.006970
vt 0.000334 1.000166 vt 0.000334 1.000166
vt 0.993520 -0.007972 vt 0.993520 -0.007972
vt 0.002561 -0.000052 vt 0.002561 -0.000052
vt 0.995477 0.987810 vt 0.995477 0.987810
vn -1.000000 0.000000 0.000000
vn 1.000000 0.000000 0.000000 vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000 vn -1.000000 0.000000 0.000000
vn 0.000000 0.000000 -1.000000 vn 0.000000 0.000000 -1.000000
vn 0.000000 -0.000000 1.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 1.000000 0.000000 vn 0.000000 1.000000 0.000000
vn 0.000000 -1.000000 0.000000
s off s off
f 6/1/1 2/2/1 1/3/1 f 1/1/1 3/2/1 2/3/1
f 8/4/2 4/5/2 3/3/2 f 4/4/2 6/2/2 5/5/2
f 5/6/1 6/1/1 1/3/1 f 7/6/1 3/2/1 1/1/1
f 7/6/2 8/4/2 3/3/2 f 8/6/2 6/2/2 4/4/2
f 7/7/3 3/8/3 2/9/3 f 8/7/3 2/8/3 6/9/3
f 5/10/4 1/11/4 4/12/4 f 7/10/4 5/11/4 3/12/4
f 2/13/5 3/14/5 4/15/5 f 2/13/5 5/14/5 6/15/5
f 7/16/6 6/17/6 5/18/6 f 8/16/6 7/17/6 1/18/6
f 6/19/3 7/7/3 2/9/3 f 1/19/3 2/8/3 8/7/3
f 8/20/4 5/10/4 4/12/4 f 4/20/4 5/11/4 7/10/4
f 1/21/5 2/13/5 4/15/5 f 3/21/5 5/14/5 2/13/5
f 8/22/6 7/16/6 5/18/6 f 4/22/6 7/17/6 8/16/6

View File

@ -1,54 +1,54 @@
# Blender v2.72 (sub 0) OBJ File: 'SimpleWall.blend' # Blender v2.72 (sub 0) OBJ File: ''
# www.blender.org # www.blender.org
o Wall_Cube.001 o Wall_Cube.001
v 0.537791 -3.045326 3.045326 v 0.537791 3.045326 -3.045326
v 0.537791 -3.045326 -3.045326 v 0.537791 -3.045326 -3.045326
v 0.537791 -3.045326 3.045326
v -0.537791 3.045326 -3.045326
v -0.537791 -3.045326 -3.045326 v -0.537791 -3.045326 -3.045326
v -0.537791 3.045326 3.045326
v -0.537791 -3.045326 3.045326 v -0.537791 -3.045326 3.045326
v 0.537791 3.045326 3.045326 v 0.537791 3.045326 3.045326
v 0.537791 3.045326 -3.045326
v -0.537791 3.045326 -3.045326
v -0.537791 3.045326 3.045326
vt 1.002363 0.998329 vt 1.002363 0.998329
vt 1.002363 -0.001671
vt 0.005637 -0.001671 vt 0.005637 -0.001671
vt 1.002363 -0.001671
vt 0.394169 0.995358 vt 0.394169 0.995358
vt 0.394169 -0.004642
vt 0.605831 -0.004642 vt 0.605831 -0.004642
vt 0.394169 -0.004642
vt -0.003002 0.995358 vt -0.003002 0.995358
vt -0.003002 -0.004642
vt 0.996752 -0.004642 vt 0.996752 -0.004642
vt -0.003002 -0.004642
vt 0.605361 0.992386 vt 0.605361 0.992386
vt 0.605361 -0.007614
vt 0.392389 -0.007614 vt 0.392389 -0.007614
vt 0.605361 -0.007614
vt 0.001396 0.906027 vt 0.001396 0.906027
vt 0.001923 0.094175
vt 0.998604 0.093973 vt 0.998604 0.093973
vt 0.001923 0.094175
vt 1.000000 0.097080 vt 1.000000 0.097080
vt 1.000000 0.902920
vt 0.000000 0.902920 vt 0.000000 0.902920
vt 1.000000 0.902920
vt 0.005637 0.998329 vt 0.005637 0.998329
vt 0.605831 0.995358 vt 0.605831 0.995358
vt 0.996752 0.995358 vt 0.996752 0.995358
vt 0.392389 0.992386 vt 0.392389 0.992386
vt 0.998077 0.905824 vt 0.998077 0.905824
vt 0.000000 0.097080 vt 0.000000 0.097080
vn -1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn 1.000000 0.000000 0.000000 vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 -1.000000 vn 0.000000 0.000000 -1.000000
vn -1.000000 0.000000 0.000000
vn 0.000000 -0.000000 1.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 1.000000 0.000000 vn 0.000000 1.000000 0.000000
vn 0.000000 -1.000000 0.000000
s off s off
f 6/1/1 2/2/1 1/3/1 f 1/1/1 3/2/1 2/3/1
f 7/4/2 3/5/2 2/6/2 f 4/4/2 2/5/2 5/6/2
f 8/7/3 4/8/3 3/9/3 f 6/7/3 5/8/3 7/9/3
f 5/10/4 1/11/4 4/12/4 f 8/10/4 7/11/4 3/12/4
f 2/13/5 3/14/5 4/15/5 f 2/13/5 7/14/5 5/15/5
f 7/16/6 6/17/6 5/18/6 f 4/16/6 8/17/6 1/18/6
f 5/19/1 6/1/1 1/3/1 f 8/19/1 3/2/1 1/1/1
f 6/20/2 7/4/2 2/6/2 f 1/20/2 2/5/2 4/4/2
f 7/21/3 8/7/3 3/9/3 f 4/21/3 5/8/3 6/7/3
f 8/22/4 5/10/4 4/12/4 f 6/22/4 7/11/4 8/10/4
f 1/23/5 2/13/5 4/15/5 f 3/23/5 7/14/5 2/13/5
f 8/24/6 7/16/6 5/18/6 f 6/24/6 8/17/6 4/16/6

View File

@ -145,7 +145,7 @@
<xRot>0.0</xRot> <xRot>0.0</xRot>
<yRot>0.0</yRot> <yRot>0.0</yRot>
<zRot>0.0</zRot> <zRot>0.0</zRot>
<scale>1.0</scale> <scale>1.044</scale>
<mass>0.5</mass> <mass>0.5</mass>
</object> </object>
<object> <object>
@ -435,7 +435,7 @@
<yRot>0.0</yRot> <yRot>0.0</yRot>
<zRot>0.0</zRot> <zRot>0.0</zRot>
<scale>1.5</scale> <scale>1.5</scale>
<mass>0.0</mass> <mass>100.0</mass>
</object> </object>
</composition> </composition>

View File

@ -706,6 +706,13 @@
<idGreen>0</idGreen> <idGreen>0</idGreen>
<idBlue>112</idBlue> <idBlue>112</idBlue>
<typeID>120</typeID> <typeID>120</typeID>
<positionConstraint>
<objectNum>0</objectNum>
<xPosition>-6.5</xPosition>
<yPosition>22.0</yPosition>
<zPosition>51.5</zPosition>
<strength>12.0</strength>
</positionConstraint>
<trigger> <trigger>
<name>-</name> <name>-</name>
<xPosition>0</xPosition> <xPosition>0</xPosition>
@ -735,6 +742,13 @@
<idGreen>0</idGreen> <idGreen>0</idGreen>
<idBlue>111</idBlue> <idBlue>111</idBlue>
<typeID>120</typeID> <typeID>120</typeID>
<positionConstraint>
<objectNum>0</objectNum>
<xPosition>-6.5</xPosition>
<yPosition>22.0</yPosition>
<zPosition>29.5</zPosition>
<strength>12.0</strength>
</positionConstraint>
<trigger> <trigger>
<name>-</name> <name>-</name>
<xPosition>0</xPosition> <xPosition>0</xPosition>
@ -2388,6 +2402,13 @@
<idGreen>0</idGreen> <idGreen>0</idGreen>
<idBlue>45</idBlue> <idBlue>45</idBlue>
<typeID>120</typeID> <typeID>120</typeID>
<positionConstraint>
<objectNum>0</objectNum>
<xPosition>-53.5</xPosition>
<yPosition>22.0</yPosition>
<zPosition>51.5</zPosition>
<strength>12.0</strength>
</positionConstraint>
<trigger> <trigger>
<name>-</name> <name>-</name>
<xPosition>0</xPosition> <xPosition>0</xPosition>
@ -2446,6 +2467,13 @@
<idGreen>0</idGreen> <idGreen>0</idGreen>
<idBlue>43</idBlue> <idBlue>43</idBlue>
<typeID>120</typeID> <typeID>120</typeID>
<positionConstraint>
<objectNum>0</objectNum>
<xPosition>-53.5</xPosition>
<yPosition>22.0</yPosition>
<zPosition>29.5</zPosition>
<strength>12.0</strength>
</positionConstraint>
<trigger> <trigger>
<name>-</name> <name>-</name>
<xPosition>0</xPosition> <xPosition>0</xPosition>
@ -3635,19 +3663,41 @@
<idGreen>0</idGreen> <idGreen>0</idGreen>
<idBlue>1</idBlue> <idBlue>1</idBlue>
<typeID>120</typeID> <typeID>120</typeID>
<positionConstraint>
<objectNum>0</objectNum>
<xPosition>-161.5</xPosition>
<yPosition>21.7</yPosition>
<zPosition>67.5</zPosition>
<strength>12.0</strength>
</positionConstraint>
<trigger> <trigger>
<name>-</name> <name>openThirdDoor</name>
<xPosition>0</xPosition> <xPosition>-161.5</xPosition>
<yPosition>0</yPosition> <yPosition>21.7</yPosition>
<zPosition>0</zPosition> <zPosition>67.5</zPosition>
<targetIdGreen>-</targetIdGreen> <targetIdGreen>-</targetIdGreen>
<targetIdBlue>-</targetIdBlue> <targetIdBlue>-</targetIdBlue>
<distance>1.0</distance> <distance>0.2</distance>
<isBiggerThan>true</isBiggerThan>
<objectNum>0</objectNum>
<luaScript>openThirdDoor.lua</luaScript>
<toChangeIdGreen>0</toChangeIdGreen>
<toChangeIdBlue>178</toChangeIdBlue>
<toChangeObjNum>0</toChangeObjNum>
</trigger>
<trigger>
<name>openThirdDoorUndo</name>
<xPosition>-161.5</xPosition>
<yPosition>21.7</yPosition>
<zPosition>67.5</zPosition>
<targetIdGreen>-</targetIdGreen>
<targetIdBlue>-</targetIdBlue>
<distance>0.2</distance>
<isBiggerThan>false</isBiggerThan> <isBiggerThan>false</isBiggerThan>
<objectNum>0</objectNum> <objectNum>0</objectNum>
<luaScript>-</luaScript> <luaScript>openThirdDoorUndo.lua</luaScript>
<toChangeIdGreen>0</toChangeIdGreen> <toChangeIdGreen>0</toChangeIdGreen>
<toChangeIdBlue>0</toChangeIdBlue> <toChangeIdBlue>178</toChangeIdBlue>
<toChangeObjNum>0</toChangeObjNum> <toChangeObjNum>0</toChangeObjNum>
</trigger> </trigger>
</composition> </composition>
@ -6105,7 +6155,7 @@
<xPosition>17.5</xPosition> <xPosition>17.5</xPosition>
<yPosition>22.0</yPosition> <yPosition>22.0</yPosition>
<zPosition>159.5</zPosition> <zPosition>159.5</zPosition>
<strength>7.0</strength> <strength>12.0</strength>
</positionConstraint> </positionConstraint>
<trigger> <trigger>
<name>openFirstDoor</name> <name>openFirstDoor</name>
@ -8536,6 +8586,13 @@
<idGreen>1</idGreen> <idGreen>1</idGreen>
<idBlue>8</idBlue> <idBlue>8</idBlue>
<typeID>221</typeID> <typeID>221</typeID>
<positionConstraint>
<objectNum>0</objectNum>
<xPosition>-81.5</xPosition>
<yPosition>25.0</yPosition>
<zPosition>4.5</zPosition>
<strength>100.0</strength>
</positionConstraint>
<trigger> <trigger>
<name>-</name> <name>-</name>
<xPosition>0</xPosition> <xPosition>0</xPosition>
@ -10479,6 +10536,13 @@
<idGreen>0</idGreen> <idGreen>0</idGreen>
<idBlue>178</idBlue> <idBlue>178</idBlue>
<typeID>221</typeID> <typeID>221</typeID>
<positionConstraint>
<objectNum>0</objectNum>
<xPosition>-172.5</xPosition>
<yPosition>25.0</yPosition>
<zPosition>58.5</zPosition>
<strength>100.0</strength>
</positionConstraint>
<trigger> <trigger>
<name>-</name> <name>-</name>
<xPosition>0</xPosition> <xPosition>0</xPosition>

View File

@ -11,7 +11,7 @@ function trigger(objectToChange)
local strength = 100 local strength = 100
local xPos = 17.5 local xPos = 17.5
local yPos = 35 local yPos = 33
local zPos = 81.5 local zPos = 81.5
level:moveObject(objectToChange, strength, xPos, yPos, zPos) level:moveObject(objectToChange, strength, xPos, yPos, zPos)

View File

@ -0,0 +1,23 @@
local global = require( "global" )
if(global.triggeredOpenThirdDoor == nil) then
global.triggeredOpenThirdDoor = false
end
function trigger(objectToChange)
if(global.triggeredOpenThirdDoor == false) then
if(not level) then
print("No level found in Lua!")
return
end
local strength = 100
local xPos = -172.5
local yPos = 33
local zPos = 58.5
level:moveObject(objectToChange, strength, xPos, yPos, zPos)
global.triggeredOpenThirdDoorUndo = false
global.triggeredOpenThirdDoor = true
print("openThirdDoor")
end
end

View File

@ -0,0 +1,23 @@
local global = require( "global" )
if(global.triggeredOpenThirdDoorUndo == nil) then
global.triggeredOpenThirdDoorUndo = true
end
function trigger(objectToChange)
if(global.triggeredOpenThirdDoorUndo == false) then
if(not level) then
print("No level found in Lua!")
return
end
local strength = 100
local xPos = -172.5
local yPos = 25
local zPos = 58.5
level:moveObject(objectToChange, strength, xPos, yPos, zPos)
global.triggeredOpenThirdDoor = false
global.triggeredOpenThirdDoorUndo = true
print("openThirdDoorUndo")
end
end

View File

@ -56,8 +56,8 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
} }
} }
void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) { void Level::update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) {
physics.takeUpdateStep(runTime); physics.takeUpdateStep(runTimeSinceLastUpdate);
// Ignore first two mouse updates, because they are incorrect // Ignore first two mouse updates, because they are incorrect
// DON'T try to move this functionallity elsewhere // DON'T try to move this functionallity elsewhere
@ -103,9 +103,11 @@ void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPre
skydome->setPosition(glm::vec3(cameraCenter->getPosition().x, skydome->setPosition(glm::vec3(cameraCenter->getPosition().x,
0.0f, cameraCenter->getPosition().z)); 0.0f, cameraCenter->getPosition().z));
if (runTime > 2.0f) {
for(unsigned int i = 0; i<triggers.size(); i++) { for(unsigned int i = 0; i<triggers.size(); i++) {
triggers.at(i).triggerUpdate(); triggers.at(i).triggerUpdate();
} }
}
} }
glm::vec3 Level::getAmbientLight() { glm::vec3 Level::getAmbientLight() {

View File

@ -24,7 +24,7 @@ class Level {
Level(); Level();
~Level(); ~Level();
void load(); void load();
void update(float runTime, glm::vec2 mouseDelta,bool wPressed, bool aPressed,bool sPressed, bool dPressed, bool kPressed, bool lPressed); void update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta,bool wPressed, bool aPressed,bool sPressed, bool dPressed, bool kPressed, bool lPressed);
void render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass, void render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
glm::mat4* viewProjectionMatrix, std::vector<glm::mat4>* shadowVPs=0); glm::mat4* viewProjectionMatrix, std::vector<glm::mat4>* shadowVPs=0);
glm::vec3 getAmbientLight(); glm::vec3 getAmbientLight();

View File

@ -161,13 +161,13 @@ int main( int argc, char *argv[] )
double xpos, ypos; double xpos, ypos;
glfwGetCursorPos(window, &xpos, &ypos); glfwGetCursorPos(window, &xpos, &ypos);
glfwSetCursorPos(window, app.getGraphics()->getWindowSize().x/2, app.getGraphics()->getWindowSize().y/2); glfwSetCursorPos(window, app.getGraphics()->getWindowSize().x/2, app.getGraphics()->getWindowSize().y/2);
app.getLevel()->update(now - lastUpdate, app.getLevel()->update(now - lastUpdate, now,
glm::vec2((float)ypos-app.getGraphics()->getWindowSize().y/2, glm::vec2((float)ypos-app.getGraphics()->getWindowSize().y/2,
(float)xpos-app.getGraphics()->getWindowSize().x/2), (float)xpos-app.getGraphics()->getWindowSize().x/2),
stateW == GLFW_PRESS,stateA == GLFW_PRESS,stateS == GLFW_PRESS,stateD == GLFW_PRESS,stateK == GLFW_PRESS,stateL == GLFW_PRESS); stateW == GLFW_PRESS,stateA == GLFW_PRESS,stateS == GLFW_PRESS,stateD == GLFW_PRESS,stateK == GLFW_PRESS,stateL == GLFW_PRESS);
} }
else { else {
app.getLevel()->update(now - lastUpdate, glm::vec2(0.0f, 0.0f), false, false, false, false,false,false); app.getLevel()->update(now - lastUpdate, now, glm::vec2(0.0f, 0.0f), false, false, false, false,false,false);
if (app.isLocked()) { if (app.isLocked()) {
app.ignoredOneMouseUpdate(); app.ignoredOneMouseUpdate();
} }