Changeset 3051
- Timestamp:
- 10/20/08 23:37:48 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.cpp
r3042 r3051 55 55 // test if entity belongs to this bucket 56 56 // note: rather slows down the application for some reason!! 57 if (tech->IsAlphaTestEnabled() != mBuckets[idx]->mAlphaTestEnabled) 58 59 60 if (tech->Is CullFaceEnabled() != mBuckets[idx]->mCullFaceEnabled)61 57 if (tech->IsAlphaTestEnabled() != mBuckets[idx]->mAlphaTestEnabled) return false; 58 if (tech->IsCullFaceEnabled() != mBuckets[idx]->mCullFaceEnabled) return false; 59 if (tech->IsColorWriteEnabled() != mBuckets[idx]->mColorWriteEnabled) return false; 60 if (tech->IsLightingEnabled() != mBuckets[idx]->mLightingEnabled) return false; 61 if (tech->IsDepthWriteEnabled() != mBuckets[idx]->mDepthWriteEnabled) return false; 62 62 63 63 const bool hasTexture = (tech->GetTexture() != NULL); … … 68 68 if (hasTexture) 69 69 { 70 if (tech->GetTexture()->GetWidth() != mBuckets[idx]->mTexWidth) 71 return false; 72 73 if (tech->GetTexture()->GetHeight() != mBuckets[idx]->mTexHeight) 74 return false; 75 } 70 if (tech->GetTexture()->GetWidth() != mBuckets[idx]->mTexWidth) return false; 71 if (tech->GetTexture()->GetHeight() != mBuckets[idx]->mTexHeight) return false; 72 if (tech->GetTexture()->GetFormat() != mBuckets[idx]->mTexFormat) return false; 73 } 74 75 if ((tech->GetFragmentProgram() != NULL) && mBuckets[idx]->mHasFragmentProgram) return false; 76 if ((tech->GetVertexProgram() != NULL) && mBuckets[idx]->mHasVertexProgram) return false; 77 76 78 77 79 return true; … … 124 126 bucket->mCullFaceEnabled = tech->IsCullFaceEnabled(); 125 127 126 const bool hasTexture = (tech->GetTexture() != NULL); 127 128 bucket->mHasTexture = hasTexture; 129 130 bucket->mTexWidth = hasTexture ? tech->GetTexture()->GetWidth() : 0; 131 bucket->mTexHeight = hasTexture ? tech->GetTexture()->GetHeight() : 0; 128 bucket->mColorWriteEnabled = tech->IsColorWriteEnabled(); 129 bucket->mLightingEnabled = tech->IsLightingEnabled(); 130 bucket->mDepthWriteEnabled = tech->IsDepthWriteEnabled(); 131 132 133 Texture *tex = tech->GetTexture(); 134 135 if (tex != NULL) 136 { 137 bucket->mHasTexture = true; 138 139 bucket->mTexWidth = tex->GetWidth(); 140 bucket->mTexHeight = tex->GetHeight(); 141 142 bucket->mTexFormat = tex->GetFormat(); 143 } 144 else 145 { 146 bucket->mHasTexture = false; 147 148 bucket->mTexWidth = 0; 149 bucket->mTexHeight = 0; 150 bucket->mTexFormat = 0; 151 } 152 153 bucket->mHasVertexProgram = tech->GetVertexProgram() != NULL; 154 bucket->mHasFragmentProgram = tech->GetFragmentProgram() != NULL; 132 155 133 156 mBuckets.push_back(bucket); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.h
r2848 r3051 17 17 struct RenderQueueBucket 18 18 { 19 / ** should test for all texture format parameters,20 but we as use the same format for all textures they differ only in size21 */19 //////// 20 //-- the attributes used to sort the materials 21 /// texture parameters 22 22 int mTexHeight; 23 23 int mTexWidth; 24 int mTexFormat; 24 25 25 26 bool mHasTexture; 27 28 bool mColorWriteEnabled; 29 bool mDepthWriteEnabled; 30 bool mLightingEnabled; 31 26 32 bool mAlphaTestEnabled; 27 33 bool mCullFaceEnabled; 34 35 bool mHasVertexProgram; 36 bool mHasFragmentProgram; 28 37 29 38 /// minimal distance to the camera 30 39 float mMinDistance; 31 40 41 /// the shapes that belong to a bucket 32 42 ShapeContainer mShapes; 33 43 }; … … 36 46 /** This class implements a render queue that sorts renderable geometry in order 37 47 to minimize state changes while approximately keeping front-to-back order 38 The implementation roughly follows the suggested implemen ation on Tom Forsyth's article39 on render state changes. It requires sorting only on bucket level and therefore has very40 low overhead48 The implementation roughly follows the suggested implementation in 49 Tom Forsyth's article on render state changes. It requires sorting only on 50 bucket level and therefore has very low overhead. 41 51 */ 42 52 class RenderQueue -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3050 r3051 1012 1012 // this would conveniently solves some issues (e.g, skys without shadows) 1013 1013 1014 //RenderSky();1014 RenderSky(); 1015 1015 1016 1016
Note: See TracChangeset
for help on using the changeset viewer.