summaryrefslogtreecommitdiffhomepage
path: root/examples/models
diff options
context:
space:
mode:
authorRay <[email protected]>2021-06-03 21:04:23 +0200
committerRay <[email protected]>2021-06-03 21:04:23 +0200
commit7e68e733f525ced1a0565c3fb1245c706409fa82 (patch)
tree7eb20b79827e947d87e18c592d16a9739f4b87c5 /examples/models
parent0565fb9fb6018e82acb5d4d5d9fd7aefabe40d3d (diff)
downloadraylib-7e68e733f525ced1a0565c3fb1245c706409fa82.tar.gz
raylib-7e68e733f525ced1a0565c3fb1245c706409fa82.zip
Update models_material_pbr.c
Diffstat (limited to 'examples/models')
-rw-r--r--examples/models/models_material_pbr.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/examples/models/models_material_pbr.c b/examples/models/models_material_pbr.c
index f89a2758..dfef69da 100644
--- a/examples/models/models_material_pbr.c
+++ b/examples/models/models_material_pbr.c
@@ -279,17 +279,31 @@ static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int s
rlViewport(0, 0, size, size); // Set viewport to current fbo dimensions
+ // Activate and enable texture for drawing to cubemap faces
+ rlActiveTextureSlot(0);
+ rlEnableTexture(panorama.id);
+
for (int i = 0; i < 6; i++)
{
+ // Set the view matrix for the current cube face
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]);
+
+ // Select the current cubemap face attachment for the fbo
+ // WARNING: This function by default enables->attach->disables fbo!!!
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, 0);
-
rlEnableFramebuffer(fbo);
- rlSetTexture(panorama.id); // WARNING: It must be called after enabling current framebuffer if using internal batch system!
+ // Load and draw a cube, it uses the current enabled texture
rlClearScreenBuffers();
- DrawCubeV(Vector3Zero(), Vector3One(), WHITE);
- rlDrawRenderBatchActive();
+ rlLoadDrawCube();
+
+ // ALTERNATIVE: Try to use internal batch system to draw the cube instead of rlLoadDrawCube
+ // for some reason this method does not work, maybe due to cube triangles definition? normals pointing out?
+ // TODO: Investigate this issue...
+ //rlSetTexture(panorama.id); // WARNING: It must be called after enabling current framebuffer if using internal batch system!
+ //rlClearScreenBuffers();
+ //DrawCubeV(Vector3Zero(), Vector3One(), WHITE);
+ //rlDrawRenderBatchActive();
}
//------------------------------------------------------------------------------------------