Confirmed shaders work

This commit is contained in:
2021-11-12 06:54:25 -08:00
parent e4222866ef
commit 6d287e5ff8
3 changed files with 32 additions and 10 deletions

View File

@ -51,11 +51,11 @@ void sandboxGameUpdate(sandboxgame_t *game) {
);
cameraLookAt(&camera, 0,0,10, 0,0,0);
uint8_t uniView = shaderGetUniform(&game->shader, "u_View");
uint8_t uniProj = shaderGetUniform(&game->shader, "u_Proj");
uint8_t uniModel = shaderGetUniform(&game->shader, "u_Modl");
uint8_t uniColor = shaderGetUniform(&game->shader, "u_Colr");
uint8_t uniTexture = shaderGetUniform(&game->shader, "u_Text");
shaderuniform_t uniView = shaderGetUniform(&game->shader, "u_View");
shaderuniform_t uniProj = shaderGetUniform(&game->shader, "u_Proj");
shaderuniform_t uniModel = shaderGetUniform(&game->shader, "u_Modl");
shaderuniform_t uniColor = shaderGetUniform(&game->shader, "u_Colr");
shaderuniform_t uniTexture = shaderGetUniform(&game->shader, "u_Text");
shaderUse(&game->shader);
shaderUseCamera(&game->shader, uniView, uniProj, &camera);
@ -64,7 +64,11 @@ void sandboxGameUpdate(sandboxgame_t *game) {
shaderUsePosition(&game->shader, uniModel, 0,0,0, 0,0,0);
primitiveDraw(&game->quad, 0, -1);
// sceneRenderEnd(&game->scene);
sceneRenderEnd(&game->scene, &game->shader,
uniView, uniProj, uniModel, &uniTexture,
&game->shader,
uniView, uniProj, uniModel, uniTexture
);
}
void sandboxGameDispose(sandboxgame_t *game) {

View File

@ -22,11 +22,21 @@ void sceneRenderStart(scene_t *scene) {
}
void sceneRenderEnd(
scene_t *scene, shader_t *shaderRenderList, shader_t *shaderBackBuffer
scene_t *scene,
shader_t *shaderRenderList,
shaderuniform_t listUniformView, shaderuniform_t listUniformProjection,
shaderuniform_t listUniformModel, shaderuniform_t listUniformTextures[],
shader_t *shaderBackBuffer,
shaderuniform_t backUniformView, shaderuniform_t backUniformProjection,
shaderuniform_t backUniformModel, shaderuniform_t backUniformTexture
) {
if(shaderRenderList == NULL || shaderBackBuffer == NULL) return;
// renderListRender(&scene->renderList, shaderRenderList);
// renderListAsBackbuffer(&scene->renderList, scene->engine, shaderBackBuffer);
renderListRender(&scene->renderList, shaderRenderList,
listUniformView, listUniformProjection,listUniformModel, listUniformTextures
);
renderListAsBackbuffer(&scene->renderList, scene->engine, shaderBackBuffer,
backUniformView, backUniformProjection, backUniformModel, backUniformTexture
);
}
void sceneDispose(scene_t *scene) {

View File

@ -20,5 +20,13 @@ typedef struct {
void sceneInit(scene_t *scene, engine_t *engine);
void sceneRenderStart(scene_t *scene);
void sceneRenderEnd(scene_t *scene);
void sceneRenderEnd(
scene_t *scene,
shader_t *shaderRenderList,
shaderuniform_t listUniformView, shaderuniform_t listUniformProjection,
shaderuniform_t listUniformModel, shaderuniform_t listUniformTextures[],
shader_t *shaderBackBuffer,
shaderuniform_t backUniformView, shaderuniform_t backUniformProjection,
shaderuniform_t backUniformModel, shaderuniform_t backUniformTexture
);
void sceneDispose(scene_t *scene);