Exemplo n.º 1
0
    void ResetScene() {
        m_CamPosition = { 0.f, 0.f, -20.f };
        m_CamTarget = AVector3::Zero;
        m_CamUp = AVector3::Up;

        m_Root.SetLocalScale({ 1.f, 1.f, 1.f });
        m_Root.SetLocalTranslation({ 0.f, 0.f, 0.f });
        m_Root.SetLocalRotation({ 0.f, 0.f, 0.f });
        size_t i = 0;
        for (int x = -CUBES_XYZ[0]; x < CUBES_XYZ[0]; ++x) {
            for (int y = -CUBES_XYZ[1]; y < CUBES_XYZ[1]; ++y) {
                for (int z = -CUBES_XYZ[2]; z < CUBES_XYZ[2]; ++z) {
                    m_Cubes[i].SetLocalScale({ 0.5f, 0.5f, 0.5 });
                    m_Cubes[i].SetLocalTranslation({ (float)x, (float)y, (float)z });
                    m_Cubes[i].SetLocalRotation({ 0.f, 0.f, 0.f });
                    ++i;
                }
            }
        }

        m_CameraFOV = 45.f;

        m_SpinCube = false;
        m_CubeRotationSpeed = 1.f;
    }
Exemplo n.º 2
0
    virtual void GUIPanel() override {
        Application::GUIPanel();
        
        // proj
        ImGui::Separator();
        ImGui::DragFloat("Cam FOV", &m_CameraFOV, 0.05f);

        // model
        ImGui::Separator();
        ImGui::Separator();
        AVector3 pos = m_Root.GetLocalTranslation();
        ImGui::DragFloat3("Cube Pos",   (float*)&pos,    0.05f);
        m_Root.SetLocalTranslation(pos);

        AVector3 rot = m_Root.GetLocalRotation() * AVector3(Rad2Deg);
        ImGui::DragFloat3("Cube Rot",   (float*)&rot,               0.05f);
        m_Root.SetLocalRotation(rot * AVector3(Deg2Rad));

        AVector3 sca = m_Root.GetLocalScale();
        ImGui::DragFloat3("Cube Scale", (float*)&sca,       0.05f);
        m_Root.SetLocalScale(sca);

        ImGui::Checkbox("Spin Cube",    &m_SpinCube);
        ImGui::DragFloat("Spin Speed",  &m_CubeRotationSpeed,       0.001f);

        // application
        ImGui::Separator();
        if (ImGui::Button("Reset")) {
            ResetScene();
        }
    }