Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Muda textura dos blocos #61

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bin/Debug/main.exe
Binary file not shown.
Binary file added data/circuits/lego.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int main(int argc, char* argv[])
LoadTextureImage("../../data/display/textures/digit1.jpg"); // TextureDigit1
LoadTextureImage("../../data/circuits/wire.jpg"); // TexturePlaneWire
LoadTextureImage("../../data/circuits/not.jpg"); // TexturePlaneNot
LoadTextureImage("../../data/fine-textured-plastic-2000-mm-architextures.jpg"); // TextureBlocks
LoadTextureImage("../../data/circuits/lego.png"); // TextureBlocks
LoadTextureImage("../../data/Blocks_001_COLOR_B.jpg"); // TextureSphere
LoadTextureImage("../../data/circuits/and.jpg"); // TexturePlaneAnd
LoadTextureImage("../../data/grass-1000-mm-architextures.jpg"); // TextureFloor
Expand Down
10 changes: 9 additions & 1 deletion src/shader_fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,22 @@ void main()
lambertDiffuseTerm = Kd * I * lambert;
color.rgb = lambertDiffuseTerm + ambientTerm; // Diffuse
}
else if (object_id == NOT || object_id == AND || object_id == OR) // Blinn-Phong e Phong shading
else if (object_id == AND || object_id == OR) // Blinn-Phong e Phong shading
{
U = texcoords.x * 2.0f;
V = texcoords.y * 2.0f;
Kd = texture(TextureBlocks, vec2(U,V)).rgb;
lambertDiffuseTerm = Kd * I * lambert;
color.rgb = lambertDiffuseTerm + ambientTerm + specularTerm; // Blinn-Phong
}
else if (object_id == NOT) // Blinn-Phong e Phong shading
{
U = texcoords.x;
V = texcoords.y;
Kd = texture(TextureBlocks, vec2(U,V)).rgb;
lambertDiffuseTerm = Kd * I * lambert;
color.rgb = lambertDiffuseTerm + ambientTerm + specularTerm; // Blinn-Phong
}

// NOTE: Se você quiser fazer o rendering de objetos transparentes, é
// necessário:
Expand Down