- Timestamp:
- 07/02/07 04:06:16 (17 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/src/Common/include/FPSPlayer.h
r2462 r2473 5 5 #include "OgreIlluminationManager.h" 6 6 #include "NXOgre.h" 7 #include "GeoLodStripsLibrary.h" 8 #include "GeoMeshLoader.h" 7 9 8 10 using namespace Ogre; … … 127 129 float getHit(){ if(mCurrentAnimState == PLAYERANIMSTATE_ATTACK) return 20; else return 0;} 128 130 void addHit(float hit); 131 void addPlayerMesh(String meshname, float meshscale, bool rotateModel); 129 132 130 133 bool frameStarted(const FrameEvent& evt) … … 142 145 143 146 static float MaxHealth; 147 static Geometry::GeoMeshLoader* meshLoader; 148 static Geometry::Mesh *trollLODMesh; 149 Geometry::LodStripsLibrary *lodObject; 150 float lastLodLevel; 144 151 }; 145 152 -
GTP/trunk/App/Demos/Illum/Ogre/src/Common/src/FPSPlayer.cpp
r2468 r2473 5 5 float TrollCharacter::MaxHealth = 350; 6 6 CharacterManager* CharacterManager::mSingleton = 0; 7 Geometry::GeoMeshLoader* TrollCharacter::meshLoader = 0; 8 Geometry::Mesh* TrollCharacter::trollLODMesh = 0; 9 10 class CustomIndexData : public Geometry::IndexData 11 { 12 private: 13 Ogre::Mesh *targetMesh; 14 Ogre::HardwareIndexBufferSharedPtr ibuf; 15 Ogre::RenderOperation mRenderOp; 16 unsigned long* pIdx; 17 public: 18 CustomIndexData(Ogre::Mesh *ogremesh):Geometry::IndexData(){ 19 targetMesh=ogremesh; 20 pIdx=NULL; 21 } 22 virtual ~CustomIndexData(void){} 23 24 virtual void Begin(unsigned int submeshid, unsigned int indexcount){ 25 targetMesh->getSubMesh(submeshid)->_getRenderOperation(mRenderOp,0); 26 ibuf = mRenderOp.indexData->indexBuffer; 27 mRenderOp.indexData->indexCount = indexcount; 28 pIdx = static_cast<unsigned long*>(ibuf->lock(Ogre::HardwareBuffer::HBL_NORMAL)); 29 } 30 virtual void SetIndex(unsigned int i, unsigned int index){ 31 pIdx[i] = index; //lodStripsLib->dataRetrievalInterface->GetIndex(k+offset); 32 } 33 virtual void End(){ 34 ibuf->unlock(); 35 } 36 virtual void BorrowIndexData(const Geometry::IndexData *){} 37 }; 7 38 8 39 void CharacterManager::levelUP() … … 26 57 Vector3(25, 10, 25 - i * 10), false); 27 58 28 troll->addPlayerMesh("troll .mesh", 0.05, false);59 troll->addPlayerMesh("trollLOD.mesh", 0.05, false); 29 60 troll->addWeaponModel("trollMace.mesh", "RightHand"); 30 61 OgreIlluminationManager::getSingleton().initTechniques(troll->getMeshEntity()); … … 291 322 : PlayerCharacter(name, scene, sceneManager, dimensions, startPosition, debug) 292 323 { 324 lastLodLevel = -1.0f; 293 325 mHealth = MaxHealth; 294 326 } … … 363 395 } 364 396 397 void TrollCharacter::addPlayerMesh(String meshname, float meshscale, bool rotateModel) 398 { 399 if(!meshLoader) 400 { 401 meshLoader = new Geometry::GeoMeshLoader; 402 trollLODMesh = meshLoader->load("../../Media/MORIA/trollLOD.mesh"); 403 } 404 //clone the mesh 405 Mesh* originalMesh = (Mesh*) MeshManager::getSingleton().getByName(meshname).getPointer(); 406 if(!originalMesh) 407 originalMesh = MeshManager::getSingleton().load("trollLOD.mesh", "GTP_Moria").getPointer(); 408 String newMeshName = (meshname + "_CLONE_" + mName); 409 Ogre::Mesh *newOgreMesh = originalMesh->clone(newMeshName).getPointer(); 410 411 mCharacterMeshEntity = mSceneManager->createEntity(mName, newMeshName); 412 mCharacterMeshEntity->setCastShadows(true); 413 mMeshScale = meshscale; 414 mCurrentAnimState = PLAYERANIMSTATE_STAND; 415 mCharacterMesh_AnimState = mCharacterMeshEntity->getAnimationState(getAnimStateName(PLAYERANIMSTATE_STAND)); 416 mCharacterMesh_AnimState->setEnabled(true); 417 mCharacterMesh_AnimState->setLoop(true); 418 SceneNode* meshNode = mPlayerNode->createChildSceneNode(mName + "_MeshNode"); 419 meshNode->attachObject(mCharacterMeshEntity); 420 meshNode->setPosition(0 ,-mPlayerDimensions.y / 2.0, 0); 421 meshNode->setScale(meshscale, meshscale, meshscale); 422 if(rotateModel) 423 meshNode->rotate(Vector3::UNIT_Y, Degree(180.0)); 424 425 if (!meshLoader->GetLodStripsData()) 426 OGRE_EXCEPT(1, "LOD info for the trunk not found","TrollCharacter::addPlayerMesh"); 427 428 lodObject = new Geometry::LodStripsLibrary(meshLoader->GetLodStripsData(), 429 trollLODMesh, 430 new CustomIndexData(this->mCharacterMeshEntity->getMesh().getPointer())); 431 432 433 } 434 365 435 void PlayerCharacter::addWeaponModel(String meshname, String attachBoneName) 366 436 { … … 460 530 q.FromAxes(right,Vector3::UNIT_Y, dir); 461 531 mPlayerCharacter->setDirection(q); 462 532 533 float dist_min = 2.0; 534 float dist_max = 10.0; 535 float lodLevel; 536 lodLevel = (float)(dist - dist_min) / (float)(dist_max - dist_min); 537 lodLevel = 1.0f - lodLevel; 538 539 if (lodLevel < 0.0f) 540 lodLevel = 0.0f; 541 if (lodLevel > 1.0f) 542 lodLevel = 1.0f; 543 if (fabsf(lastLodLevel-lodLevel)>0.03f || 544 (lastLodLevel > 0.0f && lodLevel == 0.0f) || 545 (lastLodLevel < 1.0f && lodLevel == 1.0f)) 546 { 547 lodObject->GoToLod(lodLevel); 548 lastLodLevel = lodLevel; 549 } 550 463 551 if(dist < 1.8) 464 552 { -
GTP/trunk/App/Demos/Illum/Ogre/src/Moria/include/Moria.h
r2459 r2473 391 391 392 392 TrollCharacter* troll = new TrollCharacter("troll1", NXScene, mSceneMgr, Vector3(1.5, 3.0, 1.2), Vector3(15, 10, 15), false); 393 troll->addPlayerMesh("troll .mesh", 0.05, false);393 troll->addPlayerMesh("trollLOD.mesh", 0.05, false); 394 394 troll->addWeaponModel("trollMace.mesh", "RightHand"); 395 395 -
GTP/trunk/App/Demos/Illum/Ogre/src/Moria/scripts/Moria.7.10.vcproj
r2459 r2473 21 21 Optimization="0" 22 22 ImproveFloatingPointConsistency="TRUE" 23 AdditionalIncludeDirectories="..\include;"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\OgreMain\include";..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderingRuns;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderingRuns;..\..\Common\include;"$(NXOGRE_PATH)\include";"$(PHYSX_DIR)\SDKs\Physics\include";"$(PHYSX_DIR)\SDKs\Foundation\include";"$(PHYSX_DIR)\SDKs\Cooking\include";"$(PHYSX_DIR)\SDKs\NxCharacter\include";"$(PHYSX_DIR)\SDKs\PhysXLoader\include" "23 AdditionalIncludeDirectories="..\include;"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\OgreMain\include";..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderingRuns;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderingRuns;..\..\Common\include;"$(NXOGRE_PATH)\include";"$(PHYSX_DIR)\SDKs\Physics\include";"$(PHYSX_DIR)\SDKs\Foundation\include";"$(PHYSX_DIR)\SDKs\Cooking\include";"$(PHYSX_DIR)\SDKs\NxCharacter\include";"$(PHYSX_DIR)\SDKs\PhysXLoader\include";..\..\..\..\..\..\..\Lib\Geom\shared\GTGeometry\include" 24 24 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE;GTP_VISIBILITY_MODIFIED_OGRE;NXOGRE" 25 25 MinimalRebuild="TRUE" … … 35 35 <Tool 36 36 Name="VCLinkerTool" 37 AdditionalDependencies="OgreMain_d.lib IllumModule_Ogre.lib IllumModule.lib NxOgre_d.lib"37 AdditionalDependencies="OgreMain_d.lib GTGeometry_d.lib IllumModule_Ogre.lib IllumModule.lib NxOgre_d.lib" 38 38 OutputFile="$(OutDir)/Moria.exe" 39 LinkIncremental=" 2"40 AdditionalLibraryDirectories="..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\bin\Debug;"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\bin\Debug;"$(NXOGRE_PATH)/lib" "39 LinkIncremental="1" 40 AdditionalLibraryDirectories="..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\bin\Debug;"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\bin\Debug;"$(NXOGRE_PATH)/lib";"..\..\..\..\..\..\..\Lib\Geom\shared\GTGeometry\build\$(ConfigurationName)"" 41 41 IgnoreDefaultLibraryNames="" 42 42 GenerateDebugInformation="TRUE" … … 84 84 OmitFramePointers="TRUE" 85 85 EnableFiberSafeOptimizations="FALSE" 86 OptimizeForProcessor=" 2"86 OptimizeForProcessor="3" 87 87 OptimizeForWindowsApplication="TRUE" 88 AdditionalIncludeDirectories="..\include;"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\OgreMain\include";..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderingRuns;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderingRuns;..\..\Common\include;"$(NXOGRE_PATH)\include";"$(PHYSX_DIR)\SDKs\Physics\include";"$(PHYSX_DIR)\SDKs\Foundation\include";"$(PHYSX_DIR)\SDKs\Cooking\include";"$(PHYSX_DIR)\SDKs\NxCharacter\include";"$(PHYSX_DIR)\SDKs\PhysXLoader\include" "88 AdditionalIncludeDirectories="..\include;"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\OgreMain\include";..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderingRuns;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderingRuns;..\..\Common\include;"$(NXOGRE_PATH)\include";"$(PHYSX_DIR)\SDKs\Physics\include";"$(PHYSX_DIR)\SDKs\Foundation\include";"$(PHYSX_DIR)\SDKs\Cooking\include";"$(PHYSX_DIR)\SDKs\NxCharacter\include";"$(PHYSX_DIR)\SDKs\PhysXLoader\include";..\..\..\..\..\..\..\Lib\Geom\shared\GTGeometry\include" 89 89 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE;GTP_VISIBILITY_MODIFIED_OGRE;NXOGRE" 90 90 StringPooling="TRUE" … … 102 102 <Tool 103 103 Name="VCLinkerTool" 104 AdditionalDependencies="OgreMain.lib IllumModule_Ogre.lib IllumModule.lib NxOgre.lib"104 AdditionalDependencies="OgreMain.lib GTGeometry.lib IllumModule_Ogre.lib IllumModule.lib NxOgre.lib" 105 105 OutputFile="$(OutDir)/Moria.exe" 106 106 LinkIncremental="1" 107 AdditionalLibraryDirectories="..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\bin\Release;"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\bin\Release;"$(NXOGRE_PATH)\lib"" 107 AdditionalLibraryDirectories="..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\bin\Release;"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\bin\Release;"$(NXOGRE_PATH)\lib";"..\..\..\..\..\..\..\Lib\Geom\shared\GTGeometry\build\$(ConfigurationName)"" 108 IgnoreAllDefaultLibraries="FALSE" 109 IgnoreDefaultLibraryNames="" 108 110 GenerateDebugInformation="FALSE" 109 111 SubSystem="2"
Note: See TracChangeset
for help on using the changeset viewer.