Update models_material_pbr.c
This commit is contained in:
parent
0565fb9fb6
commit
7e68e733f5
1 changed files with 18 additions and 4 deletions
|
@ -279,17 +279,31 @@ static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int s
|
||||||
|
|
||||||
rlViewport(0, 0, size, size); // Set viewport to current fbo dimensions
|
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++)
|
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]);
|
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);
|
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, 0);
|
||||||
|
|
||||||
rlEnableFramebuffer(fbo);
|
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();
|
rlClearScreenBuffers();
|
||||||
DrawCubeV(Vector3Zero(), Vector3One(), WHITE);
|
rlLoadDrawCube();
|
||||||
rlDrawRenderBatchActive();
|
|
||||||
|
// 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();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue