Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Create a new scene UI
- scenePlayerUI_= new Scene(context_);
- scenePlayerUI_-> CreateComponent<Octree>();
- scenePlayerUI_-> CreateComponent<DebugRenderer>();
- /// Add a plane
- Node* planeNode = scenePlayerUI_->CreateChild("Plane");
- planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
- StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
- planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
- /// Add a lightdelightNode
- Node* lightNode = scenePlayerUI_->CreateChild("DirectionalLight");
- lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); /// The direction vector does not need to be normalized
- Light* light = lightNode->CreateComponent<Light>();
- light->SetLightType(LIGHT_DIRECTIONAL);
- /// Add Camera
- Node * cameraNodePlayerUI_ = scenePlayerUI_->CreateChild("Camera");
- cameraNodePlayerUI_->CreateComponent<Camera>();
- /// Set an initial position for the camera scene node above the plane
- cameraNodePlayerUI_->SetPosition(Vector3(0.0f, 5.0f, 0.0f));
- /// Get the view window
- View3D * playerViewWindow = (View3D *) HUDFileElement -> GetChild("PlayerViewWindow",true);
- /// Add scene and camera to window
- playerViewWindow -> SetView(scenePlayerUI_,(Camera *)cameraNodePlayerUI_->GetComponent<Camera>(),true);
Advertisement
Add Comment
Please, Sign In to add comment