1. 场景和摄像机
virtual void chooseSceneManager(void)
{// Create the SceneManager, in this case a generic one
mSceneMgr = mRoot->createSceneManager(ST_GENERIC, "ExampleSMInstance");
}
virtual void createCamera(void)
{
// Create the camera
mCamera = mSceneMgr->createCamera("PlayerCam");
// Position it at 500 in Z direction
mCamera->setPosition(Vector3(0,0,500));
// Look back along -Z
mCamera->lookAt(Vector3(0,0,-300));
mCamera->setNearClipDistance(5);
mCamera->setFarClipDistance(1000);
}
摄像机默认近界面距离100,远截面 1000 000
为确保深度缓存精度的细致,缩小1000倍,5-1000
2. 创建实体和灯光
void createScene(void)
{
// Set ambient light 设置环境光
mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
// Create a point light 创建灯光实例