本文整理汇总了C++中Light::InterpolateG方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::InterpolateG方法的具体用法?C++ Light::InterpolateG怎么用?C++ Light::InterpolateG使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Light
的用法示例。
在下文中一共展示了Light::InterpolateG方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
glm::vec3 cross = glm::cross(glm::vec3(2.5, 2.5, 0),glm::vec3(0, 2.5, 0));
try
{
GLfloat currentFrame;
GLFWwindow *window = JPGLHelper::InitEverything(HEIGHT, WIDTH);
glfwSetKeyCallback(window, keyCallback);
if (glewInit() != GLEW_OK)
throw std::runtime_error("glewInit() failed");
ShaderCompiler shaderGround("ground.vert", "ground.frag");
ShaderCompiler shaderTrain("train.vert", "train.frag");
MatrixWrapper modelPlane(shaderGround.GetProgramID(), "model"),
modelIdentity(shaderTrain.GetProgramID(), "model"),
projection(shaderGround.GetProgramID(), "projection");
modelPlane.mat4 = glm::rotate(modelPlane.mat4, glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f));
projection.mat4 = glm::perspective(glm::radians(45.0f), (GLfloat)WIDTH / (GLfloat)HEIGHT, 0.1f, 2500.0f);
Camera camera(-180.0f, 180.0f, 0.0f, 360.0f, 5.0f, shaderGround.GetProgramID(), 25.0f);
camera.UpdateTargetPosition(glm::vec3(0.0f, 0.0f, 0.0f));
modelPlane.mat4 = glm::scale(modelPlane.mat4, glm::vec3(300.0f,300.0f, 1.0f));
modelIdentity.mat4 = glm::mat4(1.0f);
Plane ground(shaderGround.GetProgramID(),32);
Train train(shaderTrain.GetProgramID());
Light light;
TextureWrapper groundTexture(GL_TEXTURE0, shaderGround.GetProgramID(), "ground.png", "Texture0");
keyboardManager.RegisterKey(GLFW_KEY_ESCAPE, std::bind(glfwSetWindowShouldClose, window, GL_TRUE));
keyboardManager.RegisterKey(GLFW_KEY_H, std::bind(&Camera::YawDown, std::ref(camera)));
keyboardManager.RegisterKey(GLFW_KEY_J, std::bind(&Camera::PitchDown, std::ref(camera)));
keyboardManager.RegisterKey(GLFW_KEY_K, std::bind(&Camera::PitchUp, std::ref(camera)));
keyboardManager.RegisterKey(GLFW_KEY_L, std::bind(&Camera::YawUp, std::ref(camera)));
keyboardManager.RegisterKey(GLFW_KEY_U, std::bind(&Camera::DistanceUp, std::ref(camera)));
keyboardManager.RegisterKey(GLFW_KEY_I, std::bind(&Camera::DistanceDown, std::ref(camera)));
keyboardManager.RegisterKey(GLFW_KEY_A, std::bind(&Train::Go, std::ref(train)));
keyboardManager.RegisterKey(GLFW_KEY_Z, std::bind(&Train::Back, std::ref(train)));
keyboardManager.RegisterKey(GLFW_KEY_S, std::bind(&Light::AmbientUp, std::ref(light)));
keyboardManager.RegisterKey(GLFW_KEY_X, std::bind(&Light::AmbientDown, std::ref(light)));
keyboardManager.RegisterKey(GLFW_KEY_D, std::bind(&Light::DiffuseUp, std::ref(light)));
keyboardManager.RegisterKey(GLFW_KEY_C, std::bind(&Light::DiffuseDown, std::ref(light)));
glEnable(GL_MULTISAMPLE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
while (!glfwWindowShouldClose(window))
{
currentFrame = glfwGetTime();
JPGLHelper::deltaTime = currentFrame - JPGLHelper::lastTime;
JPGLHelper::lastTime = currentFrame;
glfwPollEvents();
keyboardManager.ProcessKeys();
camera.UpdateTargetPosition(train.GetLocation());
train.DoPhysics();
glClearColor(light.InterpolateR(), light.InterpolateG(), light.InterpolateB(), 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/*
rysowanie p³aszczyzny
*/
groundTexture.SendToGPU();
shaderGround.Execute();
light.UpdateLight(shaderGround.GetProgramID(), camera.cameraPosition);
camera.UpdateShader(shaderGround.GetProgramID());
camera.SendUpdatedMatrix();
projection.SetShader(shaderGround.GetProgramID());
projection.SendToGPU();
ground.Draw(modelPlane);
/*
rysowanie poci¹gu
*/
//.........这里部分代码省略.........