@@ -51,6 +51,7 @@ namespace Ogre {
51
51
mCameraPositionDirty(true ),
52
52
mCameraPositionObjectSpaceDirty(true ),
53
53
mAmbientLight(ColourValue::Black),
54
+ mShadowColour(ColourValue(0.25 , 0.25 , 0.25 )),
54
55
mPassNumber(0 ),
55
56
mSceneDepthRangeDirty(true ),
56
57
mLodCameraPositionDirty(true ),
@@ -306,21 +307,26 @@ namespace Ogre {
306
307
return mWorldMatrixArray + int (MeshManager::getBonesUseObjectSpace ());
307
308
}
308
309
// -----------------------------------------------------------------------------
309
- const Affine3& AutoParamDataSource::getViewMatrix (void ) const
310
+ Affine3 AutoParamDataSource::getViewMatrix (const Camera* cam ) const
310
311
{
311
- if (mViewMatrixDirty )
312
+ Affine3 view;
313
+ if (mCurrentRenderable && mCurrentRenderable ->getUseIdentityView ())
314
+ view = Affine3::IDENTITY;
315
+ else
312
316
{
313
- if (mCurrentRenderable && mCurrentRenderable ->getUseIdentityView ())
314
- mViewMatrix = Affine3::IDENTITY;
315
- else
317
+ view = cam->getViewMatrix (true );
318
+ if (mCameraRelativeRendering )
316
319
{
317
- mViewMatrix = mCurrentCamera ->getViewMatrix (true );
318
- if (mCameraRelativeRendering )
319
- {
320
- mViewMatrix .setTrans (Vector3::ZERO);
321
- }
322
-
320
+ view.setTrans (Vector3::ZERO);
323
321
}
322
+ }
323
+ return view;
324
+ }
325
+ const Affine3& AutoParamDataSource::getViewMatrix (void ) const
326
+ {
327
+ if (mViewMatrixDirty )
328
+ {
329
+ mViewMatrix = getViewMatrix (mCurrentCamera );
324
330
mViewMatrixDirty = false ;
325
331
}
326
332
return mViewMatrix ;
@@ -336,31 +342,40 @@ namespace Ogre {
336
342
return mViewProjMatrix ;
337
343
}
338
344
// -----------------------------------------------------------------------------
345
+ Matrix4 AutoParamDataSource::getProjectionMatrix (const Camera* cam) const
346
+ {
347
+ Matrix4 proj;
348
+
349
+ // NB use API-independent projection matrix since GPU programs
350
+ // bypass the API-specific handedness and use right-handed coords
351
+ if (mCurrentRenderable && mCurrentRenderable ->getUseIdentityProjection ())
352
+ {
353
+ // Use identity projection matrix, still need to take RS depth into account.
354
+ RenderSystem* rs = Root::getSingleton ().getRenderSystem ();
355
+ rs->_convertProjectionMatrix (Matrix4::IDENTITY, proj, true );
356
+ }
357
+ else
358
+ {
359
+ proj = mCurrentCamera ->getProjectionMatrixWithRSDepth ();
360
+ }
361
+
362
+ if (mCurrentRenderTarget && mCurrentRenderTarget ->requiresTextureFlipping ())
363
+ {
364
+ // Because we're not using setProjectionMatrix, this needs to be done here
365
+ // Invert transformed y
366
+ proj[1 ][0 ] = -proj[1 ][0 ];
367
+ proj[1 ][1 ] = -proj[1 ][1 ];
368
+ proj[1 ][2 ] = -proj[1 ][2 ];
369
+ proj[1 ][3 ] = -proj[1 ][3 ];
370
+ }
371
+
372
+ return proj;
373
+ }
339
374
const Matrix4& AutoParamDataSource::getProjectionMatrix (void ) const
340
375
{
341
376
if (mProjMatrixDirty )
342
377
{
343
- // NB use API-independent projection matrix since GPU programs
344
- // bypass the API-specific handedness and use right-handed coords
345
- if (mCurrentRenderable && mCurrentRenderable ->getUseIdentityProjection ())
346
- {
347
- // Use identity projection matrix, still need to take RS depth into account.
348
- RenderSystem* rs = Root::getSingleton ().getRenderSystem ();
349
- rs->_convertProjectionMatrix (Matrix4::IDENTITY, mProjectionMatrix , true );
350
- }
351
- else
352
- {
353
- mProjectionMatrix = mCurrentCamera ->getProjectionMatrixWithRSDepth ();
354
- }
355
- if (mCurrentRenderTarget && mCurrentRenderTarget ->requiresTextureFlipping ())
356
- {
357
- // Because we're not using setProjectionMatrix, this needs to be done here
358
- // Invert transformed y
359
- mProjectionMatrix [1 ][0 ] = -mProjectionMatrix [1 ][0 ];
360
- mProjectionMatrix [1 ][1 ] = -mProjectionMatrix [1 ][1 ];
361
- mProjectionMatrix [1 ][2 ] = -mProjectionMatrix [1 ][2 ];
362
- mProjectionMatrix [1 ][3 ] = -mProjectionMatrix [1 ][3 ];
363
- }
378
+ mProjectionMatrix = getProjectionMatrix (mCurrentCamera );
364
379
mProjMatrixDirty = false ;
365
380
}
366
381
return mProjectionMatrix ;
@@ -1132,9 +1147,13 @@ namespace Ogre {
1132
1147
return dummy;
1133
1148
}
1134
1149
// ---------------------------------------------------------------------
1150
+ void AutoParamDataSource::setShadowColour (const ColourValue& colour)
1151
+ {
1152
+ mShadowColour = colour;
1153
+ }
1135
1154
const ColourValue& AutoParamDataSource::getShadowColour () const
1136
1155
{
1137
- return mCurrentSceneManager -> getShadowColour () ;
1156
+ return mShadowColour ;
1138
1157
}
1139
1158
// -------------------------------------------------------------------------
1140
1159
void AutoParamDataSource::updateLightCustomGpuParameter (const GpuProgramParameters::AutoConstantEntry& constantEntry, GpuProgramParameters *params) const
0 commit comments