Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Application initialization ---------------------------------------------------------
- bool Game::Initialize()
- {
- bool result;
- // Initialize R3D
- R3D::Initialize();
- // Set the frame time
- mFrameTime = floor(1000 / 60); // 60 FPS target (66.6 fps lol)
- Window::Description windowDesc;
- // Setup the window
- windowDesc.Width = 960;
- windowDesc.Height = 640;
- windowDesc.Flags.Format = Texture::Format::RGB10A2UNorm;
- // Create a window and begin initialization
- result = mWindow.Create(windowDesc);
- if(!result) { return false; }
- // Create the Resource and Scene managers here and store them somewhere, idk where yet
- // Prepare the resource manager
- Resource::Manager* resourceManager = Resource::Manager::Singleton;
- resourceManager->AddResourceLocation("/Resources/");
- resourceManager->InitializeResources();
- // Prepare the scene manager
- Scene::Manager* sceneManager = Scene::Manager::Singleton;
- sceneManager->Initialize();
- // Create a floor and a box
- Resource::Model floor, box;
- floor = resourceManager->GetModel("R3D/Plane");
- floor.Material = resourceManager->GetMaterial("Materials/Dirt");
- box = resourceManager->GetModel("R3D/Box");
- box.Material = resourceManager->GetMaterial("Materials/Brick");
- // Now place the box on top of the plane
- // Create a scene node and attach the models to it
- Scene::NodeID floorNode = sceneManager->CreateNode();
- floorNode->AddModel(floor);
- //--//
- Scene::NodeID boxNode = sceneManager->CreateNode();
- boxNode->AddModel(box);
- //--//
- floorNode->SetScale(10.0f, 10.0f, 10.0f);
- //--//
- boxNode->Translate(0.0f, 0.0f, -2.5f);
- boxNode->SetScale(5.0f, 5.0f, 5.0f);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement