mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Merge branch 'master' of https://github.com/JoeyDeVries/LearnOpenGL
This commit is contained in:
@@ -170,7 +170,7 @@ int main()
|
||||
// shader configuration
|
||||
// --------------------
|
||||
shader.use();
|
||||
shader.setInt("ourTexture", 0);
|
||||
shader.setInt("texture1", 0);
|
||||
|
||||
// render loop
|
||||
// -----------
|
||||
@@ -243,12 +243,12 @@ int main()
|
||||
model = glm::mat4();
|
||||
model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));
|
||||
model = glm::scale(model, glm::vec3(scale, scale, scale));
|
||||
shader.setMat4("model", model);
|
||||
shaderSingleColor.setMat4("model", model);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 36);
|
||||
model = glm::mat4();
|
||||
model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));
|
||||
model = glm::scale(model, glm::vec3(scale, scale, scale));
|
||||
shader.setMat4("model", model);
|
||||
shaderSingleColor.setMat4("model", model);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 36);
|
||||
glBindVertexArray(0);
|
||||
glStencilMask(0xFF);
|
||||
|
||||
@@ -224,7 +224,7 @@ int main()
|
||||
shaderLightingPass.setFloat("lights[" + std::to_string(i) + "].Quadratic", quadratic);
|
||||
// then calculate radius of light volume/sphere
|
||||
const float maxBrightness = std::fmaxf(std::fmaxf(lightColors[i].r, lightColors[i].g), lightColors[i].b);
|
||||
float radius = (-linear + std::sqrtf(linear * linear - 4 * quadratic * (constant - (256.0f / 5.0f) * maxBrightness))) / (2.0f * quadratic);
|
||||
float radius = (-linear + std::sqrt(linear * linear - 4 * quadratic * (constant - (256.0f / 5.0f) * maxBrightness))) / (2.0f * quadratic);
|
||||
shaderLightingPass.setFloat("lights[" + std::to_string(i) + "].Radius", radius);
|
||||
}
|
||||
shaderLightingPass.setVec3("viewPos", camera.Position);
|
||||
|
||||
Reference in New Issue
Block a user