本文整理汇总了C++中Transformation::SetUniformScale方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformation::SetUniformScale方法的具体用法?C++ Transformation::SetUniformScale怎么用?C++ Transformation::SetUniformScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformation
的用法示例。
在下文中一共展示了Transformation::SetUniformScale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matrix
//----------------------------------------------------------------------------
void Sample5::OnIdle()
{
Double time = System::GetTime();
Double elapsedTime = time - mLastTime;
mLastTime = time;
mAngle += static_cast<Float>(elapsedTime);
mAngle = MathF::FMod(mAngle, MathF::TWO_PI * 2);
// scene graph transformations
//
Node* pLitGroup = DynamicCast<Node>(mspRoot->GetChild(0));
WIRE_ASSERT(pLitGroup);
// rotate the 2 cubes
Matrix3F rotate1(Vector3F(0.75F, 0.25F, 0.5F), -mAngle * 0.5F);
Spatial* pCube1 = pLitGroup->GetChild(0);
pCube1->Local.SetRotate(rotate1);
Matrix3F rotate2(Vector3F(-0.75F, -0.25F, -0.5F), -mAngle * 0.5F);
Spatial* pCube2 = pLitGroup->GetChild(1);
pCube2->Local.SetRotate(rotate2);
// move the green light up and down
Float y = MathF::FMod(static_cast<Float>(time), MathF::TWO_PI);
Vector3F lightPos1(0, MathF::Sin(y*2) * 1.5F, 2);
Node* pLightNode1 = DynamicCast<Node>(mspRoot->GetChild(1));
WIRE_ASSERT(pLightNode1);
pLightNode1->Local.SetTranslate(lightPos1);
// rotate the red light about the y axis
Node* pLightNode2 = DynamicCast<Node>(mspRoot->GetChild(2));
WIRE_ASSERT(pLightNode2);
Matrix34F rotateLight2(Vector3F::UNIT_Y, -mAngle);
Vector3F lightPos2 = rotateLight2 * Vector3F(5, 0, 0);
pLightNode2->Local.SetTranslate(lightPos2);
mspRoot->UpdateGS(time);
mCuller.ComputeVisibleSet(mspRoot);
// manual transformation from local to world space of
// the non-scene graph part
Transformation transformation;
Float angle = MathF::Sin(mAngle*2);
angle = angle * MathF::HALF_PI*0.3F + MathF::PI;
Matrix34F rotateLocalLight3(Vector3F(0, 1, 0), angle);
Matrix34F rotateWorldLight3(Vector3F(1, 0, 0), -0.5F);
transformation.SetTranslate(Vector3F(0.5F, -1.0F, 4+MathF::Sin(y*1.0F)*2));
transformation.SetRotate(rotateWorldLight3 * rotateLocalLight3);
transformation.SetUniformScale(0.15F);
mspSpotLight->Position = transformation.GetTranslate();
mspSpotLight->Direction = transformation.GetMatrix().GetColumn(2);
GetRenderer()->ClearBuffers();
GetRenderer()->PreDraw(mspCamera);
// render the scene graph
GetRenderer()->Draw(mCuller.GetVisibleSets());
// before we start drawing objects in 'manual' mode, release all resources
// cached by the Renderer to return the renderer to its default state.
// This is necessary when identical resources (mspTexture in this case)
// are used by the scene graph and other objects that are being draw
// manually.
GetRenderer()->ReleaseResources();
// render the white cube representing the spot light
GetRenderer()->Draw(mspWhiteCube, transformation);
Matrix34F matrix(Vector3F(1.0F, 0, 0), -1.0F, Vector3F(0, -2.5F, 0));
transformation.SetMatrix(matrix, false);
transformation.SetUniformScale(1);
// render the bottom plane which is being lit by the spot light
GetRenderer()->SetLight(mspSpotLight);
GetRenderer()->EnableLighting(mspSpotLight->Ambient);
GetRenderer()->Draw(mspPlane, transformation);
GetRenderer()->DisableLighting();
GetRenderer()->PostDraw();
GetRenderer()->DisplayBackBuffer();
}