[Orxonox-commit 5600] r10262 - in code/trunk: data/defaultConfig data/gui/layouts data/gui/scripts data/levels data/levels/includes data/levels/templates data/overlays src/libraries/tools src/modules/gametypes src/modules/jump src/modules/objects src/modules/objects/collisionshapes src/modules/objects/controllers src/modules/tetris src/orxonox src/orxonox/controllers src/orxonox/items src/orxonox/worldentities/pawns
landauf at orxonox.net
landauf at orxonox.net
Fri Feb 6 23:30:26 CET 2015
Author: landauf
Date: 2015-02-06 23:30:26 +0100 (Fri, 06 Feb 2015)
New Revision: 10262
Modified:
code/trunk/data/defaultConfig/orxonox.ini
code/trunk/data/gui/layouts/CampaignMenu.layout
code/trunk/data/gui/scripts/CampaignMenu.lua
code/trunk/data/gui/scripts/testscript.lua
code/trunk/data/levels/4Dtest.oxw
code/trunk/data/levels/AnihilationThreat.oxw
code/trunk/data/levels/DodgeRace.oxw
code/trunk/data/levels/FPS_Level_HS14.oxw
code/trunk/data/levels/ModularShipsTest0.oxw
code/trunk/data/levels/ModularShipsTest1.oxw
code/trunk/data/levels/collisionShapes.oxw
code/trunk/data/levels/includes/weaponSettingsFPS_HS14.oxi
code/trunk/data/levels/includes/weaponSettingsTurret1.oxi
code/trunk/data/levels/jump.oxw
code/trunk/data/levels/kecks.oxw
code/trunk/data/levels/levelTry.oxw
code/trunk/data/levels/michaelstestfile.lua
code/trunk/data/levels/scriptController.oxw
code/trunk/data/levels/templates/DodgeRacePattern.oxt
code/trunk/data/levels/templates/FPS_HS14.oxt
code/trunk/data/levels/templates/ModularSpaceShipTest.oxt
code/trunk/data/levels/templates/enemytowerdefense.oxt
code/trunk/data/levels/templates/spaceshipDodgeRace.oxt
code/trunk/data/levels/templates/spacestation_elements.oxt
code/trunk/data/levels/templates/ss_tube01.oxt
code/trunk/data/levels/templates/standardTurret.oxt
code/trunk/data/overlays/DodgeRaceHUD.oxo
code/trunk/data/overlays/jumpHUD.oxo
code/trunk/src/libraries/tools/BulletDebugDrawer.cc
code/trunk/src/libraries/tools/BulletDebugDrawer.h
code/trunk/src/libraries/tools/DebugDrawer.cc
code/trunk/src/libraries/tools/DebugDrawer.h
code/trunk/src/libraries/tools/IcoSphere.cc
code/trunk/src/libraries/tools/IcoSphere.h
code/trunk/src/libraries/tools/OgreBulletUtils.h
code/trunk/src/modules/gametypes/SpaceRaceBot.cc
code/trunk/src/modules/gametypes/SpaceRaceBot.h
code/trunk/src/modules/gametypes/SpaceRaceController.cc
code/trunk/src/modules/gametypes/SpaceRaceController.h
code/trunk/src/modules/jump/CMakeLists.txt
code/trunk/src/modules/jump/Jump.cc
code/trunk/src/modules/jump/Jump.h
code/trunk/src/modules/jump/JumpBoots.cc
code/trunk/src/modules/jump/JumpBoots.h
code/trunk/src/modules/jump/JumpCenterpoint.cc
code/trunk/src/modules/jump/JumpCenterpoint.h
code/trunk/src/modules/jump/JumpEnemy.cc
code/trunk/src/modules/jump/JumpEnemy.h
code/trunk/src/modules/jump/JumpFigure.cc
code/trunk/src/modules/jump/JumpFigure.h
code/trunk/src/modules/jump/JumpItem.cc
code/trunk/src/modules/jump/JumpItem.h
code/trunk/src/modules/jump/JumpPlatform.cc
code/trunk/src/modules/jump/JumpPlatform.h
code/trunk/src/modules/jump/JumpPlatformDisappear.cc
code/trunk/src/modules/jump/JumpPlatformDisappear.h
code/trunk/src/modules/jump/JumpPlatformFake.cc
code/trunk/src/modules/jump/JumpPlatformFake.h
code/trunk/src/modules/jump/JumpPlatformHMove.cc
code/trunk/src/modules/jump/JumpPlatformHMove.h
code/trunk/src/modules/jump/JumpPlatformStatic.cc
code/trunk/src/modules/jump/JumpPlatformStatic.h
code/trunk/src/modules/jump/JumpPlatformTimer.cc
code/trunk/src/modules/jump/JumpPlatformTimer.h
code/trunk/src/modules/jump/JumpPlatformVMove.cc
code/trunk/src/modules/jump/JumpPlatformVMove.h
code/trunk/src/modules/jump/JumpPrereqs.h
code/trunk/src/modules/jump/JumpProjectile.cc
code/trunk/src/modules/jump/JumpProjectile.h
code/trunk/src/modules/jump/JumpPropeller.cc
code/trunk/src/modules/jump/JumpPropeller.h
code/trunk/src/modules/jump/JumpRocket.cc
code/trunk/src/modules/jump/JumpRocket.h
code/trunk/src/modules/jump/JumpScore.cc
code/trunk/src/modules/jump/JumpScore.h
code/trunk/src/modules/jump/JumpShield.cc
code/trunk/src/modules/jump/JumpShield.h
code/trunk/src/modules/jump/JumpSpring.cc
code/trunk/src/modules/jump/JumpSpring.h
code/trunk/src/modules/objects/Turret.cc
code/trunk/src/modules/objects/Turret.h
code/trunk/src/modules/objects/collisionshapes/CylinderCollisionShape.cc
code/trunk/src/modules/objects/collisionshapes/CylinderCollisionShape.h
code/trunk/src/modules/objects/controllers/CMakeLists.txt
code/trunk/src/modules/objects/controllers/TeamTargetProxy.cc
code/trunk/src/modules/objects/controllers/TeamTargetProxy.h
code/trunk/src/modules/objects/controllers/TurretController.cc
code/trunk/src/modules/objects/controllers/TurretController.h
code/trunk/src/modules/tetris/TetrisBrick.cc
code/trunk/src/modules/tetris/TetrisBrick.h
code/trunk/src/modules/tetris/TetrisScore.cc
code/trunk/src/modules/tetris/TetrisScore.h
code/trunk/src/orxonox/ShipPartManager.cc
code/trunk/src/orxonox/ShipPartManager.h
code/trunk/src/orxonox/controllers/ControllerDirector.cc
code/trunk/src/orxonox/controllers/ControllerDirector.h
code/trunk/src/orxonox/controllers/ScriptController.cc
code/trunk/src/orxonox/controllers/ScriptController.h
code/trunk/src/orxonox/controllers/testscript.lua
code/trunk/src/orxonox/items/PartDestructionEvent.cc
code/trunk/src/orxonox/items/PartDestructionEvent.h
code/trunk/src/orxonox/items/ShipPart.cc
code/trunk/src/orxonox/items/ShipPart.h
code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h
Log:
eol-style native. no changes in code.
Modified: code/trunk/data/defaultConfig/orxonox.ini
===================================================================
--- code/trunk/data/defaultConfig/orxonox.ini 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/data/defaultConfig/orxonox.ini 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,5 +1,5 @@
-[LevelManager]
-campaignMissions_[0] = "missionOne.oxw"
-campaignMissions_[1] = "fightInOurBack.oxw"
-campaignMissions_[2] = "pirateAttack.oxw"
-campaignMissions_[3] = "iJohnVane_TriptoArea51.oxw"
+[LevelManager]
+campaignMissions_[0] = "missionOne.oxw"
+campaignMissions_[1] = "fightInOurBack.oxw"
+campaignMissions_[2] = "pirateAttack.oxw"
+campaignMissions_[3] = "iJohnVane_TriptoArea51.oxw"
Property changes on: code/trunk/data/defaultConfig/orxonox.ini
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/gui/layouts/CampaignMenu.layout
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/gui/scripts/CampaignMenu.lua
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/gui/scripts/testscript.lua
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/4Dtest.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/AnihilationThreat.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/DodgeRace.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/FPS_Level_HS14.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/data/levels/ModularShipsTest0.oxw
===================================================================
--- code/trunk/data/levels/ModularShipsTest0.oxw 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/data/levels/ModularShipsTest0.oxw 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,76 +1,76 @@
-<LevelInfo
- name = "Modular Ships - Test 0"
- description = "A level to test the basic functions of modular spaceships using simple boxes."
- tags = "test"
- screenshot = "emptylevel.png"
-/>
-
-<?lua
- include("stats.oxo")
- include("HUDTemplates3.oxo")
- include("templates/lodInformation.oxt")
-?>
-
-<?lua
- include("templates/spaceshipAssff2.oxt")
- include("templates/spaceshipPirate.oxt")
- include("templates/spaceshipEscort.oxt")
- include("templates/HeavyCruiser.oxt")
- include("templates/ModularSpaceShipTest.oxt")
-?>
-
-<Level>
- <templates>
- <Template link=lodtemplate_default />
- </templates>
- <?lua include("includes/notifications.oxi") ?>
-
- <Scene
- ambientlight = "0.8, 0.8, 0.8"
- skybox = "Orxonox/Starbox"
- >
-
- <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
- <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
-
- <ModularSpaceShip position="0,0,0" health="2000" maxhealth="4000" initialhealth="2000">
- <templates>
- <Template link=ModularSpaceShipTest />
- </templates>
- </ModularSpaceShip>
-
- <StaticEntity position="0,0,60" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
- </attached>
- <collisionShapes>
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity position="0,60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
- </attached>
- <collisionShapes>
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity position="0,0,-60" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
- </attached>
- <collisionShapes>
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity position="0,-60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
- </attached>
- <collisionShapes>
- </collisionShapes>
- </StaticEntity>
-
- </Scene>
-</Level>
-
+<LevelInfo
+ name = "Modular Ships - Test 0"
+ description = "A level to test the basic functions of modular spaceships using simple boxes."
+ tags = "test"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff2.oxt")
+ include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipEscort.oxt")
+ include("templates/HeavyCruiser.oxt")
+ include("templates/ModularSpaceShipTest.oxt")
+?>
+
+<Level>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+ <ModularSpaceShip position="0,0,0" health="2000" maxhealth="4000" initialhealth="2000">
+ <templates>
+ <Template link=ModularSpaceShipTest />
+ </templates>
+ </ModularSpaceShip>
+
+ <StaticEntity position="0,0,60" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
+ </attached>
+ <collisionShapes>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity position="0,60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
+ </attached>
+ <collisionShapes>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity position="0,0,-60" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
+ </attached>
+ <collisionShapes>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity position="0,-60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
+ </attached>
+ <collisionShapes>
+ </collisionShapes>
+ </StaticEntity>
+
+ </Scene>
+</Level>
+
Property changes on: code/trunk/data/levels/ModularShipsTest0.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/data/levels/ModularShipsTest1.oxw
===================================================================
--- code/trunk/data/levels/ModularShipsTest1.oxw 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/data/levels/ModularShipsTest1.oxw 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,109 +1,109 @@
-<LevelInfo
- name = "Modular Ships - Test 1"
- description = "A level to test the implementation of HeavyCruiser as modular spaceship."
- tags = "test"
- screenshot = "emptylevel.png"
-/>
-
-<?lua
- include("stats.oxo")
- include("HUDTemplates3.oxo")
- include("templates/lodInformation.oxt")
-?>
-
-<?lua
- include("templates/spaceshipAssff2.oxt")
- include("templates/spaceshipPirate.oxt")
- include("templates/spaceshipEscort.oxt")
- include("templates/HeavyCruiser.oxt")
-?>
-
-<Level>
- <templates>
- <Template link=lodtemplate_default />
- </templates>
- <?lua include("includes/notifications.oxi") ?>
-
- <Scene
- ambientlight = "0.8, 0.8, 0.8"
- skybox = "Orxonox/Starbox"
- >
-
- <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
- <!-- <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort /> -->
- <SpawnPoint team=0 position="-500,0,0" lookat="0,0,0" spawnclass=ModularSpaceShip pawndesign=HeavyCruiser />
-
- <MovableEntity position="0,0,0" collisionType=dynamic scale=1 linearDamping=0.8 angularDamping=0 collisiondamage=0.005 enablecollisiondamage=true>
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="40,40,40" />
- <StaticEntity position="0,90,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- </collisionShapes>
- </StaticEntity>
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="40,40,40" />
- </collisionShapes>
- </MovableEntity>
-
- <Pawn health=1000 initialhealth=1000 maxhealth=1000 position="0,-100,-100" direction="0,0,0" collisionType=dynamic mass=1000 name=box radarname = "Pawn 0" >
- <attached>
- <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
- <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
- <StaticEntity position="0,-120,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
- <Model position="0,0,60" mesh="cube.mesh" scale3D="30,30,30" />
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- <BoxCollisionShape position="0,0,60" halfExtents="30,30,30" />
- </collisionShapes>
- </StaticEntity>
- <StaticEntity position="0,-180,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
- <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
- </collisionShapes>
- </StaticEntity>
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
- </collisionShapes>
- </Pawn>
-
- <Pawn health=1000 initialhealth=1000 maxhealth=1000 position="0,-100,100" direction="0,0,0" collisionType=dynamic mass=1000 name=box radarname = "Pawn 1" >
- <attached>
- <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
- <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
- </collisionShapes>
- </Pawn>
-
- <ModularSpaceShip position="0,-100,-200">
- <templates>
- <Template link=spaceshippirate />
- </templates>
- </ModularSpaceShip>
-
- <ModularSpaceShip position="0,-1000,-200" health="2000" maxhealth="4000" initialhealth="2000">
- <templates>
- <Template link=HeavyCruiser />
- </templates>
- </ModularSpaceShip>
-
- </Scene>
-</Level>
-
+<LevelInfo
+ name = "Modular Ships - Test 1"
+ description = "A level to test the implementation of HeavyCruiser as modular spaceship."
+ tags = "test"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff2.oxt")
+ include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipEscort.oxt")
+ include("templates/HeavyCruiser.oxt")
+?>
+
+<Level>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <!-- <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort /> -->
+ <SpawnPoint team=0 position="-500,0,0" lookat="0,0,0" spawnclass=ModularSpaceShip pawndesign=HeavyCruiser />
+
+ <MovableEntity position="0,0,0" collisionType=dynamic scale=1 linearDamping=0.8 angularDamping=0 collisiondamage=0.005 enablecollisiondamage=true>
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="40,40,40" />
+ <StaticEntity position="0,90,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="40,40,40" />
+ </collisionShapes>
+ </MovableEntity>
+
+ <Pawn health=1000 initialhealth=1000 maxhealth=1000 position="0,-100,-100" direction="0,0,0" collisionType=dynamic mass=1000 name=box radarname = "Pawn 0" >
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
+ <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
+ <StaticEntity position="0,-120,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
+ <Model position="0,0,60" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ <BoxCollisionShape position="0,0,60" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+ <StaticEntity position="0,-180,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
+ <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </Pawn>
+
+ <Pawn health=1000 initialhealth=1000 maxhealth=1000 position="0,-100,100" direction="0,0,0" collisionType=dynamic mass=1000 name=box radarname = "Pawn 1" >
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
+ <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </Pawn>
+
+ <ModularSpaceShip position="0,-100,-200">
+ <templates>
+ <Template link=spaceshippirate />
+ </templates>
+ </ModularSpaceShip>
+
+ <ModularSpaceShip position="0,-1000,-200" health="2000" maxhealth="4000" initialhealth="2000">
+ <templates>
+ <Template link=HeavyCruiser />
+ </templates>
+ </ModularSpaceShip>
+
+ </Scene>
+</Level>
+
Property changes on: code/trunk/data/levels/ModularShipsTest1.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/data/levels/collisionShapes.oxw
===================================================================
--- code/trunk/data/levels/collisionShapes.oxw 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/data/levels/collisionShapes.oxw 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,46 +1,46 @@
-<LevelInfo
- name = "Collision shapes"
- description = "A level with some collision shapes."
- tags = "test"
- screenshot = "emptylevel.png"
-/>
-
-<?lua
- include("stats.oxo")
- include("HUDTemplates3.oxo")
- include("templates/lodInformation.oxt")
-?>
-
-<?lua
- include("templates/spaceshipAssff2.oxt")
- include("templates/spaceshipPirate.oxt")
- include("templates/spaceshipEscort.oxt")
-?>
-
-<Level>
- <templates>
- <Template link=lodtemplate_default />
- </templates>
- <?lua include("includes/notifications.oxi") ?>
-
- <Scene
- ambientlight = "0.8, 0.8, 0.8"
- skybox = "Orxonox/Starbox"
- >
-
- <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
- <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
-
- <StaticEntity position="1000,0,0" collisionType="static">
- <collisionShapes>
- <SphereCollisionShape yaw="20" pitch="20" roll="20" position="0,-300,0" radius="100" />
- <CylinderCollisionShape yaw="20" pitch="20" roll="20" position="0,+000,0" radius="50" height="150" />
- <BoxCollisionShape yaw="20" pitch="20" roll="20" position="0,+200,0" halfExtents="30, 50, 80" />
- <ConeCollisionShape yaw="20" pitch="20" roll="20" position="0,+400,0" radius="50" height="150" />
- <PlaneCollisionShape yaw="20" pitch="20" roll="20" position="0,+600,0" normal="0, -1, 0" offset="30" />
- </collisionShapes>
- </StaticEntity>
-
- </Scene>
-</Level>
-
+<LevelInfo
+ name = "Collision shapes"
+ description = "A level with some collision shapes."
+ tags = "test"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff2.oxt")
+ include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipEscort.oxt")
+?>
+
+<Level>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+ <StaticEntity position="1000,0,0" collisionType="static">
+ <collisionShapes>
+ <SphereCollisionShape yaw="20" pitch="20" roll="20" position="0,-300,0" radius="100" />
+ <CylinderCollisionShape yaw="20" pitch="20" roll="20" position="0,+000,0" radius="50" height="150" />
+ <BoxCollisionShape yaw="20" pitch="20" roll="20" position="0,+200,0" halfExtents="30, 50, 80" />
+ <ConeCollisionShape yaw="20" pitch="20" roll="20" position="0,+400,0" radius="50" height="150" />
+ <PlaneCollisionShape yaw="20" pitch="20" roll="20" position="0,+600,0" normal="0, -1, 0" offset="30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ </Scene>
+</Level>
+
Property changes on: code/trunk/data/levels/collisionShapes.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/includes/weaponSettingsFPS_HS14.oxi
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/includes/weaponSettingsTurret1.oxi
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/jump.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/kecks.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/levelTry.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/michaelstestfile.lua
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/scriptController.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/templates/DodgeRacePattern.oxt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/templates/FPS_HS14.oxt
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/data/levels/templates/ModularSpaceShipTest.oxt
===================================================================
--- code/trunk/data/levels/templates/ModularSpaceShipTest.oxt 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/data/levels/templates/ModularSpaceShipTest.oxt 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,166 +1,166 @@
-<Template name=ModularSpaceShipTest>
- <ModularSpaceShip
- hudtemplate = spaceshiphud
- camerapositiontemplate = spaceshipassffcameras
- spawnparticlesource = "Orxonox/fairytwirl"
- spawnparticleduration = 3
- explosionchunks = 6
-
- health = 1000
- maxhealth = 2000
- initialhealth = 1000
-
- shieldhealth = 30
- initialshieldhealth = 30
- maxshieldhealth = 50
- shieldabsorption = 0.8
- reloadrate = 1
- reloadwaittime = 1
-
- primaryThrust = 100
- auxilaryThrust = 30
- rotationThrust = 50
-
- lift = 1;
- stallSpeed = 220;
-
- boostPower = 15
- boostPowerRate = 1
- boostRate = 5
- boostCooldownDuration = 10
-
- shakeFrequency = 15
- shakeAmplitude = 9
-
- collisionType = "dynamic"
- mass = 100
- linearDamping = 0.7
- angularDamping = 0.9999999
-
- explosionSound = "sounds/Explosion2.ogg"
- >
- <engines>
- <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine />
- <MultiStateEngine position="-7.6, 0, 0" template=spaceshipassffengine />
- </engines>
- <attached>
-
- <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
-
- <StaticEntity name="one" position="0,60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity name="two" position="0,0,62" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity name="two_2" position="0,0,124" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity name="three" position="0,-60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity name="four" position="0,0,-59" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- </collisionShapes>
- </StaticEntity>
-
- <StaticEntity name="four_2" position="0,0,-118" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- </collisionShapes>
- </StaticEntity>
-
- </attached>
-
- <parts>
- <ShipPart name="one" initialhealth="20" damageabsorption="1" />
- <ShipPart name="two" initialhealth="20" damageabsorption="1" />
- <ShipPart name="two_2" initialhealth="20" damageabsorption="1" />
- <ShipPart name="three" initialhealth="20" damageabsorption="1" />
- <ShipPart name="four" initialhealth="20" damageabsorption="1" />
- <ShipPart name="four_2" initialhealth="20" damageabsorption="1" />
- </parts>
-
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
- </collisionShapes>
-<?lua
- include("../includes/weaponSettingsAssff.oxi")
-?>
- </ModularSpaceShip>
-</Template>
-
-<Template name=spaceshipassffcameras defaults=0>
- <ModularSpaceShip>
- <camerapositions>
- <CameraPosition position="0,10, 40" drag=true mouselook=true />
- </camerapositions>
- </ModularSpaceShip>
-</Template>
-
-<Template name=spaceshipassffengine baseclass=MultiStateEngine>
- <MultiStateEngine
- boostfactor = 2
-
- speedfront = 150
- speedback = 50
- speedleftright = 50
- speedupdown = 50
-
- defEngineSndNormal = "sounds/Engine_low.ogg"
- defEngineSndBoost = "sounds/Engine_high.ogg"
-
- accelerationfront = 500
- accelerationbrake = 500
- accelerationback = 125
- accelerationleftright = 125
- accelerationupdown = 125
- >
- <EffectContainer condition="idle">
-
- </EffectContainer>
- <EffectContainer condition="not idle">
-
- </EffectContainer>
- <EffectContainer condition="normal or brake">
-
- </EffectContainer>
- <EffectContainer condition="normal or boost">
-
- </EffectContainer>
- <EffectContainer condition="boost">
-
- </EffectContainer>
- </MultiStateEngine>
-</Template>
+<Template name=ModularSpaceShipTest>
+ <ModularSpaceShip
+ hudtemplate = spaceshiphud
+ camerapositiontemplate = spaceshipassffcameras
+ spawnparticlesource = "Orxonox/fairytwirl"
+ spawnparticleduration = 3
+ explosionchunks = 6
+
+ health = 1000
+ maxhealth = 2000
+ initialhealth = 1000
+
+ shieldhealth = 30
+ initialshieldhealth = 30
+ maxshieldhealth = 50
+ shieldabsorption = 0.8
+ reloadrate = 1
+ reloadwaittime = 1
+
+ primaryThrust = 100
+ auxilaryThrust = 30
+ rotationThrust = 50
+
+ lift = 1;
+ stallSpeed = 220;
+
+ boostPower = 15
+ boostPowerRate = 1
+ boostRate = 5
+ boostCooldownDuration = 10
+
+ shakeFrequency = 15
+ shakeAmplitude = 9
+
+ collisionType = "dynamic"
+ mass = 100
+ linearDamping = 0.7
+ angularDamping = 0.9999999
+
+ explosionSound = "sounds/Explosion2.ogg"
+ >
+ <engines>
+ <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine />
+ <MultiStateEngine position="-7.6, 0, 0" template=spaceshipassffengine />
+ </engines>
+ <attached>
+
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
+
+ <StaticEntity name="one" position="0,60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="two" position="0,0,62" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="two_2" position="0,0,124" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="three" position="0,-60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="four" position="0,0,-59" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="four_2" position="0,0,-118" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ </attached>
+
+ <parts>
+ <ShipPart name="one" initialhealth="20" damageabsorption="1" />
+ <ShipPart name="two" initialhealth="20" damageabsorption="1" />
+ <ShipPart name="two_2" initialhealth="20" damageabsorption="1" />
+ <ShipPart name="three" initialhealth="20" damageabsorption="1" />
+ <ShipPart name="four" initialhealth="20" damageabsorption="1" />
+ <ShipPart name="four_2" initialhealth="20" damageabsorption="1" />
+ </parts>
+
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+<?lua
+ include("../includes/weaponSettingsAssff.oxi")
+?>
+ </ModularSpaceShip>
+</Template>
+
+<Template name=spaceshipassffcameras defaults=0>
+ <ModularSpaceShip>
+ <camerapositions>
+ <CameraPosition position="0,10, 40" drag=true mouselook=true />
+ </camerapositions>
+ </ModularSpaceShip>
+</Template>
+
+<Template name=spaceshipassffengine baseclass=MultiStateEngine>
+ <MultiStateEngine
+ boostfactor = 2
+
+ speedfront = 150
+ speedback = 50
+ speedleftright = 50
+ speedupdown = 50
+
+ defEngineSndNormal = "sounds/Engine_low.ogg"
+ defEngineSndBoost = "sounds/Engine_high.ogg"
+
+ accelerationfront = 500
+ accelerationbrake = 500
+ accelerationback = 125
+ accelerationleftright = 125
+ accelerationupdown = 125
+ >
+ <EffectContainer condition="idle">
+
+ </EffectContainer>
+ <EffectContainer condition="not idle">
+
+ </EffectContainer>
+ <EffectContainer condition="normal or brake">
+
+ </EffectContainer>
+ <EffectContainer condition="normal or boost">
+
+ </EffectContainer>
+ <EffectContainer condition="boost">
+
+ </EffectContainer>
+ </MultiStateEngine>
+</Template>
Property changes on: code/trunk/data/levels/templates/ModularSpaceShipTest.oxt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/templates/enemytowerdefense.oxt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/templates/spaceshipDodgeRace.oxt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/templates/spacestation_elements.oxt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/templates/ss_tube01.oxt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/levels/templates/standardTurret.oxt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/overlays/DodgeRaceHUD.oxo
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/data/overlays/jumpHUD.oxo
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/libraries/tools/BulletDebugDrawer.cc
===================================================================
--- code/trunk/src/libraries/tools/BulletDebugDrawer.cc 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/src/libraries/tools/BulletDebugDrawer.cc 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,164 +1,164 @@
-/**
- * Originally from http://www.ogre3d.org/tikiwiki/BulletDebugDrawer&structure=Cookbook
- * This source code is released into the Public Domain.
- *
- * Modified by Fabian 'x3n' Landau by using DebugDrawer and Orxonox specific utilities (e.g. output).
- */
-
-#include "BulletDebugDrawer.h"
-#include "OgreBulletUtils.h"
-
-#include <OgreRoot.h>
-#include <OgreManualObject.h>
-#include <OgreSceneManager.h>
-
-#include "util/Output.h"
-#include "DebugDrawer.h"
-
-namespace orxonox
-{
- BulletDebugDrawer::BulletDebugDrawer(Ogre::SceneManager* sceneManager)
- {
- this->drawer_ = new DebugDrawer(sceneManager, 0.5f);
- this->bFill_ = true;
-
- mContactPoints = &mContactPoints1;
-
- mDebugMode = (DebugDrawModes) DBG_DrawWireframe;
- Ogre::Root::getSingleton().addFrameListener(this);
- }
-
- BulletDebugDrawer::~BulletDebugDrawer()
- {
- Ogre::Root::getSingleton().removeFrameListener(this);
- delete this->drawer_;
- }
-
- void BulletDebugDrawer::drawLine(const btVector3& from, const btVector3& to, const btVector3& color)
- {
- this->drawer_->drawLine(vector3(from), vector3(to), colour(color, 1.0f));
- }
-
-// void BulletDebugDrawer::drawTriangle(const btVector3& v0, const btVector3& v1, const btVector3& v2, const btVector3& color, btScalar alpha)
-// {
-// // TODO
-// }
-
- void BulletDebugDrawer::drawSphere(const btVector3& p, btScalar radius, const btVector3& color)
- {
- this->drawer_->drawSphere(vector3(p), Ogre::Quaternion::IDENTITY, radius, colour(color, 1.0f), this->bFill_);
- }
-
- void BulletDebugDrawer::drawSphere(btScalar radius, const btTransform& transform, const btVector3& color)
- {
- Ogre::Matrix4 matrix = matrix4(transform);
- this->drawer_->drawSphere(matrix.getTrans(), matrix.extractQuaternion(), radius, colour(color, 1.0f), this->bFill_);
- }
-
- void BulletDebugDrawer::drawBox(const btVector3& bbMin, const btVector3& bbMax, const btVector3& color)
- {
- Ogre::Vector3* corners = new Ogre::Vector3[8];
- corners[0] = Ogre::Vector3(bbMin[0], bbMin[1], bbMin[2]);
- corners[1] = Ogre::Vector3(bbMin[0], bbMax[1], bbMin[2]);
- corners[2] = Ogre::Vector3(bbMax[0], bbMax[1], bbMin[2]);
- corners[3] = Ogre::Vector3(bbMax[0], bbMin[1], bbMin[2]);
- corners[4] = Ogre::Vector3(bbMax[0], bbMax[1], bbMax[2]);
- corners[5] = Ogre::Vector3(bbMin[0], bbMax[1], bbMax[2]);
- corners[6] = Ogre::Vector3(bbMin[0], bbMin[1], bbMax[2]);
- corners[7] = Ogre::Vector3(bbMax[0], bbMin[1], bbMax[2]);
- this->drawer_->drawCuboid(corners, colour(color, 1.0f), this->bFill_);
- }
-
- void BulletDebugDrawer::drawBox(const btVector3& bbMin, const btVector3& bbMax, const btTransform& trans, const btVector3& color)
- {
- Ogre::Vector3* corners = new Ogre::Vector3[8];
- corners[0] = Ogre::Vector3(trans * btVector3(bbMin[0], bbMin[1], bbMin[2]));
- corners[1] = Ogre::Vector3(trans * btVector3(bbMin[0], bbMax[1], bbMin[2]));
- corners[2] = Ogre::Vector3(trans * btVector3(bbMax[0], bbMax[1], bbMin[2]));
- corners[3] = Ogre::Vector3(trans * btVector3(bbMax[0], bbMin[1], bbMin[2]));
- corners[4] = Ogre::Vector3(trans * btVector3(bbMax[0], bbMax[1], bbMax[2]));
- corners[5] = Ogre::Vector3(trans * btVector3(bbMin[0], bbMax[1], bbMax[2]));
- corners[6] = Ogre::Vector3(trans * btVector3(bbMin[0], bbMin[1], bbMax[2]));
- corners[7] = Ogre::Vector3(trans * btVector3(bbMax[0], bbMin[1], bbMax[2]));
- this->drawer_->drawCuboid(corners, colour(color, 1.0f), this->bFill_);
- }
-
- void BulletDebugDrawer::drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color)
- {
- Ogre::Matrix4 matrix = matrix4(transform);
- this->drawer_->drawCylinder(matrix.getTrans(), matrix.extractQuaternion(), radius, halfHeight * 2, colour(color, 1.0f), this->bFill_);
- }
-
- void BulletDebugDrawer::drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color)
- {
- Ogre::Matrix4 matrix = matrix4(transform);
- this->drawer_->drawCone(matrix.getTrans(), matrix.extractQuaternion(), radius, height, colour(color, 1.0f), this->bFill_);
- }
-
- void BulletDebugDrawer::drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime, const btVector3& color)
- {
- mContactPoints->resize(mContactPoints->size() + 1);
- ContactPoint p = mContactPoints->back();
- p.from = vector3(PointOnB);
- p.to = p.from + vector3(normalOnB) * distance;
- p.dieTime = Ogre::Root::getSingleton().getTimer()->getMilliseconds() + lifeTime;
- p.color.r = color.x();
- p.color.g = color.y();
- p.color.b = color.z();
- }
-
- bool BulletDebugDrawer::frameStarted(const Ogre::FrameEvent& evt)
- {
- size_t now = Ogre::Root::getSingleton().getTimer()->getMilliseconds();
- std::vector<ContactPoint>* newCP = mContactPoints == &mContactPoints1 ? &mContactPoints2 : &mContactPoints1;
- for (std::vector<ContactPoint>::iterator i = mContactPoints->begin(); i < mContactPoints->end(); i++ )
- {
- ContactPoint& cp = *i;
- this->drawer_->drawLine(cp.from, cp.to, cp.color);
- if (now <= cp.dieTime)
- newCP->push_back(cp);
- }
- mContactPoints->clear();
- mContactPoints = newCP;
-
- // Right before the frame is rendered, call DebugDrawer::build().
- this->drawer_->build();
-
- return true;
- }
-
- bool BulletDebugDrawer::frameEnded(const Ogre::FrameEvent& evt)
- {
- // After the frame is rendered, call DebugDrawer::clear()
- this->drawer_->clear();
-
- return true;
- }
-
- void BulletDebugDrawer::reportErrorWarning(const char* warningString)
- {
- orxout(internal_error) << warningString << endl;
- Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(warningString);
- }
-
- void BulletDebugDrawer::draw3dText(const btVector3& location, const char* textString)
- {
-
- }
-
- void BulletDebugDrawer::setDebugMode(int debugMode)
- {
- mDebugMode = (DebugDrawModes) debugMode;
- }
-
- int BulletDebugDrawer::getDebugMode() const
- {
- return mDebugMode;
- }
-
- void BulletDebugDrawer::configure(bool bFill, float fillAlpha)
- {
- this->bFill_ = bFill;
- this->drawer_->setFillAlpha(fillAlpha);
- }
-}
+/**
+ * Originally from http://www.ogre3d.org/tikiwiki/BulletDebugDrawer&structure=Cookbook
+ * This source code is released into the Public Domain.
+ *
+ * Modified by Fabian 'x3n' Landau by using DebugDrawer and Orxonox specific utilities (e.g. output).
+ */
+
+#include "BulletDebugDrawer.h"
+#include "OgreBulletUtils.h"
+
+#include <OgreRoot.h>
+#include <OgreManualObject.h>
+#include <OgreSceneManager.h>
+
+#include "util/Output.h"
+#include "DebugDrawer.h"
+
+namespace orxonox
+{
+ BulletDebugDrawer::BulletDebugDrawer(Ogre::SceneManager* sceneManager)
+ {
+ this->drawer_ = new DebugDrawer(sceneManager, 0.5f);
+ this->bFill_ = true;
+
+ mContactPoints = &mContactPoints1;
+
+ mDebugMode = (DebugDrawModes) DBG_DrawWireframe;
+ Ogre::Root::getSingleton().addFrameListener(this);
+ }
+
+ BulletDebugDrawer::~BulletDebugDrawer()
+ {
+ Ogre::Root::getSingleton().removeFrameListener(this);
+ delete this->drawer_;
+ }
+
+ void BulletDebugDrawer::drawLine(const btVector3& from, const btVector3& to, const btVector3& color)
+ {
+ this->drawer_->drawLine(vector3(from), vector3(to), colour(color, 1.0f));
+ }
+
+// void BulletDebugDrawer::drawTriangle(const btVector3& v0, const btVector3& v1, const btVector3& v2, const btVector3& color, btScalar alpha)
+// {
+// // TODO
+// }
+
+ void BulletDebugDrawer::drawSphere(const btVector3& p, btScalar radius, const btVector3& color)
+ {
+ this->drawer_->drawSphere(vector3(p), Ogre::Quaternion::IDENTITY, radius, colour(color, 1.0f), this->bFill_);
+ }
+
+ void BulletDebugDrawer::drawSphere(btScalar radius, const btTransform& transform, const btVector3& color)
+ {
+ Ogre::Matrix4 matrix = matrix4(transform);
+ this->drawer_->drawSphere(matrix.getTrans(), matrix.extractQuaternion(), radius, colour(color, 1.0f), this->bFill_);
+ }
+
+ void BulletDebugDrawer::drawBox(const btVector3& bbMin, const btVector3& bbMax, const btVector3& color)
+ {
+ Ogre::Vector3* corners = new Ogre::Vector3[8];
+ corners[0] = Ogre::Vector3(bbMin[0], bbMin[1], bbMin[2]);
+ corners[1] = Ogre::Vector3(bbMin[0], bbMax[1], bbMin[2]);
+ corners[2] = Ogre::Vector3(bbMax[0], bbMax[1], bbMin[2]);
+ corners[3] = Ogre::Vector3(bbMax[0], bbMin[1], bbMin[2]);
+ corners[4] = Ogre::Vector3(bbMax[0], bbMax[1], bbMax[2]);
+ corners[5] = Ogre::Vector3(bbMin[0], bbMax[1], bbMax[2]);
+ corners[6] = Ogre::Vector3(bbMin[0], bbMin[1], bbMax[2]);
+ corners[7] = Ogre::Vector3(bbMax[0], bbMin[1], bbMax[2]);
+ this->drawer_->drawCuboid(corners, colour(color, 1.0f), this->bFill_);
+ }
+
+ void BulletDebugDrawer::drawBox(const btVector3& bbMin, const btVector3& bbMax, const btTransform& trans, const btVector3& color)
+ {
+ Ogre::Vector3* corners = new Ogre::Vector3[8];
+ corners[0] = Ogre::Vector3(trans * btVector3(bbMin[0], bbMin[1], bbMin[2]));
+ corners[1] = Ogre::Vector3(trans * btVector3(bbMin[0], bbMax[1], bbMin[2]));
+ corners[2] = Ogre::Vector3(trans * btVector3(bbMax[0], bbMax[1], bbMin[2]));
+ corners[3] = Ogre::Vector3(trans * btVector3(bbMax[0], bbMin[1], bbMin[2]));
+ corners[4] = Ogre::Vector3(trans * btVector3(bbMax[0], bbMax[1], bbMax[2]));
+ corners[5] = Ogre::Vector3(trans * btVector3(bbMin[0], bbMax[1], bbMax[2]));
+ corners[6] = Ogre::Vector3(trans * btVector3(bbMin[0], bbMin[1], bbMax[2]));
+ corners[7] = Ogre::Vector3(trans * btVector3(bbMax[0], bbMin[1], bbMax[2]));
+ this->drawer_->drawCuboid(corners, colour(color, 1.0f), this->bFill_);
+ }
+
+ void BulletDebugDrawer::drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color)
+ {
+ Ogre::Matrix4 matrix = matrix4(transform);
+ this->drawer_->drawCylinder(matrix.getTrans(), matrix.extractQuaternion(), radius, halfHeight * 2, colour(color, 1.0f), this->bFill_);
+ }
+
+ void BulletDebugDrawer::drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color)
+ {
+ Ogre::Matrix4 matrix = matrix4(transform);
+ this->drawer_->drawCone(matrix.getTrans(), matrix.extractQuaternion(), radius, height, colour(color, 1.0f), this->bFill_);
+ }
+
+ void BulletDebugDrawer::drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime, const btVector3& color)
+ {
+ mContactPoints->resize(mContactPoints->size() + 1);
+ ContactPoint p = mContactPoints->back();
+ p.from = vector3(PointOnB);
+ p.to = p.from + vector3(normalOnB) * distance;
+ p.dieTime = Ogre::Root::getSingleton().getTimer()->getMilliseconds() + lifeTime;
+ p.color.r = color.x();
+ p.color.g = color.y();
+ p.color.b = color.z();
+ }
+
+ bool BulletDebugDrawer::frameStarted(const Ogre::FrameEvent& evt)
+ {
+ size_t now = Ogre::Root::getSingleton().getTimer()->getMilliseconds();
+ std::vector<ContactPoint>* newCP = mContactPoints == &mContactPoints1 ? &mContactPoints2 : &mContactPoints1;
+ for (std::vector<ContactPoint>::iterator i = mContactPoints->begin(); i < mContactPoints->end(); i++ )
+ {
+ ContactPoint& cp = *i;
+ this->drawer_->drawLine(cp.from, cp.to, cp.color);
+ if (now <= cp.dieTime)
+ newCP->push_back(cp);
+ }
+ mContactPoints->clear();
+ mContactPoints = newCP;
+
+ // Right before the frame is rendered, call DebugDrawer::build().
+ this->drawer_->build();
+
+ return true;
+ }
+
+ bool BulletDebugDrawer::frameEnded(const Ogre::FrameEvent& evt)
+ {
+ // After the frame is rendered, call DebugDrawer::clear()
+ this->drawer_->clear();
+
+ return true;
+ }
+
+ void BulletDebugDrawer::reportErrorWarning(const char* warningString)
+ {
+ orxout(internal_error) << warningString << endl;
+ Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(warningString);
+ }
+
+ void BulletDebugDrawer::draw3dText(const btVector3& location, const char* textString)
+ {
+
+ }
+
+ void BulletDebugDrawer::setDebugMode(int debugMode)
+ {
+ mDebugMode = (DebugDrawModes) debugMode;
+ }
+
+ int BulletDebugDrawer::getDebugMode() const
+ {
+ return mDebugMode;
+ }
+
+ void BulletDebugDrawer::configure(bool bFill, float fillAlpha)
+ {
+ this->bFill_ = bFill;
+ this->drawer_->setFillAlpha(fillAlpha);
+ }
+}
Property changes on: code/trunk/src/libraries/tools/BulletDebugDrawer.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/libraries/tools/BulletDebugDrawer.h
===================================================================
--- code/trunk/src/libraries/tools/BulletDebugDrawer.h 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/src/libraries/tools/BulletDebugDrawer.h 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,65 +1,65 @@
-/**
- * Originally from http://www.ogre3d.org/tikiwiki/BulletDebugDrawer&structure=Cookbook
- * This source code is released into the Public Domain.
- *
- * Modified by Fabian 'x3n' Landau by using DebugDrawer and Orxonox specific utilities (e.g. output).
- */
-
-#ifndef _BulletDebugDrawer_H__
-#define _BulletDebugDrawer_H__
-
-#include "tools/ToolsPrereqs.h"
-
-#include <btBulletCollisionCommon.h>
-
-namespace orxonox
-{
- class _ToolsExport BulletDebugDrawer : public btIDebugDraw, public Ogre::FrameListener
- {
- public:
- BulletDebugDrawer(Ogre::SceneManager* sceneManager);
- ~BulletDebugDrawer();
- virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& color);
-// virtual void drawTriangle(const btVector3& v0, const btVector3& v1, const btVector3& v2, const btVector3& color, btScalar);
- virtual void drawSphere (const btVector3& p, btScalar radius, const btVector3& color);
- virtual void drawSphere(btScalar radius, const btTransform& transform, const btVector3& color);
- virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btVector3& color);
- virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btTransform& trans, const btVector3& color);
- virtual void drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color);
- virtual void drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color);
-// virtual void drawPlane(const btVector3& planeNormal, btScalar planeConst, const btTransform& transform, const btVector3& color);
-
- virtual void drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime, const btVector3& color);
-
- virtual void reportErrorWarning(const char* warningString);
- virtual void draw3dText(const btVector3& location, const char* textString);
-
- virtual void setDebugMode(int debugMode);
- virtual int getDebugMode() const;
-
- void configure(bool bFill, float fillAlpha);
-
- protected:
- bool frameStarted(const Ogre::FrameEvent& evt);
- bool frameEnded(const Ogre::FrameEvent& evt);
-
- private:
- struct ContactPoint
- {
- Ogre::Vector3 from;
- Ogre::Vector3 to;
- Ogre::ColourValue color;
- size_t dieTime;
- };
-
- bool bFill_;
- DebugDrawer* drawer_;
-
- DebugDrawModes mDebugMode;
- std::vector<ContactPoint>* mContactPoints;
- std::vector<ContactPoint> mContactPoints1;
- std::vector<ContactPoint> mContactPoints2;
- };
-}
-
-#endif /* _BulletDebugDrawer_H__ */
+/**
+ * Originally from http://www.ogre3d.org/tikiwiki/BulletDebugDrawer&structure=Cookbook
+ * This source code is released into the Public Domain.
+ *
+ * Modified by Fabian 'x3n' Landau by using DebugDrawer and Orxonox specific utilities (e.g. output).
+ */
+
+#ifndef _BulletDebugDrawer_H__
+#define _BulletDebugDrawer_H__
+
+#include "tools/ToolsPrereqs.h"
+
+#include <btBulletCollisionCommon.h>
+
+namespace orxonox
+{
+ class _ToolsExport BulletDebugDrawer : public btIDebugDraw, public Ogre::FrameListener
+ {
+ public:
+ BulletDebugDrawer(Ogre::SceneManager* sceneManager);
+ ~BulletDebugDrawer();
+ virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& color);
+// virtual void drawTriangle(const btVector3& v0, const btVector3& v1, const btVector3& v2, const btVector3& color, btScalar);
+ virtual void drawSphere (const btVector3& p, btScalar radius, const btVector3& color);
+ virtual void drawSphere(btScalar radius, const btTransform& transform, const btVector3& color);
+ virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btVector3& color);
+ virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btTransform& trans, const btVector3& color);
+ virtual void drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color);
+ virtual void drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color);
+// virtual void drawPlane(const btVector3& planeNormal, btScalar planeConst, const btTransform& transform, const btVector3& color);
+
+ virtual void drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime, const btVector3& color);
+
+ virtual void reportErrorWarning(const char* warningString);
+ virtual void draw3dText(const btVector3& location, const char* textString);
+
+ virtual void setDebugMode(int debugMode);
+ virtual int getDebugMode() const;
+
+ void configure(bool bFill, float fillAlpha);
+
+ protected:
+ bool frameStarted(const Ogre::FrameEvent& evt);
+ bool frameEnded(const Ogre::FrameEvent& evt);
+
+ private:
+ struct ContactPoint
+ {
+ Ogre::Vector3 from;
+ Ogre::Vector3 to;
+ Ogre::ColourValue color;
+ size_t dieTime;
+ };
+
+ bool bFill_;
+ DebugDrawer* drawer_;
+
+ DebugDrawModes mDebugMode;
+ std::vector<ContactPoint>* mContactPoints;
+ std::vector<ContactPoint> mContactPoints1;
+ std::vector<ContactPoint> mContactPoints2;
+ };
+}
+
+#endif /* _BulletDebugDrawer_H__ */
Property changes on: code/trunk/src/libraries/tools/BulletDebugDrawer.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/libraries/tools/DebugDrawer.cc
===================================================================
--- code/trunk/src/libraries/tools/DebugDrawer.cc 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/src/libraries/tools/DebugDrawer.cc 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,468 +1,468 @@
-/**
- * Copy-pasted from
- * - https://bitbucket.org/hasyimi/ogre-debug-drawing-utility/src
- * - http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Debug+Drawing+Utility+Class
- *
- * This source code is released into the Public Domain.
- *
- * Modified by Fabian 'x3n' Landau
- */
-
-#include "DebugDrawer.h"
-
-#include <OgreSceneManager.h>
-#include <OgreRenderQueue.h>
-#include <OgreManualObject.h>
-#include <OgreAxisAlignedBox.h>
-
-#define DEFAULT_ICOSPHERE_RECURSION_LEVEL 1
-
-namespace orxonox
-{
- DebugDrawer::DebugDrawer(Ogre::SceneManager *_sceneManager, float _fillAlpha) :
- sceneManager(_sceneManager), fillAlpha(_fillAlpha), manualObject(0), isEnabled(true), linesIndex(0), trianglesIndex(0)
- {
- initialise();
- }
-
- DebugDrawer::~DebugDrawer()
- {
- shutdown();
- }
-
- void DebugDrawer::initialise()
- {
- manualObject = sceneManager->createManualObject("debug_object");
- sceneManager->getRootSceneNode()->createChildSceneNode("debug_object")->attachObject(manualObject);
- manualObject->setDynamic(true);
-
- icoSphere0.create(0);
- icoSphere1.create(1);
- icoSphere2.create(2);
- icoSphere3.create(3);
- icoSphere4.create(4);
-
- manualObject->begin("debug_draw", Ogre::RenderOperation::OT_LINE_LIST);
- manualObject->position(Ogre::Vector3::ZERO);
- manualObject->colour(Ogre::ColourValue::ZERO);
- manualObject->index(0);
- manualObject->end();
- manualObject->begin("debug_draw", Ogre::RenderOperation::OT_TRIANGLE_LIST);
- manualObject->position(Ogre::Vector3::ZERO);
- manualObject->colour(Ogre::ColourValue::ZERO);
- manualObject->index(0);
- manualObject->end();
-
- linesIndex = trianglesIndex = 0;
- }
-
- void DebugDrawer::shutdown()
- {
- sceneManager->destroySceneNode("debug_object");
- sceneManager->destroyManualObject(manualObject);
- }
-
- void DebugDrawer::buildLine(const Ogre::Vector3& start, const Ogre::Vector3& end, const Ogre::ColourValue& colour, float alpha)
- {
- int i = addLineVertex(start, Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addLineVertex(end, Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
- addLineIndices(i, i + 1);
- }
-
- void DebugDrawer::buildQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha)
- {
- int index = addLineVertex(vertices[0], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addLineVertex(vertices[1], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addLineVertex(vertices[2], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addLineVertex(vertices[3], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
- for (int i = 0; i < 4; ++i)
- addLineIndices(index + i, index + ((i + 1) % 4));
- }
-
- void DebugDrawer::buildCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, float alpha)
- {
- int index = linesIndex;
- float increment = 2 * Ogre::Math::PI / segmentsCount;
- float angle = 0.0f;
-
- for (int i = 0; i < segmentsCount; i++)
- {
- addLineVertex(transform * Ogre::Vector3(radius * Ogre::Math::Cos(angle), 0, radius * Ogre::Math::Sin(angle)),
- Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- angle += increment;
- }
-
- for (int i = 0; i < segmentsCount; i++)
- addLineIndices(index + i, i + 1 < segmentsCount ? index + i + 1 : index);
- }
-
- void DebugDrawer::buildFilledCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, bool up, float alpha)
- {
- int index = trianglesIndex;
- float increment = 2 * Ogre::Math::PI / segmentsCount;
- float angle = 0.0f;
-
- for (int i = 0; i < segmentsCount; i++)
- {
- addTriangleVertex(transform * Ogre::Vector3(radius * Ogre::Math::Cos(angle), 0, radius * Ogre::Math::Sin(angle)),
- Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- angle += increment;
- }
-
- addTriangleVertex(transform.getTrans(), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
- for (int i = 0; i < segmentsCount; i++)
- {
- if (up)
- addTriangleIndices(i + 1 < segmentsCount ? index + i + 1 : index, index + i, index + segmentsCount);
- else
- addTriangleIndices(index + i, i + 1 < segmentsCount ? index + i + 1 : index, index + segmentsCount);
- }
- }
-
- void DebugDrawer::buildCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha)
- {
- int index = linesIndex;
-
- Ogre::Matrix4 transform(rotation);
- transform.setTrans(centre + rotation * Ogre::Vector3(0, height / 2, 0));
- this->buildCircle(transform, radius, segmentsCount, colour, alpha);
- transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
- this->buildCircle(transform, radius, segmentsCount, colour, alpha);
-
- for (int i = 0; i < segmentsCount; i++)
- addLineIndices(index + i, segmentsCount + index + i);
- }
-
- void DebugDrawer::buildFilledCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour,
- float alpha)
- {
- int index = trianglesIndex;
-
- Ogre::Matrix4 transform(rotation);
- transform.setTrans(centre + rotation * Ogre::Vector3(0, height / 2, 0));
- this->buildCircle(transform, radius, segmentsCount, colour);
- this->buildFilledCircle(transform, radius, segmentsCount, colour, true, alpha);
-
- transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
- this->buildCircle(transform, radius, segmentsCount, colour);
- this->buildFilledCircle(transform, radius, segmentsCount, colour, false, alpha);
-
- for (int i = 0; i < segmentsCount; i++)
- {
- addQuadIndices(index + i, i + 1 < segmentsCount ? index + i + 1 : index,
- i + 1 < segmentsCount ? (segmentsCount + 1) + index + i + 1 : (segmentsCount + 1) + index, (segmentsCount + 1) + index + i);
- }
- }
-
- void DebugDrawer::buildCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha)
- {
- int index = linesIndex;
-
- Ogre::Matrix4 transform(rotation);
- transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
- this->buildCircle(transform, radius, segmentsCount, colour, alpha);
-
- addLineVertex(centre + rotation * Ogre::Vector3(0, height / 2, 0), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
- for (int i = 0; i < segmentsCount; i++)
- addLineIndices(index + i, index + segmentsCount);
- }
-
- void DebugDrawer::buildFilledCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour,
- float alpha)
- {
- int index = trianglesIndex;
-
- Ogre::Matrix4 transform(rotation);
- transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
- this->buildCircle(transform, radius, segmentsCount, colour);
- this->buildFilledCircle(transform, radius, segmentsCount, colour, false, alpha);
-
- addTriangleVertex(centre + rotation * Ogre::Vector3(0, height / 2, 0), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
- for (int i = 0; i < segmentsCount; i++)
- addTriangleIndices(index + i, index + segmentsCount + 1, i + 1 < segmentsCount ? index + i + 1 : index);
- }
-
- void DebugDrawer::buildCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha)
- {
- int index = addLineVertex(vertices[0], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- for (int i = 1; i < 8; ++i)
- addLineVertex(vertices[i], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
- for (int i = 0; i < 4; ++i)
- addLineIndices(index + i, index + ((i + 1) % 4));
- for (int i = 4; i < 8; ++i)
- addLineIndices(index + i, i == 7 ? index + 4 : index + i + 1);
- addLineIndices(index + 1, index + 5);
- addLineIndices(index + 2, index + 4);
- addLineIndices(index, index + 6);
- addLineIndices(index + 3, index + 7);
- }
-
- void DebugDrawer::buildFilledCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha)
- {
- int index = addTriangleVertex(vertices[0], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- for (int i = 1; i < 8; ++i)
- addTriangleVertex(vertices[i], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
- addQuadIndices(index, index + 1, index + 2, index + 3);
- addQuadIndices(index + 4, index + 5, index + 6, index + 7);
-
- addQuadIndices(index + 1, index + 5, index + 4, index + 2);
- addQuadIndices(index, index + 3, index + 7, index + 6);
-
- addQuadIndices(index + 1, index, index + 6, index + 5);
- addQuadIndices(index + 4, index + 7, index + 3, index + 2);
- }
-
- void DebugDrawer::buildFilledQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha)
- {
- int index = addTriangleVertex(vertices[0], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addTriangleVertex(vertices[1], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addTriangleVertex(vertices[2], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addTriangleVertex(vertices[3], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
- addQuadIndices(index, index + 1, index + 2, index + 3);
- }
-
- void DebugDrawer::buildFilledTriangle(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha)
- {
- int index = addTriangleVertex(vertices[0], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addTriangleVertex(vertices[1], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addTriangleVertex(vertices[2], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
- addTriangleIndices(index, index + 1, index + 2);
- }
-
- void DebugDrawer::buildTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, float alpha)
- {
- int index = linesIndex;
-
- // Distance from the centre
- float bottomDistance = scale * 0.2f;
- float topDistance = scale * 0.62f;
- float frontDistance = scale * 0.289f;
- float backDistance = scale * 0.577f;
- float leftRightDistance = scale * 0.5f;
-
- addLineVertex(Ogre::Vector3(centre.x, centre.y + topDistance, centre.z), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addLineVertex(Ogre::Vector3(centre.x, centre.y - bottomDistance, centre.z + frontDistance), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addLineVertex(Ogre::Vector3(centre.x + leftRightDistance, centre.y - bottomDistance, centre.z - backDistance),
- Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addLineVertex(Ogre::Vector3(centre.x - leftRightDistance, centre.y - bottomDistance, centre.z - backDistance),
- Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
- addLineIndices(index, index + 1);
- addLineIndices(index, index + 2);
- addLineIndices(index, index + 3);
-
- addLineIndices(index + 1, index + 2);
- addLineIndices(index + 2, index + 3);
- addLineIndices(index + 3, index + 1);
- }
-
- void DebugDrawer::buildFilledTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, float alpha)
- {
- int index = trianglesIndex;
-
- // Distance from the centre
- float bottomDistance = scale * 0.2f;
- float topDistance = scale * 0.62f;
- float frontDistance = scale * 0.289f;
- float backDistance = scale * 0.577f;
- float leftRightDistance = scale * 0.5f;
-
- addTriangleVertex(Ogre::Vector3(centre.x, centre.y + topDistance, centre.z), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addTriangleVertex(Ogre::Vector3(centre.x, centre.y - bottomDistance, centre.z + frontDistance), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addTriangleVertex(Ogre::Vector3(centre.x + leftRightDistance, centre.y - bottomDistance, centre.z - backDistance),
- Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
- addTriangleVertex(Ogre::Vector3(centre.x - leftRightDistance, centre.y - bottomDistance, centre.z - backDistance),
- Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
- addTriangleIndices(index, index + 1, index + 2);
- addTriangleIndices(index, index + 2, index + 3);
- addTriangleIndices(index, index + 3, index + 1);
-
- addTriangleIndices(index + 1, index + 3, index + 2);
- }
-
- void DebugDrawer::drawLine(const Ogre::Vector3& start, const Ogre::Vector3& end, const Ogre::ColourValue& colour)
- {
- buildLine(start, end, colour);
- }
-
- void DebugDrawer::drawCircle(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled)
- {
- int segmentsCount = std::min<int>(100, (int) (radius / 2.5));
-
- Ogre::Matrix4 transform(rotation);
- transform.setTrans(centre);
-
- buildCircle(transform, radius, segmentsCount, colour);
- if (isFilled)
- buildFilledCircle(transform, radius, segmentsCount, colour, fillAlpha);
- }
-
- void DebugDrawer::drawCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled)
- {
- int segmentsCount = std::min<int>(100, (int) (radius / 2.5));
-
- if (isFilled)
- buildFilledCylinder(centre, rotation, radius, segmentsCount, height, colour, fillAlpha);
- else
- buildCylinder(centre, rotation, radius, segmentsCount, height, colour);
- }
-
- void DebugDrawer::drawCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled)
- {
- int segmentsCount = std::min<int>(100, (int) (radius / 2.5));
-
- if (isFilled)
- buildFilledCone(centre, rotation, radius, segmentsCount, height, colour, fillAlpha);
- else
- buildCone(centre, rotation, radius, segmentsCount, height, colour);
- }
-
- void DebugDrawer::drawQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, bool isFilled)
- {
- buildQuad(vertices, colour);
- if (isFilled)
- buildFilledQuad(vertices, colour, fillAlpha);
- }
-
- void DebugDrawer::drawCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, bool isFilled)
- {
- buildCuboid(vertices, colour);
- if (isFilled)
- buildFilledCuboid(vertices, colour, fillAlpha);
- }
-
- void DebugDrawer::drawSphere(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled)
- {
- const IcoSphere& sphere = this->getIcoSphere(radius);
-
- if (isFilled)
- {
- this->drawCircle(centre, rotation * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3(1, 0, 0)), radius, colour, false);
- this->drawCircle(centre, rotation * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3(0, 1, 0)), radius, colour, false);
- this->drawCircle(centre, rotation * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3(0, 0, 1)), radius, colour, false);
-
- int baseIndex = trianglesIndex;
- trianglesIndex += sphere.addToVertices(&triangleVertices, centre, Ogre::ColourValue(colour.r, colour.g, colour.b, fillAlpha), radius);
- sphere.addToTriangleIndices(baseIndex, &triangleIndices);
- }
- else
- {
- int baseIndex = linesIndex;
- linesIndex += sphere.addToVertices(&lineVertices, centre, colour, radius);
- sphere.addToLineIndices(baseIndex, &lineIndices);
- }
- }
-
- const IcoSphere& DebugDrawer::getIcoSphere(float radius) const
- {
- if (radius < 50)
- return this->icoSphere0;
- else if (radius < 500)
- return this->icoSphere1;
- else if (radius < 5000)
- return this->icoSphere2;
- else if (radius < 50000)
- return this->icoSphere3;
- else
- return this->icoSphere4;
- }
-
- void DebugDrawer::drawTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, bool isFilled)
- {
- buildTetrahedron(centre, scale, colour);
- if (isFilled)
- buildFilledTetrahedron(centre, scale, colour, fillAlpha);
- }
-
- void DebugDrawer::build()
- {
- manualObject->beginUpdate(0);
- if (lineVertices.size() > 0 && isEnabled)
- {
- manualObject->estimateVertexCount(lineVertices.size());
- manualObject->estimateIndexCount(lineIndices.size());
- for (std::list<VertexPair>::iterator i = lineVertices.begin(); i != lineVertices.end(); i++)
- {
- manualObject->position(i->first);
- manualObject->colour(i->second);
- }
- for (std::list<int>::iterator i = lineIndices.begin(); i != lineIndices.end(); i++)
- manualObject->index(*i);
- }
- else
- manualObject->index(0); // this is necessary to avoid crashes with ogre 1.7 if there's a light source in the level
- manualObject->end();
-
- manualObject->beginUpdate(1);
- if (triangleVertices.size() > 0 && isEnabled)
- {
- manualObject->estimateVertexCount(triangleVertices.size());
- manualObject->estimateIndexCount(triangleIndices.size());
- for (std::list<VertexPair>::iterator i = triangleVertices.begin(); i != triangleVertices.end(); i++)
- {
- manualObject->position(i->first);
- manualObject->colour(i->second.r, i->second.g, i->second.b, fillAlpha);
- }
- for (std::list<int>::iterator i = triangleIndices.begin(); i != triangleIndices.end(); i++)
- manualObject->index(*i);
- }
- else
- manualObject->index(0); // this is necessary to avoid crashes with ogre 1.7 if there's a light source in the level
- manualObject->end();
- }
-
- void DebugDrawer::clear()
- {
- lineVertices.clear();
- triangleVertices.clear();
- lineIndices.clear();
- triangleIndices.clear();
- linesIndex = trianglesIndex = 0;
- }
-
- int DebugDrawer::addLineVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour)
- {
- lineVertices.push_back(VertexPair(vertex, colour));
- return linesIndex++;
- }
-
- void DebugDrawer::addLineIndices(int index1, int index2)
- {
- lineIndices.push_back(index1);
- lineIndices.push_back(index2);
- }
-
- int DebugDrawer::addTriangleVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour)
- {
- triangleVertices.push_back(VertexPair(vertex, colour));
- return trianglesIndex++;
- }
-
- void DebugDrawer::addTriangleIndices(int index1, int index2, int index3)
- {
- triangleIndices.push_back(index1);
- triangleIndices.push_back(index2);
- triangleIndices.push_back(index3);
- }
-
- void DebugDrawer::addQuadIndices(int index1, int index2, int index3, int index4)
- {
- triangleIndices.push_back(index1);
- triangleIndices.push_back(index2);
- triangleIndices.push_back(index3);
-
- triangleIndices.push_back(index1);
- triangleIndices.push_back(index3);
- triangleIndices.push_back(index4);
- }
-}
+/**
+ * Copy-pasted from
+ * - https://bitbucket.org/hasyimi/ogre-debug-drawing-utility/src
+ * - http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Debug+Drawing+Utility+Class
+ *
+ * This source code is released into the Public Domain.
+ *
+ * Modified by Fabian 'x3n' Landau
+ */
+
+#include "DebugDrawer.h"
+
+#include <OgreSceneManager.h>
+#include <OgreRenderQueue.h>
+#include <OgreManualObject.h>
+#include <OgreAxisAlignedBox.h>
+
+#define DEFAULT_ICOSPHERE_RECURSION_LEVEL 1
+
+namespace orxonox
+{
+ DebugDrawer::DebugDrawer(Ogre::SceneManager *_sceneManager, float _fillAlpha) :
+ sceneManager(_sceneManager), fillAlpha(_fillAlpha), manualObject(0), isEnabled(true), linesIndex(0), trianglesIndex(0)
+ {
+ initialise();
+ }
+
+ DebugDrawer::~DebugDrawer()
+ {
+ shutdown();
+ }
+
+ void DebugDrawer::initialise()
+ {
+ manualObject = sceneManager->createManualObject("debug_object");
+ sceneManager->getRootSceneNode()->createChildSceneNode("debug_object")->attachObject(manualObject);
+ manualObject->setDynamic(true);
+
+ icoSphere0.create(0);
+ icoSphere1.create(1);
+ icoSphere2.create(2);
+ icoSphere3.create(3);
+ icoSphere4.create(4);
+
+ manualObject->begin("debug_draw", Ogre::RenderOperation::OT_LINE_LIST);
+ manualObject->position(Ogre::Vector3::ZERO);
+ manualObject->colour(Ogre::ColourValue::ZERO);
+ manualObject->index(0);
+ manualObject->end();
+ manualObject->begin("debug_draw", Ogre::RenderOperation::OT_TRIANGLE_LIST);
+ manualObject->position(Ogre::Vector3::ZERO);
+ manualObject->colour(Ogre::ColourValue::ZERO);
+ manualObject->index(0);
+ manualObject->end();
+
+ linesIndex = trianglesIndex = 0;
+ }
+
+ void DebugDrawer::shutdown()
+ {
+ sceneManager->destroySceneNode("debug_object");
+ sceneManager->destroyManualObject(manualObject);
+ }
+
+ void DebugDrawer::buildLine(const Ogre::Vector3& start, const Ogre::Vector3& end, const Ogre::ColourValue& colour, float alpha)
+ {
+ int i = addLineVertex(start, Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addLineVertex(end, Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+ addLineIndices(i, i + 1);
+ }
+
+ void DebugDrawer::buildQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha)
+ {
+ int index = addLineVertex(vertices[0], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addLineVertex(vertices[1], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addLineVertex(vertices[2], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addLineVertex(vertices[3], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+ for (int i = 0; i < 4; ++i)
+ addLineIndices(index + i, index + ((i + 1) % 4));
+ }
+
+ void DebugDrawer::buildCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, float alpha)
+ {
+ int index = linesIndex;
+ float increment = 2 * Ogre::Math::PI / segmentsCount;
+ float angle = 0.0f;
+
+ for (int i = 0; i < segmentsCount; i++)
+ {
+ addLineVertex(transform * Ogre::Vector3(radius * Ogre::Math::Cos(angle), 0, radius * Ogre::Math::Sin(angle)),
+ Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ angle += increment;
+ }
+
+ for (int i = 0; i < segmentsCount; i++)
+ addLineIndices(index + i, i + 1 < segmentsCount ? index + i + 1 : index);
+ }
+
+ void DebugDrawer::buildFilledCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, bool up, float alpha)
+ {
+ int index = trianglesIndex;
+ float increment = 2 * Ogre::Math::PI / segmentsCount;
+ float angle = 0.0f;
+
+ for (int i = 0; i < segmentsCount; i++)
+ {
+ addTriangleVertex(transform * Ogre::Vector3(radius * Ogre::Math::Cos(angle), 0, radius * Ogre::Math::Sin(angle)),
+ Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ angle += increment;
+ }
+
+ addTriangleVertex(transform.getTrans(), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+ for (int i = 0; i < segmentsCount; i++)
+ {
+ if (up)
+ addTriangleIndices(i + 1 < segmentsCount ? index + i + 1 : index, index + i, index + segmentsCount);
+ else
+ addTriangleIndices(index + i, i + 1 < segmentsCount ? index + i + 1 : index, index + segmentsCount);
+ }
+ }
+
+ void DebugDrawer::buildCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha)
+ {
+ int index = linesIndex;
+
+ Ogre::Matrix4 transform(rotation);
+ transform.setTrans(centre + rotation * Ogre::Vector3(0, height / 2, 0));
+ this->buildCircle(transform, radius, segmentsCount, colour, alpha);
+ transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
+ this->buildCircle(transform, radius, segmentsCount, colour, alpha);
+
+ for (int i = 0; i < segmentsCount; i++)
+ addLineIndices(index + i, segmentsCount + index + i);
+ }
+
+ void DebugDrawer::buildFilledCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour,
+ float alpha)
+ {
+ int index = trianglesIndex;
+
+ Ogre::Matrix4 transform(rotation);
+ transform.setTrans(centre + rotation * Ogre::Vector3(0, height / 2, 0));
+ this->buildCircle(transform, radius, segmentsCount, colour);
+ this->buildFilledCircle(transform, radius, segmentsCount, colour, true, alpha);
+
+ transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
+ this->buildCircle(transform, radius, segmentsCount, colour);
+ this->buildFilledCircle(transform, radius, segmentsCount, colour, false, alpha);
+
+ for (int i = 0; i < segmentsCount; i++)
+ {
+ addQuadIndices(index + i, i + 1 < segmentsCount ? index + i + 1 : index,
+ i + 1 < segmentsCount ? (segmentsCount + 1) + index + i + 1 : (segmentsCount + 1) + index, (segmentsCount + 1) + index + i);
+ }
+ }
+
+ void DebugDrawer::buildCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha)
+ {
+ int index = linesIndex;
+
+ Ogre::Matrix4 transform(rotation);
+ transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
+ this->buildCircle(transform, radius, segmentsCount, colour, alpha);
+
+ addLineVertex(centre + rotation * Ogre::Vector3(0, height / 2, 0), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+ for (int i = 0; i < segmentsCount; i++)
+ addLineIndices(index + i, index + segmentsCount);
+ }
+
+ void DebugDrawer::buildFilledCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour,
+ float alpha)
+ {
+ int index = trianglesIndex;
+
+ Ogre::Matrix4 transform(rotation);
+ transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
+ this->buildCircle(transform, radius, segmentsCount, colour);
+ this->buildFilledCircle(transform, radius, segmentsCount, colour, false, alpha);
+
+ addTriangleVertex(centre + rotation * Ogre::Vector3(0, height / 2, 0), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+ for (int i = 0; i < segmentsCount; i++)
+ addTriangleIndices(index + i, index + segmentsCount + 1, i + 1 < segmentsCount ? index + i + 1 : index);
+ }
+
+ void DebugDrawer::buildCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha)
+ {
+ int index = addLineVertex(vertices[0], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ for (int i = 1; i < 8; ++i)
+ addLineVertex(vertices[i], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+ for (int i = 0; i < 4; ++i)
+ addLineIndices(index + i, index + ((i + 1) % 4));
+ for (int i = 4; i < 8; ++i)
+ addLineIndices(index + i, i == 7 ? index + 4 : index + i + 1);
+ addLineIndices(index + 1, index + 5);
+ addLineIndices(index + 2, index + 4);
+ addLineIndices(index, index + 6);
+ addLineIndices(index + 3, index + 7);
+ }
+
+ void DebugDrawer::buildFilledCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha)
+ {
+ int index = addTriangleVertex(vertices[0], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ for (int i = 1; i < 8; ++i)
+ addTriangleVertex(vertices[i], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+ addQuadIndices(index, index + 1, index + 2, index + 3);
+ addQuadIndices(index + 4, index + 5, index + 6, index + 7);
+
+ addQuadIndices(index + 1, index + 5, index + 4, index + 2);
+ addQuadIndices(index, index + 3, index + 7, index + 6);
+
+ addQuadIndices(index + 1, index, index + 6, index + 5);
+ addQuadIndices(index + 4, index + 7, index + 3, index + 2);
+ }
+
+ void DebugDrawer::buildFilledQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha)
+ {
+ int index = addTriangleVertex(vertices[0], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addTriangleVertex(vertices[1], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addTriangleVertex(vertices[2], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addTriangleVertex(vertices[3], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+ addQuadIndices(index, index + 1, index + 2, index + 3);
+ }
+
+ void DebugDrawer::buildFilledTriangle(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha)
+ {
+ int index = addTriangleVertex(vertices[0], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addTriangleVertex(vertices[1], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addTriangleVertex(vertices[2], Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+ addTriangleIndices(index, index + 1, index + 2);
+ }
+
+ void DebugDrawer::buildTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, float alpha)
+ {
+ int index = linesIndex;
+
+ // Distance from the centre
+ float bottomDistance = scale * 0.2f;
+ float topDistance = scale * 0.62f;
+ float frontDistance = scale * 0.289f;
+ float backDistance = scale * 0.577f;
+ float leftRightDistance = scale * 0.5f;
+
+ addLineVertex(Ogre::Vector3(centre.x, centre.y + topDistance, centre.z), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addLineVertex(Ogre::Vector3(centre.x, centre.y - bottomDistance, centre.z + frontDistance), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addLineVertex(Ogre::Vector3(centre.x + leftRightDistance, centre.y - bottomDistance, centre.z - backDistance),
+ Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addLineVertex(Ogre::Vector3(centre.x - leftRightDistance, centre.y - bottomDistance, centre.z - backDistance),
+ Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+ addLineIndices(index, index + 1);
+ addLineIndices(index, index + 2);
+ addLineIndices(index, index + 3);
+
+ addLineIndices(index + 1, index + 2);
+ addLineIndices(index + 2, index + 3);
+ addLineIndices(index + 3, index + 1);
+ }
+
+ void DebugDrawer::buildFilledTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, float alpha)
+ {
+ int index = trianglesIndex;
+
+ // Distance from the centre
+ float bottomDistance = scale * 0.2f;
+ float topDistance = scale * 0.62f;
+ float frontDistance = scale * 0.289f;
+ float backDistance = scale * 0.577f;
+ float leftRightDistance = scale * 0.5f;
+
+ addTriangleVertex(Ogre::Vector3(centre.x, centre.y + topDistance, centre.z), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addTriangleVertex(Ogre::Vector3(centre.x, centre.y - bottomDistance, centre.z + frontDistance), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addTriangleVertex(Ogre::Vector3(centre.x + leftRightDistance, centre.y - bottomDistance, centre.z - backDistance),
+ Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+ addTriangleVertex(Ogre::Vector3(centre.x - leftRightDistance, centre.y - bottomDistance, centre.z - backDistance),
+ Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+ addTriangleIndices(index, index + 1, index + 2);
+ addTriangleIndices(index, index + 2, index + 3);
+ addTriangleIndices(index, index + 3, index + 1);
+
+ addTriangleIndices(index + 1, index + 3, index + 2);
+ }
+
+ void DebugDrawer::drawLine(const Ogre::Vector3& start, const Ogre::Vector3& end, const Ogre::ColourValue& colour)
+ {
+ buildLine(start, end, colour);
+ }
+
+ void DebugDrawer::drawCircle(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled)
+ {
+ int segmentsCount = std::min<int>(100, (int) (radius / 2.5));
+
+ Ogre::Matrix4 transform(rotation);
+ transform.setTrans(centre);
+
+ buildCircle(transform, radius, segmentsCount, colour);
+ if (isFilled)
+ buildFilledCircle(transform, radius, segmentsCount, colour, fillAlpha);
+ }
+
+ void DebugDrawer::drawCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled)
+ {
+ int segmentsCount = std::min<int>(100, (int) (radius / 2.5));
+
+ if (isFilled)
+ buildFilledCylinder(centre, rotation, radius, segmentsCount, height, colour, fillAlpha);
+ else
+ buildCylinder(centre, rotation, radius, segmentsCount, height, colour);
+ }
+
+ void DebugDrawer::drawCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled)
+ {
+ int segmentsCount = std::min<int>(100, (int) (radius / 2.5));
+
+ if (isFilled)
+ buildFilledCone(centre, rotation, radius, segmentsCount, height, colour, fillAlpha);
+ else
+ buildCone(centre, rotation, radius, segmentsCount, height, colour);
+ }
+
+ void DebugDrawer::drawQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, bool isFilled)
+ {
+ buildQuad(vertices, colour);
+ if (isFilled)
+ buildFilledQuad(vertices, colour, fillAlpha);
+ }
+
+ void DebugDrawer::drawCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, bool isFilled)
+ {
+ buildCuboid(vertices, colour);
+ if (isFilled)
+ buildFilledCuboid(vertices, colour, fillAlpha);
+ }
+
+ void DebugDrawer::drawSphere(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled)
+ {
+ const IcoSphere& sphere = this->getIcoSphere(radius);
+
+ if (isFilled)
+ {
+ this->drawCircle(centre, rotation * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3(1, 0, 0)), radius, colour, false);
+ this->drawCircle(centre, rotation * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3(0, 1, 0)), radius, colour, false);
+ this->drawCircle(centre, rotation * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3(0, 0, 1)), radius, colour, false);
+
+ int baseIndex = trianglesIndex;
+ trianglesIndex += sphere.addToVertices(&triangleVertices, centre, Ogre::ColourValue(colour.r, colour.g, colour.b, fillAlpha), radius);
+ sphere.addToTriangleIndices(baseIndex, &triangleIndices);
+ }
+ else
+ {
+ int baseIndex = linesIndex;
+ linesIndex += sphere.addToVertices(&lineVertices, centre, colour, radius);
+ sphere.addToLineIndices(baseIndex, &lineIndices);
+ }
+ }
+
+ const IcoSphere& DebugDrawer::getIcoSphere(float radius) const
+ {
+ if (radius < 50)
+ return this->icoSphere0;
+ else if (radius < 500)
+ return this->icoSphere1;
+ else if (radius < 5000)
+ return this->icoSphere2;
+ else if (radius < 50000)
+ return this->icoSphere3;
+ else
+ return this->icoSphere4;
+ }
+
+ void DebugDrawer::drawTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, bool isFilled)
+ {
+ buildTetrahedron(centre, scale, colour);
+ if (isFilled)
+ buildFilledTetrahedron(centre, scale, colour, fillAlpha);
+ }
+
+ void DebugDrawer::build()
+ {
+ manualObject->beginUpdate(0);
+ if (lineVertices.size() > 0 && isEnabled)
+ {
+ manualObject->estimateVertexCount(lineVertices.size());
+ manualObject->estimateIndexCount(lineIndices.size());
+ for (std::list<VertexPair>::iterator i = lineVertices.begin(); i != lineVertices.end(); i++)
+ {
+ manualObject->position(i->first);
+ manualObject->colour(i->second);
+ }
+ for (std::list<int>::iterator i = lineIndices.begin(); i != lineIndices.end(); i++)
+ manualObject->index(*i);
+ }
+ else
+ manualObject->index(0); // this is necessary to avoid crashes with ogre 1.7 if there's a light source in the level
+ manualObject->end();
+
+ manualObject->beginUpdate(1);
+ if (triangleVertices.size() > 0 && isEnabled)
+ {
+ manualObject->estimateVertexCount(triangleVertices.size());
+ manualObject->estimateIndexCount(triangleIndices.size());
+ for (std::list<VertexPair>::iterator i = triangleVertices.begin(); i != triangleVertices.end(); i++)
+ {
+ manualObject->position(i->first);
+ manualObject->colour(i->second.r, i->second.g, i->second.b, fillAlpha);
+ }
+ for (std::list<int>::iterator i = triangleIndices.begin(); i != triangleIndices.end(); i++)
+ manualObject->index(*i);
+ }
+ else
+ manualObject->index(0); // this is necessary to avoid crashes with ogre 1.7 if there's a light source in the level
+ manualObject->end();
+ }
+
+ void DebugDrawer::clear()
+ {
+ lineVertices.clear();
+ triangleVertices.clear();
+ lineIndices.clear();
+ triangleIndices.clear();
+ linesIndex = trianglesIndex = 0;
+ }
+
+ int DebugDrawer::addLineVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour)
+ {
+ lineVertices.push_back(VertexPair(vertex, colour));
+ return linesIndex++;
+ }
+
+ void DebugDrawer::addLineIndices(int index1, int index2)
+ {
+ lineIndices.push_back(index1);
+ lineIndices.push_back(index2);
+ }
+
+ int DebugDrawer::addTriangleVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour)
+ {
+ triangleVertices.push_back(VertexPair(vertex, colour));
+ return trianglesIndex++;
+ }
+
+ void DebugDrawer::addTriangleIndices(int index1, int index2, int index3)
+ {
+ triangleIndices.push_back(index1);
+ triangleIndices.push_back(index2);
+ triangleIndices.push_back(index3);
+ }
+
+ void DebugDrawer::addQuadIndices(int index1, int index2, int index3, int index4)
+ {
+ triangleIndices.push_back(index1);
+ triangleIndices.push_back(index2);
+ triangleIndices.push_back(index3);
+
+ triangleIndices.push_back(index1);
+ triangleIndices.push_back(index3);
+ triangleIndices.push_back(index4);
+ }
+}
Property changes on: code/trunk/src/libraries/tools/DebugDrawer.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/libraries/tools/DebugDrawer.h
===================================================================
--- code/trunk/src/libraries/tools/DebugDrawer.h 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/src/libraries/tools/DebugDrawer.h 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,117 +1,117 @@
-/**
- * Copy-pasted from
- * - https://bitbucket.org/hasyimi/ogre-debug-drawing-utility/src
- * - http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Debug+Drawing+Utility+Class
- *
- * This source code is released into the Public Domain.
- *
- * Modified by Fabian 'x3n' Landau
- */
-
-/**
- * @file
- * @brief DebugDrawer is a utility to draw debug shapes (lines, triangles, spheres) with Ogre.
- * This utility is e.g. used by @ref BulletDebugDrawer to visualize collision shapes and other physical entities.
- */
-
-#ifndef _DebugDrawer_H__
-#define _DebugDrawer_H__
-
-#include "tools/ToolsPrereqs.h"
-
-#include <map>
-
-#include "IcoSphere.h"
-
-namespace orxonox
-{
- class _ToolsExport DebugDrawer
- {
- public:
- DebugDrawer(Ogre::SceneManager *_sceneManager, float _fillAlpha);
- ~DebugDrawer();
-
- void build();
-
- void drawLine(const Ogre::Vector3& start, const Ogre::Vector3& end, const Ogre::ColourValue& colour);
- void drawCircle(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled = false);
- void drawCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled = false);
- void drawCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled = false);
-
- void drawQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, bool isFilled = false);
- void drawCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, bool isFilled = false);
- void drawSphere(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled = false);
- void drawTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, bool isFilled = false);
-
- void setFillAlpha(float alpha)
- {
- fillAlpha = alpha;
- }
-
- bool getEnabled()
- {
- return isEnabled;
- }
- void setEnabled(bool _isEnabled)
- {
- isEnabled = _isEnabled;
- }
- void switchEnabled()
- {
- isEnabled = !isEnabled;
- }
-
- void clear();
-
- private:
- const IcoSphere& getIcoSphere(float radius) const;
-
- Ogre::SceneManager* sceneManager;
- float fillAlpha;
- Ogre::ManualObject* manualObject;
- IcoSphere icoSphere0;
- IcoSphere icoSphere1;
- IcoSphere icoSphere2;
- IcoSphere icoSphere3;
- IcoSphere icoSphere4;
-
- bool isEnabled;
-
- std::list<VertexPair> lineVertices, triangleVertices;
- std::list<int> lineIndices, triangleIndices;
-
- int linesIndex, trianglesIndex;
-
- void initialise();
- void shutdown();
-
- void buildLine(const Ogre::Vector3& start, const Ogre::Vector3& end, const Ogre::ColourValue& colour, float alpha = 1.0f);
- void buildQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha = 1.0f);
- void buildFilledQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha = 1.0f);
- void buildFilledTriangle(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha = 1.0f);
- void buildCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha = 1.0f);
- void buildFilledCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha = 1.0f);
-
- void buildCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, float alpha = 1.0f);
- void buildFilledCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, bool up, float alpha = 1.0f);
-
- void buildCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
- void buildFilledCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
-
- void buildCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
- void buildFilledCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
-
- void buildTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, float alpha = 1.0f);
- void buildFilledTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, float alpha = 1.0f);
-
- int addLineVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour);
- void addLineIndices(int index1, int index2);
-
- int addTriangleVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour);
- void addTriangleIndices(int index1, int index2, int index3);
-
- void addQuadIndices(int index1, int index2, int index3, int index4);
- };
-}
-
-#endif /* _DebugDrawer_H__ */
+/**
+ * Copy-pasted from
+ * - https://bitbucket.org/hasyimi/ogre-debug-drawing-utility/src
+ * - http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Debug+Drawing+Utility+Class
+ *
+ * This source code is released into the Public Domain.
+ *
+ * Modified by Fabian 'x3n' Landau
+ */
+
+/**
+ * @file
+ * @brief DebugDrawer is a utility to draw debug shapes (lines, triangles, spheres) with Ogre.
+ * This utility is e.g. used by @ref BulletDebugDrawer to visualize collision shapes and other physical entities.
+ */
+
+#ifndef _DebugDrawer_H__
+#define _DebugDrawer_H__
+
+#include "tools/ToolsPrereqs.h"
+
+#include <map>
+
+#include "IcoSphere.h"
+
+namespace orxonox
+{
+ class _ToolsExport DebugDrawer
+ {
+ public:
+ DebugDrawer(Ogre::SceneManager *_sceneManager, float _fillAlpha);
+ ~DebugDrawer();
+
+ void build();
+
+ void drawLine(const Ogre::Vector3& start, const Ogre::Vector3& end, const Ogre::ColourValue& colour);
+ void drawCircle(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled = false);
+ void drawCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled = false);
+ void drawCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled = false);
+
+ void drawQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, bool isFilled = false);
+ void drawCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, bool isFilled = false);
+ void drawSphere(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled = false);
+ void drawTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, bool isFilled = false);
+
+ void setFillAlpha(float alpha)
+ {
+ fillAlpha = alpha;
+ }
+
+ bool getEnabled()
+ {
+ return isEnabled;
+ }
+ void setEnabled(bool _isEnabled)
+ {
+ isEnabled = _isEnabled;
+ }
+ void switchEnabled()
+ {
+ isEnabled = !isEnabled;
+ }
+
+ void clear();
+
+ private:
+ const IcoSphere& getIcoSphere(float radius) const;
+
+ Ogre::SceneManager* sceneManager;
+ float fillAlpha;
+ Ogre::ManualObject* manualObject;
+ IcoSphere icoSphere0;
+ IcoSphere icoSphere1;
+ IcoSphere icoSphere2;
+ IcoSphere icoSphere3;
+ IcoSphere icoSphere4;
+
+ bool isEnabled;
+
+ std::list<VertexPair> lineVertices, triangleVertices;
+ std::list<int> lineIndices, triangleIndices;
+
+ int linesIndex, trianglesIndex;
+
+ void initialise();
+ void shutdown();
+
+ void buildLine(const Ogre::Vector3& start, const Ogre::Vector3& end, const Ogre::ColourValue& colour, float alpha = 1.0f);
+ void buildQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha = 1.0f);
+ void buildFilledQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha = 1.0f);
+ void buildFilledTriangle(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha = 1.0f);
+ void buildCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha = 1.0f);
+ void buildFilledCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha = 1.0f);
+
+ void buildCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, float alpha = 1.0f);
+ void buildFilledCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, bool up, float alpha = 1.0f);
+
+ void buildCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
+ void buildFilledCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
+
+ void buildCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
+ void buildFilledCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
+
+ void buildTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, float alpha = 1.0f);
+ void buildFilledTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, float alpha = 1.0f);
+
+ int addLineVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour);
+ void addLineIndices(int index1, int index2);
+
+ int addTriangleVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour);
+ void addTriangleIndices(int index1, int index2, int index3);
+
+ void addQuadIndices(int index1, int index2, int index3, int index4);
+ };
+}
+
+#endif /* _DebugDrawer_H__ */
Property changes on: code/trunk/src/libraries/tools/DebugDrawer.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/libraries/tools/IcoSphere.cc
===================================================================
--- code/trunk/src/libraries/tools/IcoSphere.cc 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/src/libraries/tools/IcoSphere.cc 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,224 +1,224 @@
-/**
- * Copy-pasted from
- * - https://bitbucket.org/hasyimi/ogre-debug-drawing-utility/src
- * - http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Debug+Drawing+Utility+Class
- *
- * This source code is released into the Public Domain.
- *
- * Modified by Fabian 'x3n' Landau
- */
-
-#include "IcoSphere.h"
-
-#include <OgreSceneManager.h>
-#include <OgreRenderQueue.h>
-#include <OgreManualObject.h>
-#include <OgreAxisAlignedBox.h>
-
-namespace orxonox
-{
- IcoSphere::IcoSphere() :
- index(0)
- {
- }
-
- IcoSphere::~IcoSphere()
- {
- }
-
- void IcoSphere::create(int recursionLevel)
- {
- vertices.clear();
- lineIndices.clear();
- triangleIndices.clear();
- faces.clear();
- middlePointIndexCache.clear();
- index = 0;
-
- float t = (1.0f + Ogre::Math::Sqrt(5.0f)) / 2.0f;
-
- addVertex(Ogre::Vector3(-1.0f, t, 0.0f));
- addVertex(Ogre::Vector3(1.0f, t, 0.0f));
- addVertex(Ogre::Vector3(-1.0f, -t, 0.0f));
- addVertex(Ogre::Vector3(1.0f, -t, 0.0f));
-
- addVertex(Ogre::Vector3(0.0f, -1.0f, t));
- addVertex(Ogre::Vector3(0.0f, 1.0f, t));
- addVertex(Ogre::Vector3(0.0f, -1.0f, -t));
- addVertex(Ogre::Vector3(0.0f, 1.0f, -t));
-
- addVertex(Ogre::Vector3(t, 0.0f, -1.0f));
- addVertex(Ogre::Vector3(t, 0.0f, 1.0f));
- addVertex(Ogre::Vector3(-t, 0.0f, -1.0f));
- addVertex(Ogre::Vector3(-t, 0.0f, 1.0f));
-
- addFace(0, 11, 5);
- addFace(0, 5, 1);
- addFace(0, 1, 7);
- addFace(0, 7, 10);
- addFace(0, 10, 11);
-
- addFace(1, 5, 9);
- addFace(5, 11, 4);
- addFace(11, 10, 2);
- addFace(10, 7, 6);
- addFace(7, 1, 8);
-
- addFace(3, 9, 4);
- addFace(3, 4, 2);
- addFace(3, 2, 6);
- addFace(3, 6, 8);
- addFace(3, 8, 9);
-
- addFace(4, 9, 5);
- addFace(2, 4, 11);
- addFace(6, 2, 10);
- addFace(8, 6, 7);
- addFace(9, 8, 1);
-
- addLineIndices(1, 0);
- addLineIndices(1, 5);
- addLineIndices(1, 7);
- addLineIndices(1, 8);
- addLineIndices(1, 9);
-
- addLineIndices(2, 3);
- addLineIndices(2, 4);
- addLineIndices(2, 6);
- addLineIndices(2, 10);
- addLineIndices(2, 11);
-
- addLineIndices(0, 5);
- addLineIndices(5, 9);
- addLineIndices(9, 8);
- addLineIndices(8, 7);
- addLineIndices(7, 0);
-
- addLineIndices(10, 11);
- addLineIndices(11, 4);
- addLineIndices(4, 3);
- addLineIndices(3, 6);
- addLineIndices(6, 10);
-
- addLineIndices(0, 11);
- addLineIndices(11, 5);
- addLineIndices(5, 4);
- addLineIndices(4, 9);
- addLineIndices(9, 3);
- addLineIndices(3, 8);
- addLineIndices(8, 6);
- addLineIndices(6, 7);
- addLineIndices(7, 10);
- addLineIndices(10, 0);
-
- for (int i = 0; i < recursionLevel; i++)
- {
- std::list<TriangleIndices> faces2;
-
- for (std::list<TriangleIndices>::iterator j = faces.begin(); j != faces.end(); j++)
- {
- TriangleIndices f = *j;
- int a = getMiddlePoint(f.v1, f.v2);
- int b = getMiddlePoint(f.v2, f.v3);
- int c = getMiddlePoint(f.v3, f.v1);
-
- removeLineIndices(f.v1, f.v2);
- removeLineIndices(f.v2, f.v3);
- removeLineIndices(f.v3, f.v1);
-
- faces2.push_back(TriangleIndices(f.v1, a, c));
- faces2.push_back(TriangleIndices(f.v2, b, a));
- faces2.push_back(TriangleIndices(f.v3, c, b));
- faces2.push_back(TriangleIndices(a, b, c));
-
- addTriangleLines(f.v1, a, c);
- addTriangleLines(f.v2, b, a);
- addTriangleLines(f.v3, c, b);
- }
-
- faces = faces2;
- }
- }
-
- void IcoSphere::addLineIndices(int index0, int index1)
- {
- lineIndices.push_back(LineIndices(index0, index1));
- }
-
- void IcoSphere::removeLineIndices(int index0, int index1)
- {
- std::list<LineIndices>::iterator result = std::find(lineIndices.begin(), lineIndices.end(), LineIndices(index0, index1));
-
- if (result != lineIndices.end())
- lineIndices.erase(result);
- }
-
- void IcoSphere::addTriangleLines(int index0, int index1, int index2)
- {
- addLineIndices(index0, index1);
- addLineIndices(index1, index2);
- addLineIndices(index2, index0);
- }
-
- int IcoSphere::addVertex(const Ogre::Vector3& vertex)
- {
- Ogre::Real length = vertex.length();
- vertices.push_back(Ogre::Vector3(vertex.x / length, vertex.y / length, vertex.z / length));
- return index++;
- }
-
- int IcoSphere::getMiddlePoint(int index0, int index1)
- {
- bool isFirstSmaller = index0 < index1;
- int64_t smallerIndex = isFirstSmaller ? index0 : index1;
- int64_t largerIndex = isFirstSmaller ? index1 : index0;
- int64_t key = (smallerIndex << 32) | largerIndex;
-
- if (middlePointIndexCache.find(key) != middlePointIndexCache.end())
- return middlePointIndexCache[key];
-
- Ogre::Vector3 point1 = vertices[index0];
- Ogre::Vector3 point2 = vertices[index1];
- Ogre::Vector3 middle = point1.midPoint(point2);
-
- int index = addVertex(middle);
- middlePointIndexCache[key] = index;
- return index;
- }
-
- void IcoSphere::addFace(int index0, int index1, int index2)
- {
- faces.push_back(TriangleIndices(index0, index1, index2));
- }
-
- void IcoSphere::addToLineIndices(int baseIndex, std::list<int>* target) const
- {
- for (std::list<LineIndices>::const_iterator i = lineIndices.begin(); i != lineIndices.end(); i++)
- {
- target->push_back(baseIndex + (*i).v1);
- target->push_back(baseIndex + (*i).v2);
- }
- }
-
- void IcoSphere::addToTriangleIndices(int baseIndex, std::list<int>* target) const
- {
- for (std::list<TriangleIndices>::const_iterator i = faces.begin(); i != faces.end(); i++)
- {
- target->push_back(baseIndex + (*i).v1);
- target->push_back(baseIndex + (*i).v2);
- target->push_back(baseIndex + (*i).v3);
- }
- }
-
- int IcoSphere::addToVertices(std::list<VertexPair>* target, const Ogre::Vector3& position, const Ogre::ColourValue& colour, float scale) const
- {
- Ogre::Matrix4 transform = Ogre::Matrix4::IDENTITY;
- transform.setTrans(position);
- transform.setScale(Ogre::Vector3(scale, scale, scale));
-
- for (int i = 0; i < (int) vertices.size(); i++)
- target->push_back(VertexPair(transform * vertices[i], colour));
-
- return vertices.size();
- }
-}
+/**
+ * Copy-pasted from
+ * - https://bitbucket.org/hasyimi/ogre-debug-drawing-utility/src
+ * - http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Debug+Drawing+Utility+Class
+ *
+ * This source code is released into the Public Domain.
+ *
+ * Modified by Fabian 'x3n' Landau
+ */
+
+#include "IcoSphere.h"
+
+#include <OgreSceneManager.h>
+#include <OgreRenderQueue.h>
+#include <OgreManualObject.h>
+#include <OgreAxisAlignedBox.h>
+
+namespace orxonox
+{
+ IcoSphere::IcoSphere() :
+ index(0)
+ {
+ }
+
+ IcoSphere::~IcoSphere()
+ {
+ }
+
+ void IcoSphere::create(int recursionLevel)
+ {
+ vertices.clear();
+ lineIndices.clear();
+ triangleIndices.clear();
+ faces.clear();
+ middlePointIndexCache.clear();
+ index = 0;
+
+ float t = (1.0f + Ogre::Math::Sqrt(5.0f)) / 2.0f;
+
+ addVertex(Ogre::Vector3(-1.0f, t, 0.0f));
+ addVertex(Ogre::Vector3(1.0f, t, 0.0f));
+ addVertex(Ogre::Vector3(-1.0f, -t, 0.0f));
+ addVertex(Ogre::Vector3(1.0f, -t, 0.0f));
+
+ addVertex(Ogre::Vector3(0.0f, -1.0f, t));
+ addVertex(Ogre::Vector3(0.0f, 1.0f, t));
+ addVertex(Ogre::Vector3(0.0f, -1.0f, -t));
+ addVertex(Ogre::Vector3(0.0f, 1.0f, -t));
+
+ addVertex(Ogre::Vector3(t, 0.0f, -1.0f));
+ addVertex(Ogre::Vector3(t, 0.0f, 1.0f));
+ addVertex(Ogre::Vector3(-t, 0.0f, -1.0f));
+ addVertex(Ogre::Vector3(-t, 0.0f, 1.0f));
+
+ addFace(0, 11, 5);
+ addFace(0, 5, 1);
+ addFace(0, 1, 7);
+ addFace(0, 7, 10);
+ addFace(0, 10, 11);
+
+ addFace(1, 5, 9);
+ addFace(5, 11, 4);
+ addFace(11, 10, 2);
+ addFace(10, 7, 6);
+ addFace(7, 1, 8);
+
+ addFace(3, 9, 4);
+ addFace(3, 4, 2);
+ addFace(3, 2, 6);
+ addFace(3, 6, 8);
+ addFace(3, 8, 9);
+
+ addFace(4, 9, 5);
+ addFace(2, 4, 11);
+ addFace(6, 2, 10);
+ addFace(8, 6, 7);
+ addFace(9, 8, 1);
+
+ addLineIndices(1, 0);
+ addLineIndices(1, 5);
+ addLineIndices(1, 7);
+ addLineIndices(1, 8);
+ addLineIndices(1, 9);
+
+ addLineIndices(2, 3);
+ addLineIndices(2, 4);
+ addLineIndices(2, 6);
+ addLineIndices(2, 10);
+ addLineIndices(2, 11);
+
+ addLineIndices(0, 5);
+ addLineIndices(5, 9);
+ addLineIndices(9, 8);
+ addLineIndices(8, 7);
+ addLineIndices(7, 0);
+
+ addLineIndices(10, 11);
+ addLineIndices(11, 4);
+ addLineIndices(4, 3);
+ addLineIndices(3, 6);
+ addLineIndices(6, 10);
+
+ addLineIndices(0, 11);
+ addLineIndices(11, 5);
+ addLineIndices(5, 4);
+ addLineIndices(4, 9);
+ addLineIndices(9, 3);
+ addLineIndices(3, 8);
+ addLineIndices(8, 6);
+ addLineIndices(6, 7);
+ addLineIndices(7, 10);
+ addLineIndices(10, 0);
+
+ for (int i = 0; i < recursionLevel; i++)
+ {
+ std::list<TriangleIndices> faces2;
+
+ for (std::list<TriangleIndices>::iterator j = faces.begin(); j != faces.end(); j++)
+ {
+ TriangleIndices f = *j;
+ int a = getMiddlePoint(f.v1, f.v2);
+ int b = getMiddlePoint(f.v2, f.v3);
+ int c = getMiddlePoint(f.v3, f.v1);
+
+ removeLineIndices(f.v1, f.v2);
+ removeLineIndices(f.v2, f.v3);
+ removeLineIndices(f.v3, f.v1);
+
+ faces2.push_back(TriangleIndices(f.v1, a, c));
+ faces2.push_back(TriangleIndices(f.v2, b, a));
+ faces2.push_back(TriangleIndices(f.v3, c, b));
+ faces2.push_back(TriangleIndices(a, b, c));
+
+ addTriangleLines(f.v1, a, c);
+ addTriangleLines(f.v2, b, a);
+ addTriangleLines(f.v3, c, b);
+ }
+
+ faces = faces2;
+ }
+ }
+
+ void IcoSphere::addLineIndices(int index0, int index1)
+ {
+ lineIndices.push_back(LineIndices(index0, index1));
+ }
+
+ void IcoSphere::removeLineIndices(int index0, int index1)
+ {
+ std::list<LineIndices>::iterator result = std::find(lineIndices.begin(), lineIndices.end(), LineIndices(index0, index1));
+
+ if (result != lineIndices.end())
+ lineIndices.erase(result);
+ }
+
+ void IcoSphere::addTriangleLines(int index0, int index1, int index2)
+ {
+ addLineIndices(index0, index1);
+ addLineIndices(index1, index2);
+ addLineIndices(index2, index0);
+ }
+
+ int IcoSphere::addVertex(const Ogre::Vector3& vertex)
+ {
+ Ogre::Real length = vertex.length();
+ vertices.push_back(Ogre::Vector3(vertex.x / length, vertex.y / length, vertex.z / length));
+ return index++;
+ }
+
+ int IcoSphere::getMiddlePoint(int index0, int index1)
+ {
+ bool isFirstSmaller = index0 < index1;
+ int64_t smallerIndex = isFirstSmaller ? index0 : index1;
+ int64_t largerIndex = isFirstSmaller ? index1 : index0;
+ int64_t key = (smallerIndex << 32) | largerIndex;
+
+ if (middlePointIndexCache.find(key) != middlePointIndexCache.end())
+ return middlePointIndexCache[key];
+
+ Ogre::Vector3 point1 = vertices[index0];
+ Ogre::Vector3 point2 = vertices[index1];
+ Ogre::Vector3 middle = point1.midPoint(point2);
+
+ int index = addVertex(middle);
+ middlePointIndexCache[key] = index;
+ return index;
+ }
+
+ void IcoSphere::addFace(int index0, int index1, int index2)
+ {
+ faces.push_back(TriangleIndices(index0, index1, index2));
+ }
+
+ void IcoSphere::addToLineIndices(int baseIndex, std::list<int>* target) const
+ {
+ for (std::list<LineIndices>::const_iterator i = lineIndices.begin(); i != lineIndices.end(); i++)
+ {
+ target->push_back(baseIndex + (*i).v1);
+ target->push_back(baseIndex + (*i).v2);
+ }
+ }
+
+ void IcoSphere::addToTriangleIndices(int baseIndex, std::list<int>* target) const
+ {
+ for (std::list<TriangleIndices>::const_iterator i = faces.begin(); i != faces.end(); i++)
+ {
+ target->push_back(baseIndex + (*i).v1);
+ target->push_back(baseIndex + (*i).v2);
+ target->push_back(baseIndex + (*i).v3);
+ }
+ }
+
+ int IcoSphere::addToVertices(std::list<VertexPair>* target, const Ogre::Vector3& position, const Ogre::ColourValue& colour, float scale) const
+ {
+ Ogre::Matrix4 transform = Ogre::Matrix4::IDENTITY;
+ transform.setTrans(position);
+ transform.setScale(Ogre::Vector3(scale, scale, scale));
+
+ for (int i = 0; i < (int) vertices.size(); i++)
+ target->push_back(VertexPair(transform * vertices[i], colour));
+
+ return vertices.size();
+ }
+}
Property changes on: code/trunk/src/libraries/tools/IcoSphere.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/libraries/tools/IcoSphere.h
===================================================================
--- code/trunk/src/libraries/tools/IcoSphere.h 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/src/libraries/tools/IcoSphere.h 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,88 +1,88 @@
-/**
- * Copy-pasted from
- * - https://bitbucket.org/hasyimi/ogre-debug-drawing-utility/src
- * - http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Debug+Drawing+Utility+Class
- *
- * This source code is released into the Public Domain.
- *
- * Modified by Fabian 'x3n' Landau
- */
-
-/**
- * @file
- * @brief DebugDrawer is a utility to draw debug shapes (lines, triangles, spheres) with Ogre.
- * This utility is e.g. used by @ref BulletDebugDrawer to visualize collision shapes and other physical entities.
- */
-
-#ifndef _IcoSphere_H__
-#define _IcoSphere_H__
-
-#include "tools/ToolsPrereqs.h"
-
-#include <OgreSingleton.h>
-#include <map>
-
-namespace orxonox
-{
- typedef std::pair<Ogre::Vector3, Ogre::ColourValue> VertexPair;
-
- class _ToolsExport IcoSphere
- {
- public:
- struct TriangleIndices
- {
- int v1, v2, v3;
-
- TriangleIndices(int _v1, int _v2, int _v3) :
- v1(_v1), v2(_v2), v3(_v3)
- {
- }
-
- bool operator <(const TriangleIndices &o) const
- {
- return v1 < o.v1 && v2 < o.v2 && v3 < o.v3;
- }
- };
-
- struct LineIndices
- {
- int v1, v2;
-
- LineIndices(int _v1, int _v2) :
- v1(_v1), v2(_v2)
- {
- }
-
- bool operator ==(const LineIndices &o) const
- {
- return (v1 == o.v1 && v2 == o.v2) || (v1 == o.v2 && v2 == o.v1);
- }
- };
-
- IcoSphere();
- ~IcoSphere();
-
- void create(int recursionLevel);
- void addToLineIndices(int baseIndex, std::list<int>* target) const;
- int addToVertices(std::list<VertexPair>* target, const Ogre::Vector3& position, const Ogre::ColourValue& colour, float scale) const;
- void addToTriangleIndices(int baseIndex, std::list<int>* target) const;
-
- private:
- int addVertex(const Ogre::Vector3& vertex);
- void addLineIndices(int index0, int index1);
- void addTriangleLines(int index0, int index1, int index2);
- int getMiddlePoint(int index0, int index1);
- void addFace(int index0, int index1, int index2);
-
- void removeLineIndices(int index0, int index1);
-
- std::vector<Ogre::Vector3> vertices;
- std::list<LineIndices> lineIndices;
- std::list<int> triangleIndices;
- std::list<TriangleIndices> faces;
- std::map<int64_t, int> middlePointIndexCache;
- int index;
- };
-}
-
-#endif /* _IcoSphere_H__ */
+/**
+ * Copy-pasted from
+ * - https://bitbucket.org/hasyimi/ogre-debug-drawing-utility/src
+ * - http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Debug+Drawing+Utility+Class
+ *
+ * This source code is released into the Public Domain.
+ *
+ * Modified by Fabian 'x3n' Landau
+ */
+
+/**
+ * @file
+ * @brief DebugDrawer is a utility to draw debug shapes (lines, triangles, spheres) with Ogre.
+ * This utility is e.g. used by @ref BulletDebugDrawer to visualize collision shapes and other physical entities.
+ */
+
+#ifndef _IcoSphere_H__
+#define _IcoSphere_H__
+
+#include "tools/ToolsPrereqs.h"
+
+#include <OgreSingleton.h>
+#include <map>
+
+namespace orxonox
+{
+ typedef std::pair<Ogre::Vector3, Ogre::ColourValue> VertexPair;
+
+ class _ToolsExport IcoSphere
+ {
+ public:
+ struct TriangleIndices
+ {
+ int v1, v2, v3;
+
+ TriangleIndices(int _v1, int _v2, int _v3) :
+ v1(_v1), v2(_v2), v3(_v3)
+ {
+ }
+
+ bool operator <(const TriangleIndices &o) const
+ {
+ return v1 < o.v1 && v2 < o.v2 && v3 < o.v3;
+ }
+ };
+
+ struct LineIndices
+ {
+ int v1, v2;
+
+ LineIndices(int _v1, int _v2) :
+ v1(_v1), v2(_v2)
+ {
+ }
+
+ bool operator ==(const LineIndices &o) const
+ {
+ return (v1 == o.v1 && v2 == o.v2) || (v1 == o.v2 && v2 == o.v1);
+ }
+ };
+
+ IcoSphere();
+ ~IcoSphere();
+
+ void create(int recursionLevel);
+ void addToLineIndices(int baseIndex, std::list<int>* target) const;
+ int addToVertices(std::list<VertexPair>* target, const Ogre::Vector3& position, const Ogre::ColourValue& colour, float scale) const;
+ void addToTriangleIndices(int baseIndex, std::list<int>* target) const;
+
+ private:
+ int addVertex(const Ogre::Vector3& vertex);
+ void addLineIndices(int index0, int index1);
+ void addTriangleLines(int index0, int index1, int index2);
+ int getMiddlePoint(int index0, int index1);
+ void addFace(int index0, int index1, int index2);
+
+ void removeLineIndices(int index0, int index1);
+
+ std::vector<Ogre::Vector3> vertices;
+ std::list<LineIndices> lineIndices;
+ std::list<int> triangleIndices;
+ std::list<TriangleIndices> faces;
+ std::map<int64_t, int> middlePointIndexCache;
+ int index;
+ };
+}
+
+#endif /* _IcoSphere_H__ */
Property changes on: code/trunk/src/libraries/tools/IcoSphere.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/libraries/tools/OgreBulletUtils.h
===================================================================
--- code/trunk/src/libraries/tools/OgreBulletUtils.h 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/src/libraries/tools/OgreBulletUtils.h 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,62 +1,62 @@
-/**
- * Copy-pasted from http://www.ogre3d.org/tikiwiki/BulletDebugDrawer&structure=Cookbook
- * This source code is released into the Public Domain.
- *
- * Modified by Fabian 'x3n' Landau
- */
-
-#ifndef _OgreBulletUtils_H__
-#define _OgreBulletUtils_H__
-
-#include "tools/ToolsPrereqs.h"
-
-namespace orxonox
-{
- inline btVector3 vector3(const Ogre::Vector3& V)
- {
- return btVector3(V.x, V.y, V.z);
- }
-
- inline Ogre::Vector3 vector3(const btVector3& V)
- {
- return Ogre::Vector3(V.x(), V.y(), V.z());
- }
-
- inline btQuaternion quaternion(const Ogre::Quaternion& Q)
- {
- return btQuaternion(Q.x, Q.y, Q.z, Q.w);
- }
-
- inline Ogre::Quaternion quaternion(const btQuaternion& Q)
- {
- return Ogre::Quaternion(Q.w(), Q.x(), Q.y(), Q.z());
- }
-
- inline Ogre::ColourValue colour(const btVector3& color, btScalar alpha)
- {
- Ogre::ColourValue c(color.getX(), color.getY(), color.getZ(), alpha);
- c.saturate();
- return c;
- }
-
- inline Ogre::Matrix3 matrix3(const btMatrix3x3& matrix)
- {
- return Matrix3(
- matrix[0][0], matrix[0][1], matrix[0][2],
- matrix[1][0], matrix[1][1], matrix[1][2],
- matrix[2][0], matrix[2][1], matrix[2][2]
- );
- }
-
- inline Ogre::Matrix4 matrix4(const btTransform& transform)
- {
- const btMatrix3x3& rotation = transform.getBasis();
- const btVector3& translation = transform.getOrigin();
-
- Ogre::Matrix4 matrix4 = Ogre::Matrix4(matrix3(rotation));
- matrix4.setTrans(vector3(translation));
- return matrix4;
- }
-}
-
-#endif /* _OgreBulletUtils_H__ */
+/**
+ * Copy-pasted from http://www.ogre3d.org/tikiwiki/BulletDebugDrawer&structure=Cookbook
+ * This source code is released into the Public Domain.
+ *
+ * Modified by Fabian 'x3n' Landau
+ */
+
+#ifndef _OgreBulletUtils_H__
+#define _OgreBulletUtils_H__
+
+#include "tools/ToolsPrereqs.h"
+
+namespace orxonox
+{
+ inline btVector3 vector3(const Ogre::Vector3& V)
+ {
+ return btVector3(V.x, V.y, V.z);
+ }
+
+ inline Ogre::Vector3 vector3(const btVector3& V)
+ {
+ return Ogre::Vector3(V.x(), V.y(), V.z());
+ }
+
+ inline btQuaternion quaternion(const Ogre::Quaternion& Q)
+ {
+ return btQuaternion(Q.x, Q.y, Q.z, Q.w);
+ }
+
+ inline Ogre::Quaternion quaternion(const btQuaternion& Q)
+ {
+ return Ogre::Quaternion(Q.w(), Q.x(), Q.y(), Q.z());
+ }
+
+ inline Ogre::ColourValue colour(const btVector3& color, btScalar alpha)
+ {
+ Ogre::ColourValue c(color.getX(), color.getY(), color.getZ(), alpha);
+ c.saturate();
+ return c;
+ }
+
+ inline Ogre::Matrix3 matrix3(const btMatrix3x3& matrix)
+ {
+ return Matrix3(
+ matrix[0][0], matrix[0][1], matrix[0][2],
+ matrix[1][0], matrix[1][1], matrix[1][2],
+ matrix[2][0], matrix[2][1], matrix[2][2]
+ );
+ }
+
+ inline Ogre::Matrix4 matrix4(const btTransform& transform)
+ {
+ const btMatrix3x3& rotation = transform.getBasis();
+ const btVector3& translation = transform.getOrigin();
+
+ Ogre::Matrix4 matrix4 = Ogre::Matrix4(matrix3(rotation));
+ matrix4.setTrans(vector3(translation));
+ return matrix4;
+ }
+}
+
+#endif /* _OgreBulletUtils_H__ */
Property changes on: code/trunk/src/libraries/tools/OgreBulletUtils.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/gametypes/SpaceRaceBot.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/gametypes/SpaceRaceBot.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/gametypes/SpaceRaceController.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/gametypes/SpaceRaceController.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/CMakeLists.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/Jump.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/Jump.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpBoots.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpBoots.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpCenterpoint.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpCenterpoint.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpEnemy.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpEnemy.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpFigure.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpFigure.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpItem.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpItem.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatform.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatform.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformDisappear.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformDisappear.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformFake.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformFake.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformHMove.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformHMove.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformStatic.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformStatic.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformTimer.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformTimer.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformVMove.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPlatformVMove.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPrereqs.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpProjectile.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpProjectile.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPropeller.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpPropeller.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpRocket.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpRocket.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpScore.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpScore.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpShield.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpShield.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpSpring.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/jump/JumpSpring.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/objects/Turret.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/objects/Turret.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/modules/objects/collisionshapes/CylinderCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/CylinderCollisionShape.cc 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/src/modules/objects/collisionshapes/CylinderCollisionShape.cc 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,73 +1,73 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file CylinderCollisionShape.cc
- @brief Implementation of the CylinderCollisionShape class.
-*/
-
-#include "CylinderCollisionShape.h"
-
-#include <BulletCollision/CollisionShapes/btCylinderShape.h>
-
-#include "core/CoreIncludes.h"
-#include "tools/BulletConversions.h"
-
-namespace orxonox
-{
- RegisterClass(CylinderCollisionShape);
-
- /**
- @brief
- Constructor. Registers and initializes the object.
- */
- CylinderCollisionShape::CylinderCollisionShape(Context* context) : AbstractRadiusHeightCollisionShape(context)
- {
- RegisterObject(CylinderCollisionShape);
-
- updateShape();
- }
-
- CylinderCollisionShape::~CylinderCollisionShape()
- {
- if (this->isInitialized())
- delete this->collisionShape_;
- }
-
- /**
- @brief
- Creates a new internal collision shape for the CylinderCollisionShape.
- @return
- Returns a pointer to the newly created btCylinderShape.
- */
- btCollisionShape* CylinderCollisionShape::createNewShape() const
- {
- // divide height by 2 because bullet expects the half extents
- return new btCylinderShape(btVector3(this->getRadius(), this->getHeight() / 2, 0));
- }
-}
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file CylinderCollisionShape.cc
+ @brief Implementation of the CylinderCollisionShape class.
+*/
+
+#include "CylinderCollisionShape.h"
+
+#include <BulletCollision/CollisionShapes/btCylinderShape.h>
+
+#include "core/CoreIncludes.h"
+#include "tools/BulletConversions.h"
+
+namespace orxonox
+{
+ RegisterClass(CylinderCollisionShape);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
+ CylinderCollisionShape::CylinderCollisionShape(Context* context) : AbstractRadiusHeightCollisionShape(context)
+ {
+ RegisterObject(CylinderCollisionShape);
+
+ updateShape();
+ }
+
+ CylinderCollisionShape::~CylinderCollisionShape()
+ {
+ if (this->isInitialized())
+ delete this->collisionShape_;
+ }
+
+ /**
+ @brief
+ Creates a new internal collision shape for the CylinderCollisionShape.
+ @return
+ Returns a pointer to the newly created btCylinderShape.
+ */
+ btCollisionShape* CylinderCollisionShape::createNewShape() const
+ {
+ // divide height by 2 because bullet expects the half extents
+ return new btCylinderShape(btVector3(this->getRadius(), this->getHeight() / 2, 0));
+ }
+}
Property changes on: code/trunk/src/modules/objects/collisionshapes/CylinderCollisionShape.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/modules/objects/collisionshapes/CylinderCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/CylinderCollisionShape.h 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/src/modules/objects/collisionshapes/CylinderCollisionShape.h 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,62 +1,62 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file CylinderCollisionShape.h
- @brief Definition of the CylinderCollisionShape class.
- @ingroup Collisionshapes
-*/
-
-#ifndef _CylinderCollisionShape_H__
-#define _CylinderCollisionShape_H__
-
-#include "objects/ObjectsPrereqs.h"
-#include "AbstractRadiusHeightCollisionShape.h"
-
-namespace orxonox
-{
-
- /**
- @brief
- Wrapper for the bullet Cylinder collision shape class btCylinderShape.
-
- @see btCylinderShape
- @ingroup Collisionshapes
- */
- class _ObjectsExport CylinderCollisionShape : public AbstractRadiusHeightCollisionShape
- {
- public:
- CylinderCollisionShape(Context* context);
- virtual ~CylinderCollisionShape();
-
- private:
- btCollisionShape* createNewShape() const; // Creates a new internal collision shape for the CylinderCollisionShape.
- };
-}
-
-#endif /* _CylinderCollisionShape_H__ */
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file CylinderCollisionShape.h
+ @brief Definition of the CylinderCollisionShape class.
+ @ingroup Collisionshapes
+*/
+
+#ifndef _CylinderCollisionShape_H__
+#define _CylinderCollisionShape_H__
+
+#include "objects/ObjectsPrereqs.h"
+#include "AbstractRadiusHeightCollisionShape.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ Wrapper for the bullet Cylinder collision shape class btCylinderShape.
+
+ @see btCylinderShape
+ @ingroup Collisionshapes
+ */
+ class _ObjectsExport CylinderCollisionShape : public AbstractRadiusHeightCollisionShape
+ {
+ public:
+ CylinderCollisionShape(Context* context);
+ virtual ~CylinderCollisionShape();
+
+ private:
+ btCollisionShape* createNewShape() const; // Creates a new internal collision shape for the CylinderCollisionShape.
+ };
+}
+
+#endif /* _CylinderCollisionShape_H__ */
Property changes on: code/trunk/src/modules/objects/collisionshapes/CylinderCollisionShape.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/objects/controllers/CMakeLists.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/objects/controllers/TeamTargetProxy.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/objects/controllers/TeamTargetProxy.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/objects/controllers/TurretController.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/objects/controllers/TurretController.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/tetris/TetrisBrick.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/tetris/TetrisBrick.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/tetris/TetrisScore.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/tetris/TetrisScore.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/orxonox/ShipPartManager.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/orxonox/ShipPartManager.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/orxonox/controllers/ControllerDirector.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/orxonox/controllers/ControllerDirector.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/orxonox/controllers/ScriptController.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/orxonox/controllers/ScriptController.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/orxonox/controllers/testscript.lua
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/orxonox/items/PartDestructionEvent.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/orxonox/items/PartDestructionEvent.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/orxonox/items/ShipPart.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/orxonox/items/ShipPart.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,308 +1,308 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * Noe Pedrazzini
- *
- */
-
-#include "ModularSpaceShip.h"
-
-#include <BulletDynamics/Dynamics/btRigidBody.h>
-
-#include "core/CoreIncludes.h"
-#include "core/config/ConfigValueIncludes.h"
-#include "core/Template.h"
-#include "core/XMLPort.h"
-#include "util/Math.h"
-#include "gametypes/Gametype.h"
-#include "core/command/ConsoleCommand.h"
-
-#include "items/ShipPart.h"
-#include "items/Engine.h"
-#include "worldentities/StaticEntity.h"
-#include <BulletCollision/CollisionShapes/btCollisionShape.h>
-#include <BulletCollision/CollisionShapes/btCompoundShape.h>
-
-
-
-namespace orxonox
-{
- SetConsoleCommand("ModularSpaceShip", "killshippart", &ModularSpaceShip::killShipPartStatic);
-
- RegisterClass(ModularSpaceShip);
-
- std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = 0;
-
- ModularSpaceShip::ModularSpaceShip(Context* context) : SpaceShip(context)
- {
- RegisterObject(ModularSpaceShip);
-
- this->registerVariables();
-
- ModularSpaceShip::partMap_s = &(this->partMap_);
-
- }
-
- ModularSpaceShip::~ModularSpaceShip()
- {
- if (this->isInitialized())
- {
-
- }
- }
-
- void ModularSpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(ModularSpaceShip, XMLPort, xmlelement, mode);
- XMLPortObject(ModularSpaceShip, ShipPart, "parts", addShipPart, getShipPart, xmlelement, mode);
- }
-
- void ModularSpaceShip::registerVariables()
- {
- return;
- }
-
- /**
- @brief
- Searches for ShipParts matching to StaticEntities.
- */
- void ModularSpaceShip::updatePartAssignment()
- {
- // iterate through all attached objects
- for (unsigned int i=0; i < this->getAttachedObjects().size(); i++)
- {
- if (this->getAttachedObject(i) == NULL)
- {
- break;
- }
- // iterate through all attached parts
- for(unsigned int j = 0; j < this->partList_.size(); j++)
- {
- // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done).
- if((this->partList_[j]->getName() == this->getAttachedObject(i)->getName()) && !this->partList_[j]->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
- {
- // The Entity is added to the part's entityList_
- this->partList_[j]->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
- // An entry in the partMap_ is created, assigning the part to the entity.
- this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), this->partList_[j]);
- }
- }
- }
- }
-
- /**
- @brief
- Creates a new assignment for the given StaticEntity and ShipPart in the partMap_
- @param entity
- A pointer to the StaticEntity
- @param part
- A pointer to the ShipPart.
- */
- void ModularSpaceShip::addPartEntityAssignment(StaticEntity* entity, ShipPart* part)
- {
- if (!entity || !part)
- return;
-
- if (this->partMap_.find(entity) != this->partMap_.end())
- {
- orxout(internal_warning) << "Assigning an Entity to multiple parts is not yet supported." << endl;
- return;
- }
-
- this->partMap_[entity] = part;
- }
-
-
- /**
- @brief
- Get the ShipPart an attached entity belongs to.
- @param entity
- The entity to be searched.
- @return
- Returns a pointer to the ShipPart the entity belongs to.
- */
- ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const
- {
- for (std::map<StaticEntity*, ShipPart*>::const_iterator it = this->partMap_.begin(); it != this->partMap_.end(); ++it)
- {
- if (it->first == entity)
- return it->second;
- }
- return NULL;
- }
-
- /**
- @brief
- If the damage occurred on an attached StaticEntity, the damage is given to the corresponding ShipPart to handle.
- */
- void ModularSpaceShip::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
- {
- if (this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != NULL)
- this->getPartOfEntity((StaticEntity*)(cs->getUserPointer()))->handleHit(damage, healthdamage, shielddamage, originator);
- else
- SpaceShip::damage(damage, healthdamage, shielddamage, originator, cs);
- }
-
- /**
- @brief
- STATIC: Needed for consolecommand. Kills the ShipPart with the given name. Used from the console-command "ModularSpaceShip killshippart [string]".
- @param name
- The name of the part to be killed.
- */
- void ModularSpaceShip::killShipPartStatic(std::string name)
- {
- for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_s->begin(); it != ModularSpaceShip::partMap_s->end(); ++it)
- {
- if (it->second->getName() == name)
- {
- it->second->setAlive(false);
- return;
- }
- }
- orxout(internal_warning) << "Could not apply damage to ShipPart \"" << name << "\". Part not found." << endl;
- }
-
- /**
- @brief
- Kills the ShipPart with the given name. Used from the console-command "ModularSpaceShip killshippart [string]".
- @param name
- The name of the part to be killed.
- */
- void ModularSpaceShip::killShipPart(std::string name)
- {
- for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_.begin(); it != ModularSpaceShip::partMap_.end(); ++it)
- {
- if (it->second->getName() == name)
- {
- it->second->setAlive(false);
- return;
- }
- }
- orxout(internal_warning) << "Could not apply damage to ShipPart \"" << name << "\". Part not found." << endl;
- }
-
- /**
- @brief
- Add a ShipPart to the SpaceShip.
- @param engine
- A pointer to the ShipPart to be added.
- */
- void ModularSpaceShip::addShipPart(ShipPart* part)
- {
- OrxAssert(part != NULL, "The ShipPart cannot be NULL.");
- this->partList_.push_back(part);
- part->setParent(this);
- this->updatePartAssignment();
- }
-
- /**
- @brief
- Get the i-th ShipPart of the SpaceShip.
- @return
- Returns a pointer to the i-the ShipPart. NULL if there is no ShipPart with that index.
- */
- ShipPart* ModularSpaceShip::getShipPart(unsigned int index)
- {
- if(this->partList_.size() <= index)
- return NULL;
- else
- return this->partList_[index];
- }
-
- /**
- @brief
- Looks for an attached ShipPart with a certain name.
- @param name
- The name of the ShipPart to be returned.
- @return
- Pointer to the ShipPart with the given name, or NULL if not found.
- */
- ShipPart* ModularSpaceShip::getShipPartByName(std::string name)
- {
- for(std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it)
- {
- if(orxonox_cast<ShipPart*>(*it)->getName() == name)
- {
- return orxonox_cast<ShipPart*>(*it);
- }
- }
- orxout(internal_warning) << "Couldn't find ShipPart with name \"" << name << "\"." << endl;
- return NULL;
- }
-
- /**
- @brief
- Check whether the SpaceShip has a particular Engine.
- @param engine
- A pointer to the Engine to be checked.
- */
- bool ModularSpaceShip::hasShipPart(ShipPart* part) const
- {
- for(unsigned int i = 0; i < this->partList_.size(); i++)
- {
- if(this->partList_[i] == part)
- return true;
- }
- return false;
- }
-
-
- /**
- @brief
- Removes a ShipPart from the SpaceShip, destroying the corresponding StaticEntity
- @param part
- The ShipPart to be removed.
- */
- void ModularSpaceShip::removeShipPart(ShipPart* part)
- {
- // Remove the part from the partList_
- std::vector<ShipPart*>::iterator it = this->partList_.begin();
- for(unsigned int i = 0; i < this->partList_.size(); i++)
- {
- if(this->partList_[i] == part)
- {
- this->partList_.erase(it);
- break;
- }
- it++;
- }
- // Remove the part-entity assignment and detach the Entity of this ShipPart
- for (std::map<StaticEntity*, ShipPart*>::iterator itt = this->partMap_.begin(); itt != this->partMap_.end(); )
- {
- if (itt->second == part)
- {
- this->detach(itt->first);
- itt->first->destroy();
- //itt->first->setActive(false);
- //itt->first->setVisible(false);
- //itt->first->setCollisionResponse(false);
- //itt->first->setCollisionType(None);
- //itt->first->deactivatePhysics();
- this->partMap_.erase(itt++);
- } else {
- ++itt;
- }
- }
- }
-}
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * Noe Pedrazzini
+ *
+ */
+
+#include "ModularSpaceShip.h"
+
+#include <BulletDynamics/Dynamics/btRigidBody.h>
+
+#include "core/CoreIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "core/Template.h"
+#include "core/XMLPort.h"
+#include "util/Math.h"
+#include "gametypes/Gametype.h"
+#include "core/command/ConsoleCommand.h"
+
+#include "items/ShipPart.h"
+#include "items/Engine.h"
+#include "worldentities/StaticEntity.h"
+#include <BulletCollision/CollisionShapes/btCollisionShape.h>
+#include <BulletCollision/CollisionShapes/btCompoundShape.h>
+
+
+
+namespace orxonox
+{
+ SetConsoleCommand("ModularSpaceShip", "killshippart", &ModularSpaceShip::killShipPartStatic);
+
+ RegisterClass(ModularSpaceShip);
+
+ std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = 0;
+
+ ModularSpaceShip::ModularSpaceShip(Context* context) : SpaceShip(context)
+ {
+ RegisterObject(ModularSpaceShip);
+
+ this->registerVariables();
+
+ ModularSpaceShip::partMap_s = &(this->partMap_);
+
+ }
+
+ ModularSpaceShip::~ModularSpaceShip()
+ {
+ if (this->isInitialized())
+ {
+
+ }
+ }
+
+ void ModularSpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(ModularSpaceShip, XMLPort, xmlelement, mode);
+ XMLPortObject(ModularSpaceShip, ShipPart, "parts", addShipPart, getShipPart, xmlelement, mode);
+ }
+
+ void ModularSpaceShip::registerVariables()
+ {
+ return;
+ }
+
+ /**
+ @brief
+ Searches for ShipParts matching to StaticEntities.
+ */
+ void ModularSpaceShip::updatePartAssignment()
+ {
+ // iterate through all attached objects
+ for (unsigned int i=0; i < this->getAttachedObjects().size(); i++)
+ {
+ if (this->getAttachedObject(i) == NULL)
+ {
+ break;
+ }
+ // iterate through all attached parts
+ for(unsigned int j = 0; j < this->partList_.size(); j++)
+ {
+ // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done).
+ if((this->partList_[j]->getName() == this->getAttachedObject(i)->getName()) && !this->partList_[j]->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
+ {
+ // The Entity is added to the part's entityList_
+ this->partList_[j]->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
+ // An entry in the partMap_ is created, assigning the part to the entity.
+ this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), this->partList_[j]);
+ }
+ }
+ }
+ }
+
+ /**
+ @brief
+ Creates a new assignment for the given StaticEntity and ShipPart in the partMap_
+ @param entity
+ A pointer to the StaticEntity
+ @param part
+ A pointer to the ShipPart.
+ */
+ void ModularSpaceShip::addPartEntityAssignment(StaticEntity* entity, ShipPart* part)
+ {
+ if (!entity || !part)
+ return;
+
+ if (this->partMap_.find(entity) != this->partMap_.end())
+ {
+ orxout(internal_warning) << "Assigning an Entity to multiple parts is not yet supported." << endl;
+ return;
+ }
+
+ this->partMap_[entity] = part;
+ }
+
+
+ /**
+ @brief
+ Get the ShipPart an attached entity belongs to.
+ @param entity
+ The entity to be searched.
+ @return
+ Returns a pointer to the ShipPart the entity belongs to.
+ */
+ ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const
+ {
+ for (std::map<StaticEntity*, ShipPart*>::const_iterator it = this->partMap_.begin(); it != this->partMap_.end(); ++it)
+ {
+ if (it->first == entity)
+ return it->second;
+ }
+ return NULL;
+ }
+
+ /**
+ @brief
+ If the damage occurred on an attached StaticEntity, the damage is given to the corresponding ShipPart to handle.
+ */
+ void ModularSpaceShip::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
+ {
+ if (this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != NULL)
+ this->getPartOfEntity((StaticEntity*)(cs->getUserPointer()))->handleHit(damage, healthdamage, shielddamage, originator);
+ else
+ SpaceShip::damage(damage, healthdamage, shielddamage, originator, cs);
+ }
+
+ /**
+ @brief
+ STATIC: Needed for consolecommand. Kills the ShipPart with the given name. Used from the console-command "ModularSpaceShip killshippart [string]".
+ @param name
+ The name of the part to be killed.
+ */
+ void ModularSpaceShip::killShipPartStatic(std::string name)
+ {
+ for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_s->begin(); it != ModularSpaceShip::partMap_s->end(); ++it)
+ {
+ if (it->second->getName() == name)
+ {
+ it->second->setAlive(false);
+ return;
+ }
+ }
+ orxout(internal_warning) << "Could not apply damage to ShipPart \"" << name << "\". Part not found." << endl;
+ }
+
+ /**
+ @brief
+ Kills the ShipPart with the given name. Used from the console-command "ModularSpaceShip killshippart [string]".
+ @param name
+ The name of the part to be killed.
+ */
+ void ModularSpaceShip::killShipPart(std::string name)
+ {
+ for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_.begin(); it != ModularSpaceShip::partMap_.end(); ++it)
+ {
+ if (it->second->getName() == name)
+ {
+ it->second->setAlive(false);
+ return;
+ }
+ }
+ orxout(internal_warning) << "Could not apply damage to ShipPart \"" << name << "\". Part not found." << endl;
+ }
+
+ /**
+ @brief
+ Add a ShipPart to the SpaceShip.
+ @param engine
+ A pointer to the ShipPart to be added.
+ */
+ void ModularSpaceShip::addShipPart(ShipPart* part)
+ {
+ OrxAssert(part != NULL, "The ShipPart cannot be NULL.");
+ this->partList_.push_back(part);
+ part->setParent(this);
+ this->updatePartAssignment();
+ }
+
+ /**
+ @brief
+ Get the i-th ShipPart of the SpaceShip.
+ @return
+ Returns a pointer to the i-the ShipPart. NULL if there is no ShipPart with that index.
+ */
+ ShipPart* ModularSpaceShip::getShipPart(unsigned int index)
+ {
+ if(this->partList_.size() <= index)
+ return NULL;
+ else
+ return this->partList_[index];
+ }
+
+ /**
+ @brief
+ Looks for an attached ShipPart with a certain name.
+ @param name
+ The name of the ShipPart to be returned.
+ @return
+ Pointer to the ShipPart with the given name, or NULL if not found.
+ */
+ ShipPart* ModularSpaceShip::getShipPartByName(std::string name)
+ {
+ for(std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it)
+ {
+ if(orxonox_cast<ShipPart*>(*it)->getName() == name)
+ {
+ return orxonox_cast<ShipPart*>(*it);
+ }
+ }
+ orxout(internal_warning) << "Couldn't find ShipPart with name \"" << name << "\"." << endl;
+ return NULL;
+ }
+
+ /**
+ @brief
+ Check whether the SpaceShip has a particular Engine.
+ @param engine
+ A pointer to the Engine to be checked.
+ */
+ bool ModularSpaceShip::hasShipPart(ShipPart* part) const
+ {
+ for(unsigned int i = 0; i < this->partList_.size(); i++)
+ {
+ if(this->partList_[i] == part)
+ return true;
+ }
+ return false;
+ }
+
+
+ /**
+ @brief
+ Removes a ShipPart from the SpaceShip, destroying the corresponding StaticEntity
+ @param part
+ The ShipPart to be removed.
+ */
+ void ModularSpaceShip::removeShipPart(ShipPart* part)
+ {
+ // Remove the part from the partList_
+ std::vector<ShipPart*>::iterator it = this->partList_.begin();
+ for(unsigned int i = 0; i < this->partList_.size(); i++)
+ {
+ if(this->partList_[i] == part)
+ {
+ this->partList_.erase(it);
+ break;
+ }
+ it++;
+ }
+ // Remove the part-entity assignment and detach the Entity of this ShipPart
+ for (std::map<StaticEntity*, ShipPart*>::iterator itt = this->partMap_.begin(); itt != this->partMap_.end(); )
+ {
+ if (itt->second == part)
+ {
+ this->detach(itt->first);
+ itt->first->destroy();
+ //itt->first->setActive(false);
+ //itt->first->setVisible(false);
+ //itt->first->setCollisionResponse(false);
+ //itt->first->setCollisionType(None);
+ //itt->first->deactivatePhysics();
+ this->partMap_.erase(itt++);
+ } else {
+ ++itt;
+ }
+ }
+ }
+}
Property changes on: code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h 2015-02-06 22:11:10 UTC (rev 10261)
+++ code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h 2015-02-06 22:30:26 UTC (rev 10262)
@@ -1,141 +1,141 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * Noe Pedrazzini
- *
- */
-
-#ifndef _ModularSpaceShip_H__
-#define _ModularSpaceShip_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-#include <LinearMath/btVector3.h>
-
-#include "tools/Timer.h"
-#include "util/Math.h"
-#include "util/OrxAssert.h"
-
-#include "SpaceShip.h"
-#include "items/ShipPart.h"
-#include <map>
-
-namespace orxonox
-{
-
- /**
- @brief
- The SpaceShip is the principal entity through which the player interacts with the game. Its main function is to fly, however many things, such as @ref orxonox::Engine Engines or @ref orxonox::Weapon Weapons, can be attached to it.
- The ModularSpaceShip is an extension of a @ref orxonox::SpaceShip SpaceShip, which uses @ref orxonox::ShipPart ShipParts to allow entities attached to it to be destroyed individually.
-
- There are several parameters that define the behavior of the ModularSpaceShip>
- - The <b>rotationThrust</b>, specifies the force with which the ModularSpaceShip rotates.
- - The <b>boost</b>, there are quite some parameters pertaining to boosting. The boost is a special move of the ModularSpaceShip, where, for a limited amount of time, it can fly considerably faster than usual. The <b>boostPower</b> is the amount of power available for boosting. The <b>boostPowerRate</b> is the rate at which the boost power is replenished. The <b>boostRate</b> is the rate at which boosting uses power. And the <b>boostCooldownDuration</b> is the time the ModularSpaceShip cannot boost, once all the boost power has been used up. Naturally all of these parameters must be non-negative.
- - The <b>boost shaking</b>, when the ModularSpaceShip boosts, the camera shakes to create a more immersive effect. Two parameters can be used to adjust the effect. The <b>shakeFrequency</b> is the frequency with which the camera shakes. And the <b>shakeAmplitude</b> is the amount with which the camera shakes. Again these parameters must bee non-negative.
- - The <b>lift</b> creates a more natural flight feeling through the addition of a lift force. There are again tow parameters that can be specified. The <b>lift</b> which is the lift force that is applied. And the <b>stallSpeed</b> which is the forward speed after which no more lift is generated.
-
- As mentioned @ref orxonox::Engine Engines can be mounted on the ModularSpaceShip.
- In order to assign attached entities to a ShipPart, a ShipPart with the same name as the corresponding entity needs to be created in the <parts> tag.
- Here is a (primitive) example of a ModularSpaceShip defined in XML:
- @code
- <ModularSpaceShip
- rotationThrust = 50
-
- lift = 1;
- stallSpeed = 220;
-
- boostPower = 15
- boostPowerRate = 1
- boostRate = 5
- boostCooldownDuration = 10
-
- shakeFrequency = 15
- shakeAmplitude = 9
-
- collisionType = "dynamic"
- mass = 100
- linearDamping = 0.7
- angularDamping = 0.9999999
- >
- <attached>
- <StaticEntity name="wing" . . . />
- <StaticEntity name="tail" . . . />
- </attached>
- <parts>
- <ShipPart name="wing" . . . />
- <ShipPart name="tail" . . . />
- </parts>
- <engines>
- <Engine />
- <Engine />
- </engines>
- </ModularSpaceShip>
- @endcode
-
- @author
- Fabian 'x3n' Landau, Noe Pedrazzini
- */
- class _OrxonoxExport ModularSpaceShip : public SpaceShip
- {
- public:
- ModularSpaceShip(Context* context);
- virtual ~ModularSpaceShip();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- void addPartEntityAssignment(StaticEntity* entity, ShipPart* part);
- ShipPart* getPartOfEntity(StaticEntity* entity) const;
-
- virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
-
- static void killShipPartStatic(std::string name);
- void killShipPart(std::string name);
-
- void addShipPart(ShipPart* part);
- ShipPart* getShipPart(unsigned int index);
- ShipPart* getShipPartByName(std::string name);
- bool hasShipPart(ShipPart* part) const;
- void removeShipPart(ShipPart* part);
-
- inline void setRotationThrust(float val)
- { this->rotationThrust_ = val; }
- inline float getRotationThrust()
- { return this->rotationThrust_; }
-
- virtual void updatePartAssignment();
-
- protected:
-
-
- private:
- void registerVariables();
- std::vector<ShipPart*> partList_; // The list of all Parts mounted on this ModularSpaceShip.
- std::map<StaticEntity*, ShipPart*> partMap_; // Map of Part-Entity-assignments
- static std::map<StaticEntity*, ShipPart*>* partMap_s;
-
- };
-}
-
-#endif /* _ModularSpaceShip_H__ */
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * Noe Pedrazzini
+ *
+ */
+
+#ifndef _ModularSpaceShip_H__
+#define _ModularSpaceShip_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include <LinearMath/btVector3.h>
+
+#include "tools/Timer.h"
+#include "util/Math.h"
+#include "util/OrxAssert.h"
+
+#include "SpaceShip.h"
+#include "items/ShipPart.h"
+#include <map>
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ The SpaceShip is the principal entity through which the player interacts with the game. Its main function is to fly, however many things, such as @ref orxonox::Engine Engines or @ref orxonox::Weapon Weapons, can be attached to it.
+ The ModularSpaceShip is an extension of a @ref orxonox::SpaceShip SpaceShip, which uses @ref orxonox::ShipPart ShipParts to allow entities attached to it to be destroyed individually.
+
+ There are several parameters that define the behavior of the ModularSpaceShip>
+ - The <b>rotationThrust</b>, specifies the force with which the ModularSpaceShip rotates.
+ - The <b>boost</b>, there are quite some parameters pertaining to boosting. The boost is a special move of the ModularSpaceShip, where, for a limited amount of time, it can fly considerably faster than usual. The <b>boostPower</b> is the amount of power available for boosting. The <b>boostPowerRate</b> is the rate at which the boost power is replenished. The <b>boostRate</b> is the rate at which boosting uses power. And the <b>boostCooldownDuration</b> is the time the ModularSpaceShip cannot boost, once all the boost power has been used up. Naturally all of these parameters must be non-negative.
+ - The <b>boost shaking</b>, when the ModularSpaceShip boosts, the camera shakes to create a more immersive effect. Two parameters can be used to adjust the effect. The <b>shakeFrequency</b> is the frequency with which the camera shakes. And the <b>shakeAmplitude</b> is the amount with which the camera shakes. Again these parameters must bee non-negative.
+ - The <b>lift</b> creates a more natural flight feeling through the addition of a lift force. There are again tow parameters that can be specified. The <b>lift</b> which is the lift force that is applied. And the <b>stallSpeed</b> which is the forward speed after which no more lift is generated.
+
+ As mentioned @ref orxonox::Engine Engines can be mounted on the ModularSpaceShip.
+ In order to assign attached entities to a ShipPart, a ShipPart with the same name as the corresponding entity needs to be created in the <parts> tag.
+ Here is a (primitive) example of a ModularSpaceShip defined in XML:
+ @code
+ <ModularSpaceShip
+ rotationThrust = 50
+
+ lift = 1;
+ stallSpeed = 220;
+
+ boostPower = 15
+ boostPowerRate = 1
+ boostRate = 5
+ boostCooldownDuration = 10
+
+ shakeFrequency = 15
+ shakeAmplitude = 9
+
+ collisionType = "dynamic"
+ mass = 100
+ linearDamping = 0.7
+ angularDamping = 0.9999999
+ >
+ <attached>
+ <StaticEntity name="wing" . . . />
+ <StaticEntity name="tail" . . . />
+ </attached>
+ <parts>
+ <ShipPart name="wing" . . . />
+ <ShipPart name="tail" . . . />
+ </parts>
+ <engines>
+ <Engine />
+ <Engine />
+ </engines>
+ </ModularSpaceShip>
+ @endcode
+
+ @author
+ Fabian 'x3n' Landau, Noe Pedrazzini
+ */
+ class _OrxonoxExport ModularSpaceShip : public SpaceShip
+ {
+ public:
+ ModularSpaceShip(Context* context);
+ virtual ~ModularSpaceShip();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ void addPartEntityAssignment(StaticEntity* entity, ShipPart* part);
+ ShipPart* getPartOfEntity(StaticEntity* entity) const;
+
+ virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
+
+ static void killShipPartStatic(std::string name);
+ void killShipPart(std::string name);
+
+ void addShipPart(ShipPart* part);
+ ShipPart* getShipPart(unsigned int index);
+ ShipPart* getShipPartByName(std::string name);
+ bool hasShipPart(ShipPart* part) const;
+ void removeShipPart(ShipPart* part);
+
+ inline void setRotationThrust(float val)
+ { this->rotationThrust_ = val; }
+ inline float getRotationThrust()
+ { return this->rotationThrust_; }
+
+ virtual void updatePartAssignment();
+
+ protected:
+
+
+ private:
+ void registerVariables();
+ std::vector<ShipPart*> partList_; // The list of all Parts mounted on this ModularSpaceShip.
+ std::map<StaticEntity*, ShipPart*> partMap_; // Map of Part-Entity-assignments
+ static std::map<StaticEntity*, ShipPart*>* partMap_s;
+
+ };
+}
+
+#endif /* _ModularSpaceShip_H__ */
Property changes on: code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h
___________________________________________________________________
Added: svn:eol-style
+ native
More information about the Orxonox-commit
mailing list