//--------------------------------------------------------------------------- ChooseActionOption::ChooseActionOption( const double contribution, const double cost, const std::string& description, const std::string& message) { SetContribution(contribution); SetCost(cost); SetDescription(description); SetMessageChoice(message); }
ribi::gtst::ChooseActionOption::ChooseActionOption( const double contribution, const double cost, const std::string& description, const std::string& message) : m_contribution{}, m_cost{}, m_description{}, m_message_choice{} { SetContribution(contribution); SetCost(cost); SetDescription(description); SetMessageChoice(message); }
bool OGLSpotLight::Init(int windowWidth, int windowHeight) { bool res = gs::Stage::Init(windowWidth, windowHeight); if (!res) { return false; } cubePositions.resize(10); res &= InitGUI(); // Init Camera camera.SetPosition(glm::vec3(0, 0, 50)); camera.SetSpeed(15.0f); camera.SetupProjection(45.0f, windowWidth / (float)windowHeight); // Init light InitLight(); // Init materials InitCubePosition(); // Init program res &= AddProgram("mesh.vert", "spotLight.frag"); auto program = programs[0]; // Get uniform locations res &= AddLightUniform(program.get()); res &= AddMatricesUniform(program.get()); res &= program->AddUniform("material.shininess"); res &= program->AddUniform("samplerDiffuse1"); program->AddUniform("samplerDiffuse2"); program->AddUniform("samplerDiffuse3"); program->AddUniform("samplerSpecular1"); program->AddUniform("samplerSpecular2"); glUniform1i(program->GetUniform("samplerDiffuse1"), 0); glUniform1i(program->GetUniform("samplerDiffuse2"), 1); glUniform1i(program->GetUniform("samplerDiffuse3"), 2); glUniform1i(program->GetUniform("samplerSpecular1"), 3); glUniform1i(program->GetUniform("samplerSpecular2"), 4); // Init geometry auto vao = std::make_unique<gs::VertexArray>(); vao->BindVAO(); auto vbo = std::make_unique<gs::VertexBuffer>(GL_ARRAY_BUFFER); vbo->BindVBO(); OGLCube cube; auto& vertices = cube.GetVertices(); cube.InitVertices(glm::vec3(0)); glBufferData(vbo->GetTarget(), sizeof(gs::Vertex) * vertices.size(), vertices.data(), GL_STATIC_DRAW); vbos.push_back(std::move(vbo)); vao->AddAttribute(0, 3, GL_FLOAT, GL_FALSE, sizeof(gs::Vertex), 0); vao->AddAttribute(1, 2, GL_FLOAT, GL_FALSE, sizeof(gs::Vertex), (void*)offsetof(gs::Vertex, texCoords)); vao->AddAttribute(2, 3, GL_FLOAT, GL_FALSE, sizeof(gs::Vertex), (void*)offsetof(gs::Vertex, normal)); vaos.push_back(std::move(vao)); auto diffuse = std::make_unique<gs::Texture>(IMAGE_TYPE::GLI); diffuse->SetContribution(LIGHT_CONTRIBUTION::DIFFUSE); res &= diffuse->LoadTexture("containerDiffuse.dds"); diffuse->BindTexture(GL_TEXTURE0); textures.push_back(std::move(diffuse)); auto specular = std::make_unique<gs::Texture>(IMAGE_TYPE::GLI); specular->SetContribution(LIGHT_CONTRIBUTION::DIFFUSE); res &= specular->LoadTexture("containerSpecular.dds"); specular->BindTexture(GL_TEXTURE3); textures.push_back(std::move(specular)); glEnable(GL_DEPTH_TEST); res = true; return res; }