Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Void Testbed::Create()
- {
- Scene::Manager* sceneManager = Scene::Manager::Singleton;
- Array<Mesh::Vertex> vertices;
- // Setup some vertices
- Float x, y, z; x = y = z = 1.0f;
- // -- //
- vertices.Reserve(8);
- // -- //
- vertices[0].Position = Float3(x, y, z);
- vertices[1].Position = Float3(-x, y, z);
- vertices[2].Position = Float3(x, -y, z);
- vertices[3].Position = Float3(-x, -y, z);
- vertices[4].Position = Float3(x, y, -z);
- vertices[5].Position = Float3(-x, y, -z);
- vertices[6].Position = Float3(x, -y, -z);
- vertices[7].Position = Float3(-x, -y, -z);
- // -- //
- vertices.Count = 8;
- Array<UShort3> indices;
- // Set up the indices
- indices.Reserve(12);
- // +x (yz plane)
- indices[0] = UShort3(0, 2, 6);
- indices[1] = UShort3(6, 4, 0);
- // +y (xz)
- indices[2] = UShort3(1, 0, 4);
- indices[3] = UShort3(4, 5, 1);
- // +z (xy)
- indices[4] = UShort3(0, 2, 3);
- indices[5] = UShort3(3, 1, 0);
- // -x
- indices[6] = UShort3(1, 3, 7);
- indices[7] = UShort3(7, 5, 1);
- // -y
- indices[8] = UShort3(3, 2, 6);
- indices[9] = UShort3(6, 7, 3);
- // -z
- indices[10] = UShort3(4, 6, 7);
- indices[11] = UShort3(7, 5, 4);
- // -- //
- indices.Count = 12;
- mModel = Model::Create("Test/Cube", vertices, indices);
- // Create a node and attach the model to it
- mNode = sceneManager->CreateNode();
- mNode->Attachment = mModel.Handle;
- // Reset our timer
- mTimer.Reset();
- }
- Void Testbed::Update()
- {
- Float time = mTimer.Elapsed(Timer::Seconds);
- // Generate the transforms and constant buffer data
- //Aligned Float4x4 world = Identity(); //To4x4(RotationZ(time * (1 + key->Held('D')))); //To4x4(RotationZ(fmod(ttime * 1.0f, 1.0f) * Pi * 2.0f));
- mNode->Position.xy = Float2(1.0f * cosf(time), 1.0f * sinf(time));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement