- Timestamp:
- 10/17/08 01:08:42 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3035 r3036 382 382 sCgDeferredShadowProgram->AddParameter("weights", 9); 383 383 384 sCgCombineIllumProgram->AddParameter("colors", 0); 385 sCgCombineIllumProgram->AddParameter("ssaoTex", 1); 386 sCgCombineIllumProgram->AddParameter("illumTex", 2); 387 388 sCgCombineSsaoProgram->AddParameter("colors", 0); 389 sCgCombineSsaoProgram->AddParameter("ssaoTex", 1); 390 sCgCombineSsaoProgram->AddParameter("filterOffs", 2); 391 sCgCombineSsaoProgram->AddParameter("filterWeights", 3); 392 384 393 385 394 float filterWeights[NUM_PCF_TABS]; … … 726 735 glDrawBuffers(1, mrt + colorBufferIdx); 727 736 728 sCgCombineIllumProgram->SetTexture( "colors", colorsTex);729 sCgCombineIllumProgram->SetTexture( "ssaoTex", ssaoTex);730 sCgCombineIllumProgram->SetTexture( "illumTex", illumTex);737 sCgCombineIllumProgram->SetTexture(0, colorsTex); 738 sCgCombineIllumProgram->SetTexture(1, ssaoTex); 739 sCgCombineIllumProgram->SetTexture(2, illumTex); 731 740 732 741 DrawQuad(sCgCombineIllumProgram); … … 769 778 } 770 779 771 //ComputeSampleOffsets(filterOffsets, fbo->GetWidth(), fbo->GetHeight());772 sCgCombineSsaoProgram->Set Array2f("filterOffs", (float *)filterOffsets, NUM_DOWNSAMPLES);773 sCgCombineSsaoProgram->Set Array1f("filterWeights", (float *)filterWeights, NUM_DOWNSAMPLES);774 775 sCgCombineSsaoProgram->Set Texture("colors", colorsTex);776 sCgCombineSsaoProgram->Set Texture("ssaoTex", ssaoTex);780 781 sCgCombineSsaoProgram->SetTexture(0, colorsTex); 782 sCgCombineSsaoProgram->SetTexture(1, ssaoTex); 783 784 sCgCombineSsaoProgram->SetArray2f(2, (float *)filterOffsets, NUM_DOWNSAMPLES); 785 sCgCombineSsaoProgram->SetArray1f(3, (float *)filterWeights, NUM_DOWNSAMPLES); 777 786 778 787 DrawQuad(sCgCombineSsaoProgram); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Material.cpp
r3034 r3036 44 44 Material::~Material() 45 45 { 46 DEL_PTR(mGPUFragmentParameters);47 DEL_PTR(mGPUVertexParameters);46 //DEL_PTR(mGPUFragmentParameters); 47 //DEL_PTR(mGPUVertexParameters); 48 48 } 49 49 … … 93 93 94 94 95 void Material::SetFragmentProgram(ShaderProgram *p) 96 { 97 mFragmentProgram = p; 98 99 mGPUFragmentParameters->Reset(); 100 mGPUFragmentParameters->SetProgram(p); 95 101 } 102 103 104 void Material::SetVertexProgram(ShaderProgram *p) 105 { 106 mVertexProgram = p; 107 108 mGPUVertexParameters->Reset(); 109 mGPUVertexParameters->SetProgram(p); 110 } 111 112 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Material.h
r3034 r3036 80 80 void InitMaterial(); 81 81 82 GPUProgramParameters *mGPUVertexParameters;83 GPUProgramParameters *mGPUFragmentParameters;82 void SetFragmentProgram(ShaderProgram *p); 83 void SetVertexProgram(ShaderProgram *p); 84 84 85 ShaderProgram *mFragmentProgram; 86 ShaderProgram *mVertexProgram; 85 ShaderProgram *GetFragmentProgram() { return mFragmentProgram; } 86 ShaderProgram *GetVertexProgram() { return mVertexProgram; } 87 88 void SetFragmentProgramParameters(GPUProgramParameters *p) { mGPUFragmentParameters = p; } 89 void SetVertexProgramParameters(GPUProgramParameters *p) { mGPUVertexParameters = p; } 90 91 GPUProgramParameters *GetFragmentProgramParameters() { return mGPUFragmentParameters; } 92 GPUProgramParameters *GetVertexProgramParameters() { return mGPUVertexParameters; } 93 87 94 88 95 protected: … … 99 106 /// the associated texture 100 107 Texture *mTexture; 108 109 GPUProgramParameters *mGPUVertexParameters; 110 GPUProgramParameters *mGPUFragmentParameters; 111 112 ShaderProgram *mFragmentProgram; 113 ShaderProgram *mVertexProgram; 101 114 }; 102 115 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.cpp
r3034 r3036 152 152 if (mRenderType == DEFERRED) 153 153 { 154 if (mat-> mFragmentProgram && (mat->mFragmentProgram!= mCurrentFragmentProgram))155 { 156 mCurrentFragmentProgram = mat-> mFragmentProgram;154 if (mat->GetFragmentProgram() && (mat->GetFragmentProgram() != mCurrentFragmentProgram)) 155 { 156 mCurrentFragmentProgram = mat->GetFragmentProgram(); 157 157 mCurrentFragmentProgram->Bind(); 158 158 } 159 159 160 if (mat-> mVertexProgram && (mat->mVertexProgram!= mCurrentVertexProgram))161 { 162 mCurrentVertexProgram = mat-> mVertexProgram;160 if (mat->GetVertexProgram() && (mat->GetVertexProgram() != mCurrentVertexProgram)) 161 { 162 mCurrentVertexProgram = mat->GetVertexProgram(); 163 163 mCurrentVertexProgram->Bind(); 164 164 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3034 r3036 43 43 CLEAR_CONTAINER(mShapes); 44 44 CLEAR_CONTAINER(mLODs); 45 CLEAR_CONTAINER(mGPUParameters); 45 46 } 46 47 … … 206 207 mat->mFragmentProgram = RenderState::sCgMrtFragmentTexProgram; 207 208 208 mat->mGPUFragmentParameters = newGPUProgramParameters(mat->mFragmentProgram);209 mat->mGPUFragmentParameters = CreateGPUProgramParameters(mat->mFragmentProgram); 209 210 mat->mGPUFragmentParameters->SetTexture(0, mat->GetTexture()->GetId()); 210 211 } … … 212 213 { 213 214 mat->mFragmentProgram = RenderState::sCgMrtFragmentProgram; 214 mat->mGPUFragmentParameters = newGPUProgramParameters(mat->mFragmentProgram);215 } 216 217 mat->mGPUVertexParameters = newGPUProgramParameters(RenderState::sCgMrtVertexProgram);215 mat->mGPUFragmentParameters = CreateGPUProgramParameters(mat->mFragmentProgram); 216 } 217 218 mat->mGPUVertexParameters = CreateGPUProgramParameters(RenderState::sCgMrtVertexProgram); 218 219 219 220 return mat; … … 314 315 } 315 316 316 } 317 318 GPUProgramParameters *ResourceManager::CreateGPUProgramParameters(ShaderProgram *p) 319 { 320 GPUProgramParameters *gpuParams = new GPUProgramParameters(p); 321 mGPUParameters.push_back(gpuParams); 322 323 return gpuParams; 324 } 325 326 } 327 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h
r3020 r3036 23 23 class Matrix4x4; 24 24 class Transform3; 25 class ShaderProgram; 26 class GPUProgramParameters; 25 27 26 28 … … 37 39 38 40 int GetNumEntities() const { return (int)mSceneEntities.size(); } 41 42 /** Creates new gpu program parameters. 43 */ 44 GPUProgramParameters *CreateGPUProgramParameters(ShaderProgram *p); 39 45 40 46 protected: … … 54 60 55 61 // these are kept to be able to delete these resources afterwards 56 std::vector<Texture *> mTextures; 57 std::vector<Material *> mMaterials; 58 std::vector<Geometry *> mGeometry; 59 std::vector<Transform3 *> mTrafos; 60 62 TextureContainer mTextures; 63 MaterialContainer mMaterials; 64 GeometryContainer mGeometry; 65 TransformContainer mTrafos; 66 GPUParamContainer mGPUParameters; 67 61 68 ShapeContainer mShapes; 62 69 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderProgram.cpp
r3034 r3036 14 14 } 15 15 16 17 void GPUProgramParameters::Reset() 18 { 19 mFloats.clear(); 20 mTextures.clear(); 21 mMatrices.clear(); 22 mArrays.clear(); 23 } 24 25 16 26 void GPUProgramParameters::SetValue1f(int idx, float value) 17 27 { 28 if (mFloats.size() < idx + 1) 29 mFloats.resize(idx + 1); 30 31 mFloats[idx] = FloatParam(&value, 1); 18 32 } 19 33 … … 21 35 void GPUProgramParameters::SetValue2f(int idx, float val1, float val2) 22 36 { 23 } 24 25 26 void GPUProgramParameters::SetValue3f(int idx, float val1, float val, float val3) 27 { 37 if (mFloats.size() < idx + 1) 38 mFloats.resize(idx + 1); 39 40 float vals[] = {val1, val2}; 41 42 mFloats[idx] = FloatParam(vals, 2); 43 } 44 45 46 void GPUProgramParameters::SetValue3f(int idx, float val1, float val2, float val3) 47 { 48 if (mFloats.size() < idx + 1) 49 mFloats.resize(idx + 1); 50 51 float vals[] = {val1, val2, val3}; 52 53 mFloats[idx] = FloatParam(vals, 3); 28 54 } 29 55 … … 31 57 void GPUProgramParameters::SetArray1f(int idx, float *vals, int numElements) 32 58 { 59 if (mArrays.size() < idx + 1) 60 mArrays.resize(idx + 1); 61 62 mArrays[idx] = ArrayParam(vals, 1, numElements); 33 63 } 34 64 … … 36 66 void GPUProgramParameters::SetArray2f(int idx, float *vals, int numElements) 37 67 { 68 if (mArrays.size() < idx + 1) 69 mArrays.resize(idx + 1); 70 71 mArrays[idx] = ArrayParam(vals, 2, numElements); 38 72 } 39 73 … … 41 75 void GPUProgramParameters::SetArray3f(int idx, float *vals, int numElements) 42 76 { 77 if (mArrays.size() < idx + 1) 78 mArrays.resize(idx + 1); 79 80 mArrays[idx] = ArrayParam(vals, 3, numElements); 43 81 } 44 82 … … 46 84 void GPUProgramParameters::SetTexture(int idx, unsigned int tex) 47 85 { 48 mTextures.push_back(IntParam(idx, tex)); 86 if (mTextures.size() < idx + 1) 87 mTextures.resize(idx + 1); 88 89 mTextures[idx] = IntParam(tex); 49 90 } 50 91 … … 52 93 void GPUProgramParameters::SetMatrix(int idx, Matrix4x4 *mat) 53 94 { 95 if (mMatrices.size() < idx + 1) 96 mMatrices.resize(idx + 1); 97 98 mMatrices[idx] = MatrixParam(mat); 54 99 } 55 100 … … 105 150 void GPUProgramParameters::UpdateParameters() 106 151 { 107 for ( size_t i = 0; i <mFloats.size(); ++ i)152 for (int i = 0; i < (int)mFloats.size(); ++ i) 108 153 { 109 154 const FloatParam &p = mFloats[i]; 155 156 if (!p.mValid) continue; 110 157 111 158 switch (p.mNumComponents) 112 159 { 113 160 case 1: 114 mProgram->SetValue1f( p.mIndex, p.mValues[0]);161 mProgram->SetValue1f(i, p.mValues[0]); 115 162 break; 116 163 case 2: 117 mProgram->SetValue2f( p.mIndex, p.mValues[0], p.mValues[1]);164 mProgram->SetValue2f(i, p.mValues[0], p.mValues[1]); 118 165 break; 119 166 case 3: 120 mProgram->SetValue3f( p.mIndex, p.mValues[0], p.mValues[1], p.mValues[2]);167 mProgram->SetValue3f(i, p.mValues[0], p.mValues[1], p.mValues[2]); 121 168 break; 122 169 default: 123 mProgram->SetValue1f( p.mIndex, p.mValues[0]);170 mProgram->SetValue1f(i, p.mValues[0]); 124 171 } 125 172 } 126 173 127 for ( size_t i = 0; i <mTextures.size(); ++ i)174 for (int i = 0; i < (int)mTextures.size(); ++ i) 128 175 { 129 176 const IntParam &p = mTextures[i]; 130 mProgram->SetTexture(p.mIndex, p.mValue); 131 } 132 133 for (size_t i = 0; i < mMatrices.size(); ++ i) 177 178 if (p.mValid) 179 mProgram->SetTexture(i, p.mValue); 180 } 181 182 for (int i = 0; i < (int)mMatrices.size(); ++ i) 134 183 { 135 184 const MatrixParam &p = mMatrices[i]; 136 mProgram->SetMatrix(p.mIndex, *p.mValue); 185 186 if (p.mValid) 187 mProgram->SetMatrix(i, *p.mValue); 188 } 189 190 for (int i = 0; i < (int)mArrays.size(); ++ i) 191 { 192 const ArrayParam &p = mArrays[i]; 193 194 if (!p.mValid) continue; 195 196 switch (p.mNumComponents) 197 { 198 case 1: 199 mProgram->SetArray1f(i, p.mValues, p.mNumEntries); 200 break; 201 case 2: 202 mProgram->SetArray2f(i, p.mValues, p.mNumEntries); 203 break; 204 case 3: 205 mProgram->SetArray3f(i, p.mValues, p.mNumEntries); 206 break; 207 default: 208 mProgram->SetArray1f(i, p.mValues, p.mNumEntries); 209 } 137 210 } 138 211 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderProgram.h
r3034 r3036 36 36 public: 37 37 38 /** Constructor which initialized this parameter set for a given program. 39 */ 40 GPUProgramParameters(ShaderProgram *p); 41 42 void SetProgram(ShaderProgram *p) { mProgram = p; } 43 /** Resets this parameter set. 44 */ 45 void Reset(); 46 47 38 48 /////////// 39 49 //-- set parameters by index … … 66 76 void SetArray2f(const std::string &name, float *vals, int numElements); 67 77 void SetArray3f(const std::string &name, float *vals, int numElements); 68 69 78 /** Sets the texture parameter. 70 79 */ … … 76 85 */ 77 86 void UpdateParameters(); 78 79 80 GPUProgramParameters(ShaderProgram *p); 81 87 82 88 83 89 protected: … … 85 91 struct FloatParam 86 92 { 87 int mIndex; 93 FloatParam(): mValid(false), mNumComponents(0) {} 94 95 FloatParam(float *val, int comp): 96 mNumComponents(comp), mValid(true) 97 { 98 for (int i = 0; i < mNumComponents; ++ i) 99 { 100 mValues[i] = val[i]; 101 } 102 } 103 104 bool mValid; 88 105 float mValues[4]; 89 106 int mNumComponents; … … 92 109 struct IntParam 93 110 { 94 IntParam(int idx, float val): mIndex(idx), mValue(val) {} 95 96 int mIndex; 111 IntParam(): mValid(false) {} 112 IntParam(float val): mValue(val), mValid(true) {} 113 114 bool mValid; 97 115 float mValue; 98 116 }; … … 100 118 struct MatrixParam 101 119 { 102 int mIndex; 120 MatrixParam(): mValue(NULL), mValid(false) {} 121 122 MatrixParam(Matrix4x4 *mat): mValue(mat), mValid(true) 123 {} 124 125 bool mValid; 103 126 Matrix4x4 *mValue; 104 127 }; … … 106 129 struct ArrayParam 107 130 { 108 int mIndex; 109 131 ArrayParam(): mValues(NULL), mNumEntries(0), mNumComponents(0), mValid(false) {} 132 ArrayParam(float *val, int comp, int numEntries): 133 mValues(val), mNumComponents(comp), mNumEntries(numEntries), mValid(true) 134 {} 135 136 bool mValid; 110 137 float *mValues; 138 111 139 int mNumEntries; 112 113 140 int mNumComponents; 114 141 }; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp
r3021 r3036 6 6 #include "Camera.h" 7 7 #include "RenderState.h" 8 #include "ShaderProgram.h" 9 #include "Shape.h" 10 #include "Material.h" 8 11 9 12 … … 23 26 24 27 25 static CGprogram sCgSkyProgram = NULL; 26 static CGprogram sCgMrtFragmentSkyDomeProgram = NULL; 27 28 29 static CGparameter sLightDirParam; 30 static CGparameter sThetaSunParam; 31 static CGparameter sZenithColorParam; 32 static CGparameter sAColorParam; 33 static CGparameter sBColorParam; 34 static CGparameter sCColorParam; 35 static CGparameter sDColorParam; 36 static CGparameter sEColorParam; 37 static CGparameter sMultiplierParam; 28 static ShaderProgram *sCgSkyProgram = NULL; 29 static ShaderProgram *sCgMrtFragmentSkyDomeProgram = NULL; 38 30 39 31 ShaderContainer SkyPreetham::sShaders; … … 54 46 void SkyPreetham::InitCG(CGcontext context) 55 47 { 56 ShaderProgram *pr; 57 58 sCgSkyProgram = 59 cgCreateProgramFromFile(context, 60 CG_SOURCE, 61 "src/shaders/sky_preetham.cg", 62 RenderState::sCgVertexProfile, 63 "default_vs", 64 NULL); 65 66 if (sCgSkyProgram != NULL) 48 sCgSkyProgram = new ShaderProgram(context, 49 "src/shaders/sky_preetham.cg", 50 RenderState::sCgVertexProfile, 51 "default_vs"); 52 53 if (sCgSkyProgram->IsValid()) 67 54 { 68 cgGLLoadProgram(sCgSkyProgram); 69 70 sLightDirParam = cgGetNamedParameter(sCgSkyProgram, "lightDir"); 71 sThetaSunParam = cgGetNamedParameter(sCgSkyProgram, "thetaSun"); 72 sZenithColorParam = cgGetNamedParameter(sCgSkyProgram, "zenithColor"); 73 sAColorParam = cgGetNamedParameter(sCgSkyProgram, "aColor"); 74 sBColorParam = cgGetNamedParameter(sCgSkyProgram, "bColor"); 75 sCColorParam = cgGetNamedParameter(sCgSkyProgram, "cColor"); 76 sDColorParam = cgGetNamedParameter(sCgSkyProgram, "dColor"); 77 sEColorParam = cgGetNamedParameter(sCgSkyProgram, "eColor"); 78 79 sMultiplierParam = cgGetNamedParameter(sCgSkyProgram, "multiplier"); 80 81 pr = new ShaderProgram(sCgSkyProgram); 82 sShaders.push_back(pr); 55 sCgSkyProgram->AddParameter("lightDir", 0); 56 sCgSkyProgram->AddParameter("thetaSun", 1); 57 sCgSkyProgram->AddParameter("zenithColor", 2); 58 sCgSkyProgram->AddParameter("aColor", 3); 59 sCgSkyProgram->AddParameter("bColor", 4); 60 sCgSkyProgram->AddParameter("cColor", 5); 61 sCgSkyProgram->AddParameter("dColor", 6); 62 sCgSkyProgram->AddParameter("eColor", 7); 63 sCgSkyProgram->AddParameter("multiplier", 8); 83 64 } 84 65 else 85 66 cerr << "sky program failed to load" << endl; 86 67 68 sShaders.push_back(sCgSkyProgram); 69 87 70 sCgMrtFragmentSkyDomeProgram = 88 cgCreateProgramFromFile(context, 89 CG_SOURCE, 90 "src/shaders/sky_preetham.cg", 91 RenderState::sCgFragmentProfile, 92 "frag_skydome", 93 NULL); 94 95 if (sCgMrtFragmentSkyDomeProgram != NULL) 96 { 97 cgGLLoadProgram(sCgMrtFragmentSkyDomeProgram); 98 //cgGLSetParameter1f(sMaxDepthParam, MAX_DEPTH_CONST / farDist); 99 100 pr = new ShaderProgram(sCgMrtFragmentSkyDomeProgram); 101 sShaders.push_back(pr); 102 } 103 else 71 new ShaderProgram(context, 72 "src/shaders/sky_preetham.cg", 73 RenderState::sCgFragmentProfile, 74 "frag_skydome"); 75 76 // simple shader used for just pushing out the fragments to the mrts 77 if (!sCgMrtFragmentSkyDomeProgram->IsValid()) 104 78 cerr << "fragment skyprogram failed to load" << endl; 79 80 sShaders.push_back(sCgMrtFragmentSkyDomeProgram); 105 81 } 106 82 … … 118 94 { 119 95 CreateSunQuad(); 96 Shape *shape = mSkyDome->GetShape(0); 97 98 Material *mat = shape->GetMaterial(); 99 100 mat->SetFragmentProgram(sCgMrtFragmentSkyDomeProgram); 101 mat->SetVertexProgram(sCgSkyProgram); 120 102 } 121 103 … … 135 117 Vector3 zenithColor; 136 118 vector<Vector3> ABCDE; 119 137 120 ComputeFactors(sunDir, zenithColor, ABCDE, sun_theta); 138 121 … … 149 132 mSkyDome->GetTransform()->SetMatrix(s * m); 150 133 151 cgGLSetParameter3f(sLightDirParam, sunDir.x, sunDir.y, sunDir.z); 152 cgGLSetParameter2f(sThetaSunParam, sun_theta.first, sun_theta.second); 153 cgGLSetParameter3f(sZenithColorParam, zenithColor.x, zenithColor.y, zenithColor.z); 154 155 cgGLSetParameter3f(sAColorParam, ABCDE[0].x, ABCDE[0].y, ABCDE[0].z); 156 cgGLSetParameter3f(sBColorParam, ABCDE[1].x, ABCDE[1].y, ABCDE[1].z); 157 cgGLSetParameter3f(sCColorParam, ABCDE[2].x, ABCDE[2].y, ABCDE[2].z); 158 cgGLSetParameter3f(sDColorParam, ABCDE[3].x, ABCDE[3].y, ABCDE[3].z); 159 cgGLSetParameter3f(sEColorParam, ABCDE[4].x, ABCDE[4].y, ABCDE[4].z); 160 161 if (state->GetRenderPassType() == RenderState::DEFERRED) 162 { 163 cgGLEnableProfile(RenderState::sCgFragmentProfile); 164 cgGLBindProgram(sCgMrtFragmentSkyDomeProgram); 165 166 } 134 GPUProgramParameters *vtxParams = mSkyDome->GetShape(0)->GetMaterial()->GetVertexProgramParameters(); 135 136 vtxParams->SetValue3f(0, sunDir.x, sunDir.y, sunDir.z); 137 vtxParams->SetValue2f(1, sun_theta.first, sun_theta.second); 138 vtxParams->SetValue3f(2, zenithColor.x, zenithColor.y, zenithColor.z); 139 140 vtxParams->SetValue3f(3, ABCDE[0].x, ABCDE[0].y, ABCDE[0].z); 141 vtxParams->SetValue3f(4, ABCDE[1].x, ABCDE[1].y, ABCDE[1].z); 142 vtxParams->SetValue3f(5, ABCDE[2].x, ABCDE[2].y, ABCDE[2].z); 143 vtxParams->SetValue3f(6, ABCDE[3].x, ABCDE[3].y, ABCDE[3].z); 144 vtxParams->SetValue3f(7, ABCDE[4].x, ABCDE[4].y, ABCDE[4].z); 145 167 146 168 147 if (!scaleToRange) 169 148 { 170 149 // use tone mapping 171 cgGLSetParameter1f(sMultiplierParam, 1.0f);150 sCgSkyProgram->SetValue1f(8, 1.0f); 172 151 } 173 152 else 174 153 { 175 154 // no tone mapping => scale 176 cgGLSetParameter1f(sMultiplierParam, 8e-5f);155 sCgSkyProgram->SetValue1f(8, 8e-5f); 177 156 } 178 157 179 158 cgGLEnableProfile(RenderState::sCgVertexProfile); 180 cgGLBindProgram(sCgSkyProgram);181 159 182 160 // Render sky dome. … … 185 163 // Render additively blended sun disc. 186 164 //RenderSunDisk(sunDir, camera); 187 188 cgGLDisableProfile(RenderState::sCgFragmentProfile);189 165 } 190 166 … … 192 168 void SkyPreetham::RenderSunDisk(const Vector3 &sunDir, Camera *camera) 193 169 { 170 #if TODOD 194 171 // Move skybox with camera. 195 172 Vector3 position = camera->GetPosition(); … … 212 189 sunPos *= rotx;; 213 190 214 //sunposition.rotateAroundY(-D().getScene().getLight().getHorizontalOrientation() + 90.0f);215 //sunposition.rotateAroundX(-D().getScene().getLight().getVerticalOrientation());191 sunposition.rotateAroundY(-D().getScene().getLight().getHorizontalOrientation() + 90.0f); 192 sunposition.rotateAroundX(-D().getScene().getLight().getVerticalOrientation()); 216 193 217 194 glMatrixMode(GL_MODELVIEW); … … 222 199 glMaterialfv(GL_FRONT, GL_AMBIENT, ambient); 223 200 224 //Float size = 0.5f + (1.0f - lightdirection.y) * 0.5f;225 226 //mSunEffect->setVariableVector3("LightDiffuseColor", D().getScene().getLight().getDiffuseColor());227 //mSunEffect->setVariableFloat("SunSize", size);228 //mSunEffect->setVariableTexture2D("SunTexture", mSunTexture);229 230 /*mSunEffect->activate();201 Float size = 0.5f + (1.0f - lightdirection.y) * 0.5f; 202 203 mSunEffect->setVariableVector3("LightDiffuseColor", D().getScene().getLight().getDiffuseColor()); 204 mSunEffect->setVariableFloat("SunSize", size); 205 mSunEffect->setVariableTexture2D("SunTexture", mSunTexture); 206 207 mSunEffect->activate(); 231 208 232 209 mSunQuad->render(); 233 210 234 211 mSunEffect->deactivate(); 235 F().getRenderDevice().setDefaultBlendingMode(FRenderDevice::BLENDING_NONE); */212 F().getRenderDevice().setDefaultBlendingMode(FRenderDevice::BLENDING_NONE); 236 213 237 214 glPopMatrix(); 215 #endif 238 216 } 239 217 … … 241 219 void SkyPreetham::CreateSunQuad() 242 220 { 243 /* 221 #if TODO 244 222 mSunQuad = new FVertexBuffer(); 245 223 mSunQuad->setupPrimitiveType(FVertexBuffer::PRIMITIVES_TRIANGLES); … … 263 241 mSunQuad->setIndex(4, 1); 264 242 mSunQuad->setIndex(5, 3); 265 */ 243 #endif 266 244 } 267 245 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3034 r3036 1967 1967 state.SetRenderPassType(RenderState::DEFERRED); 1968 1968 1969 const bool useToneMapping = ((renderMethod == RENDER_DEPTH_PASS_DEFERRED) || (renderMethod == RENDER_DEFERRED)) && useHDR; 1969 const bool useToneMapping = 1970 ((renderMethod == RENDER_DEPTH_PASS_DEFERRED) || 1971 (renderMethod == RENDER_DEFERRED)) && useHDR; 1970 1972 1971 1973 preetham->RenderSkyDome(-light->GetDirection(), camera, &state, !useToneMapping); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/common.h
r3022 r3036 28 28 29 29 class Shape; 30 struct LODLevel;31 30 class Polygon3; 32 31 class Vector3; 33 32 class Geometry; 33 class GPUProgramParameters; 34 class Transform3; 35 class Texture; 36 class Material; 37 34 38 struct LODLevel; 39 35 40 36 41 … … 481 486 typedef std::queue<BvhNode *> BvhNodeQueue; 482 487 483 484 488 typedef std::vector<Shape *> ShapeContainer; 485 489 typedef std::vector<Geometry *> GeometryContainer; … … 487 491 typedef std::vector<Polygon3 *> PolygonContainer; 488 492 typedef std::vector<LODLevel *> LODContainer; 493 typedef std::vector<Transform3 *> TransformContainer; 494 typedef std::vector<Texture *> TextureContainer; 495 typedef std::vector<Material *> MaterialContainer; 496 typedef std::vector<GPUProgramParameters *> GPUParamContainer; 489 497 490 498 typedef std::vector<Vector3> VertexArray;
Note: See TracChangeset
for help on using the changeset viewer.