Changeset 193 for trunk/VUT/work/ogre_changes/OgreMain
- Timestamp:
- 08/03/05 14:12:41 (19 years ago)
- Location:
- trunk/VUT/work/ogre_changes/OgreMain
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/ogre_changes/OgreMain/include/OgreRenderQueueSortingGrouping.h
r139 r193 48 48 objects. 49 49 */ 50 class RenderPriorityGroup 50 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 51 class _OgreExport RenderPriorityGroup 52 #else 53 class _OgrePrivate RenderPriorityGroup 54 #endif // GTP_VISIBILITY_MODIFIED_OGRE 51 55 { 52 56 /** Internal struct reflecting a single Pass for a Renderable. … … 247 251 This is an internal OGRE class, not intended for apps to use. 248 252 */ 249 class RenderQueueGroup253 class _OgrePrivate RenderQueueGroup 250 254 { 251 255 public: -
trunk/VUT/work/ogre_changes/OgreMain/include/OgreRenderSystem.h
r150 r193 318 318 Values: true, false 319 319 Default: 0 320 ** 321 Key: "border" 322 Description: The type of window border (in windowed mode) 323 Values: none, fixed, resize 324 Default: resize 325 ** 326 Key: "outerDimensions" 327 Description: Whether the width/height is expressed as the size of the 328 outer window, rather than the content area 329 Values: true, false 330 Default: false 320 331 */ 321 332 virtual RenderWindow* createRenderWindow(const String &name, unsigned int width, unsigned int height, … … 980 991 bool mInvertVertexWinding; 981 992 993 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 982 994 int mColour[4]; 995 #endif // GTP_VISIBILITY_MODIFIED_OGRE 983 996 }; 984 997 } -
trunk/VUT/work/ogre_changes/OgreMain/include/OgreRenderable.h
r158 r193 53 53 { 54 54 public: 55 Renderable() {mId = -1;} 55 Renderable() : mRenderDetailOverrideable(true) 56 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 57 , mId(-1) 58 #endif // GTP_VISIBILITY_MODIFIED_OGRE 59 {} 60 56 61 /** Virtual destructor needed as class has virtual methods. */ 57 62 virtual ~Renderable() { } … … 227 232 } 228 233 } 234 235 /** Sets whether this renderable's chosen detail level can be 236 overridden (downgraded) by the camera setting. 237 @param override true means that a lower camera detail will override this 238 renderables detail level, false means it won't. 239 */ 240 virtual void setRenderDetailOverrideable(bool override) 241 { 242 mRenderDetailOverrideable = override; 243 } 244 245 /** Gets whether this renderable's chosen detail level can be 246 overridden (downgraded) by the camera setting. 247 */ 248 virtual bool getRenderDetailOverrideable(void) const 249 { 250 return mRenderDetailOverrideable; 251 } 252 253 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 229 254 /** Sets an id for this renderable. 230 255 */ … … 233 258 */ 234 259 int getId() {return mId;} 235 260 #endif // GTP_VISIBILITY_MODIFIED_OGRE 236 261 protected: 237 262 static const PlaneList msDummyPlaneList; 238 263 typedef std::map<size_t, Vector4> CustomParameterMap; 239 264 CustomParameterMap mCustomParameters; 265 bool mRenderDetailOverrideable; 266 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 240 267 int mId; 268 #endif // GTP_VISIBILITY_MODIFIED_OGRE 241 269 }; 242 270 -
trunk/VUT/work/ogre_changes/OgreMain/src/OgreFrustum.cpp
r61 r193 496 496 updateFrustum(); 497 497 498 Vector3 newpos = position; 499 if (mReflect) 500 { 501 newpos = mReflectMatrix * newpos; 502 } 498 503 Matrix4 combo = mStandardProjMatrix * mViewMatrix; 499 504 mFrustumPlanes[FRUSTUM_PLANE_LEFT].normal.x = combo[3][0] + combo[0][0]; … … 520 525 mFrustumPlanes[FRUSTUM_PLANE_NEAR].normal.y = combo[3][1] + combo[2][1]; 521 526 mFrustumPlanes[FRUSTUM_PLANE_NEAR].normal.z = combo[3][2] + combo[2][2]; 522 mFrustumPlanes[FRUSTUM_PLANE_NEAR].d = combo[3][3] + combo[2][3]; 527 mFrustumPlanes[FRUSTUM_PLANE_NEAR].normal.normalise(); 528 mFrustumPlanes[FRUSTUM_PLANE_NEAR].d = 529 -(mFrustumPlanes[FRUSTUM_PLANE_NEAR].normal.dotProduct(newpos) + mNearDist); 523 530 524 531 mFrustumPlanes[FRUSTUM_PLANE_FAR].normal.x = combo[3][0] - combo[2][0]; 525 532 mFrustumPlanes[FRUSTUM_PLANE_FAR].normal.y = combo[3][1] - combo[2][1]; 526 533 mFrustumPlanes[FRUSTUM_PLANE_FAR].normal.z = combo[3][2] - combo[2][2]; 527 mFrustumPlanes[FRUSTUM_PLANE_FAR].d = combo[3][3] - combo[2][3]; 528 529 // Renormalise any normals which were not unit length 530 for(int i=0; i<6; i++ ) 534 mFrustumPlanes[FRUSTUM_PLANE_FAR].normal.normalise(); 535 mFrustumPlanes[FRUSTUM_PLANE_FAR].d = 536 -(mFrustumPlanes[FRUSTUM_PLANE_FAR].normal.dotProduct(newpos) - mFarDist); 537 538 // Renormalise any normals which were not unit length (not near & far) 539 for(int i=2; i<6; i++ ) 531 540 { 532 541 float length = mFrustumPlanes[i].normal.normalise(); -
trunk/VUT/work/ogre_changes/OgreMain/src/OgreSceneManager.cpp
r183 r193 130 130 mShadowCasterQueryListener = new ShadowCasterSceneQueryListener(this); 131 131 132 132 Root *root = Root::getSingletonPtr(); 133 if (root) 134 _setDestinationRenderSystem(root->getRenderSystem()); 133 135 } 134 136 //----------------------------------------------------------------------- … … 392 394 // Calc squared distance 393 395 lt->tempSquareDist = (lt->getDerivedPosition() - position).squaredLength(); 394 lt->tempSquareDist -= squaredRadius;395 396 // only add in-range lights 396 397 Real range = lt->getAttenuationRange(); 397 if ( lt->tempSquareDist<= (range * range))398 if ((lt->tempSquareDist - squaredRadius) <= (range * range)) 398 399 { 399 400 destList.push_back(lt); … … 403 404 } 404 405 405 // Sort 406 std::s ort(destList.begin(), destList.end(), lightLess());406 // Sort (stable to guarantee ordering on directional lights) 407 std::stable_sort(destList.begin(), destList.end(), lightLess()); 407 408 408 409 … … 527 528 { 528 529 removeAllStaticGeometry(); 530 removeAllEntities(); 531 removeAllBillboardSets(); 532 removeAllLights(); 533 534 // Clear root node of all children 535 mSceneRoot->removeAllChildren(); 536 mSceneRoot->detachAllObjects(); 537 529 538 // Delete all SceneNodes, except root that is 530 539 for (SceneNodeList::iterator i = mSceneNodes.begin(); … … 536 545 mAutoTrackingSceneNodes.clear(); 537 546 538 // Clear root node of all children 539 mSceneRoot->removeAllChildren(); 540 mSceneRoot->detachAllObjects(); 541 542 removeAllEntities(); 543 removeAllBillboardSets(); 544 removeAllLights(); 547 545 548 546 549 // Clear animations … … 607 610 } 608 611 612 // detach from parent (don't do this in destructor since bulk destruction 613 // behaves differently) 614 Node* parentNode = i->second->getParent(); 615 if (parentNode) 616 { 617 parentNode->removeChild(i->second); 618 } 609 619 delete i->second; 610 620 mSceneNodes.erase(i); … … 646 656 647 657 // TEST 648 649 //LogManager::getSingleton().logMessage("BEGIN PASS " + StringConverter::toString(pass->getIndex()) +650 //" of " + pass->getParent()->getParent()->getName() + "\n");651 658 /* 659 LogManager::getSingleton().logMessage("BEGIN PASS " + StringConverter::toString(pass->getIndex()) + 660 " of " + pass->getParent()->getParent()->getName()); 661 */ 652 662 bool passSurfaceAndLightParams = true; 653 663 … … 868 878 // Tell params about current ambient light 869 879 mAutoParamDataSource.setAmbientLightColour(mAmbientLight); 880 // Tell rendersystem 881 mDestRenderSystem->setAmbientLight(mAmbientLight.r, mAmbientLight.g, mAmbientLight.b); 870 882 871 883 // Tell params about render target … … 1540 1552 renderShadowVolumesToStencil(l, mCameraInProgress); 1541 1553 // render full-screen shadow modulator for all lights 1542 //LogManager::getSingleton().logMessage("setting shadow modulative pass");1543 1554 setPass(mShadowModulativePass); 1544 1555 // turn stencil check on … … 1801 1812 continue; 1802 1813 1803 //LogManager::getSingleton().logMessage("setting solid pass");1804 1814 // For solids, we try to do each pass in turn 1805 1815 Pass* usedPass = setPass(ipass->first); … … 1832 1842 itrans != itransend; ++itrans) 1833 1843 { 1834 //LogManager::getSingleton().logMessage("setting transparent pass");1835 1844 // For transparents, we have to accept that we can't sort entirely by pass 1836 1845 setPass(itrans->pass); … … 1909 1918 1910 1919 itransend = objs.end(); 1911 for (itrans = objs.begin(); itrans != itransend; ++itrans) 1920 for (itrans = objs.begin(); 1921 itrans != itransend; ++itrans) 1912 1922 { 1913 1923 Renderable *r = itrans->renderable; … … 1917 1927 if (p->getParent()->getParent()->getTransparencyCastsShadows()) 1918 1928 { 1919 //LogManager::getSingleton().logMessage("setting transparent shadow pass");1920 1929 setPass(p); 1921 1930 renderSingleObject(itrans->renderable, p, doLightIteration, manualLightList); … … 1930 1939 unsigned short numMatrices; 1931 1940 static bool normalisedNormals = false; 1932 staticSceneDetailLevel camDetailLevel = mCameraInProgress->getDetailLevel();1941 SceneDetailLevel camDetailLevel = mCameraInProgress->getDetailLevel(); 1933 1942 static SceneDetailLevel lastDetailLevel = camDetailLevel; 1934 1943 static RenderOperation ro; … … 1981 1990 // Set up the solid / wireframe override 1982 1991 SceneDetailLevel reqDetail = rend->getRenderDetail(); 1983 if (reqDetail != lastDetailLevel || reqDetail != camDetailLevel) 1984 { 1992 if (rend->getRenderDetailOverrideable()) 1993 { 1994 // check camera detial only when render detail is overridable 1985 1995 if (reqDetail > camDetailLevel) 1986 1996 { … … 1988 1998 reqDetail = camDetailLevel; 1989 1999 } 2000 } 2001 if (reqDetail != lastDetailLevel) 2002 { 1990 2003 mDestRenderSystem->_setRasterisationMode(reqDetail); 1991 2004 lastDetailLevel = reqDetail; … … 2416 2429 mDestRenderSystem->_beginFrame(); 2417 2430 2418 //LogManager::getSingleton().logMessage("setting manual pass");2419 2431 setPass(pass); 2420 2432 mDestRenderSystem->_render(*rend); … … 2814 2826 void SceneManager::initShadowVolumeMaterials(void) 2815 2827 { 2828 /* This should have been set in the SceneManager constructor, but if you 2829 created the SceneManager BEFORE the Root object, you will need to call 2830 SceneManager::_setDestinationRenderSystem manually. 2831 */ 2832 assert( mDestRenderSystem ); 2816 2833 2817 2834 if (mShadowMaterialInitDone) … … 3012 3029 Pass* SceneManager::deriveShadowCasterPass(Pass* pass) 3013 3030 { 3014 //LogManager::getSingleton().logMessage("*********derive shadow caster pass*********");3015 3031 switch (mShadowTechnique) 3016 3032 { … … 3018 3034 if (mShadowTextureCustomCasterPass) 3019 3035 { 3020 //LogManager::getSingleton().logMessage("custom caster pass");3021 3036 // Caster pass has been customised 3022 3037 3023 3038 if (!pass->getShadowCasterVertexProgramName().empty()) 3024 3039 { 3025 //LogManager::getSingleton().logMessage("custom caster pass has vertex program");3026 3040 // Have to merge the shadow caster vertex program in 3027 3041 mShadowTextureCustomCasterPass->setVertexProgram( … … 3040 3054 else if (mShadowTextureCasterVPDirty) 3041 3055 { 3042 //LogManager::getSingleton().logMessage("caster pass dirty");3043 3056 // reset 3044 3057 mShadowTextureCustomCasterPass->setVertexProgram( … … 3056 3069 else 3057 3070 { 3058 //LogManager::getSingleton().logMessage("standard caster pass");3059 3071 // Standard pass 3060 3072 if (pass->hasVertexProgram()) 3061 3073 { 3062 //LogManager::getSingleton().logMessage("standard caster pass has vertex program");3063 3074 // Have to merge the shadow caster vertex program in 3064 3075 // This may in fact be blank, in which case it falls back on … … 3081 3092 else if (mShadowCasterPlainBlackPass->hasVertexProgram()) 3082 3093 { 3083 //LogManager::getSingleton().logMessage("standard caster pass no vertex program");3084 3094 // reset 3085 3095 mShadowCasterPlainBlackPass->setVertexProgram(""); … … 3095 3105 Pass* SceneManager::deriveShadowReceiverPass(Pass* pass) 3096 3106 { 3097 //LogManager::getSingleton().logMessage("*********derive shadow receiver pass*********"); 3107 3098 3108 switch (mShadowTechnique) 3099 3109 { … … 3102 3112 { 3103 3113 // Receiver pass has been customised 3104 //LogManager::getSingleton().logMessage("custom receiver pass"); 3114 3105 3115 if (!pass->getShadowReceiverVertexProgramName().empty()) 3106 3116 { 3107 //LogManager::getSingleton().logMessage("merge receiver pass shadow vertex program");3108 3117 // Have to merge the shadow Receiver vertex program in 3109 3118 mShadowTextureCustomReceiverPass->setVertexProgram( … … 3122 3131 else if (mShadowTextureReceiverVPDirty) 3123 3132 { 3124 //LogManager::getSingleton().logMessage("receiver pass dirty");3125 3133 // reset 3126 3134 mShadowTextureCustomReceiverPass->setVertexProgram( … … 3138 3146 else 3139 3147 { 3140 //LogManager::getSingleton().logMessage("no custom receiver pass");3141 3148 if (pass->hasVertexProgram()) 3142 3149 { 3143 //LogManager::getSingleton().logMessage("standard receiver pass has vertex program");3144 3150 // Have to merge the receiver vertex program in 3145 3151 // This may return "" which means fixed function will be used … … 3161 3167 else if (mShadowReceiverPass->hasVertexProgram()) 3162 3168 { 3163 //LogManager::getSingleton().logMessage("standard receiver pass no vertex program");3164 3169 // reset 3165 3170 mShadowReceiverPass->setVertexProgram(""); … … 3383 3388 setColourOperationEx(LBX_MODULATE, LBS_MANUAL, LBS_CURRENT, 3384 3389 zfailAlgo ? ColourValue(0.7, 0.0, 0.2) : ColourValue(0.0, 0.7, 0.2)); 3385 //LogManager::getSingleton().logMessage("setting shadow debug pass");3386 3390 setPass(mShadowDebugPass); 3387 3391 renderShadowVolumeObjects(iShadowRenderables, mShadowDebugPass, &lightList, flags,
Note: See TracChangeset
for help on using the changeset viewer.