Weaather baseline
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
#include "asset/loader/assetloader.h"
|
||||
#include "asset/loader/assetentry.h"
|
||||
|
||||
#include "util/memory.h"
|
||||
|
||||
errorret_t sceneOverworldInit(scenedata_t *sceneData) {
|
||||
assertNotNull(sceneData, "Scene data cannot be null");
|
||||
errorOk();
|
||||
@@ -40,55 +42,67 @@ errorret_t sceneOverworldRender(scenedata_t *sceneData) {
|
||||
sceneoverworld_t *overworld = &sceneData->overworld;
|
||||
sceneOverworldCullUpdate(overworld);
|
||||
|
||||
errorChain(displaySetState((displaystate_t){
|
||||
.flags = DISPLAY_STATE_FLAG_DEPTH_TEST | DISPLAY_STATE_FLAG_CULL
|
||||
}));
|
||||
|
||||
mat4 model;
|
||||
|
||||
|
||||
// Overworld camera
|
||||
errorChain(shaderBind(&SHADER_UNLIT));
|
||||
errorChain(shaderSetMatrix(
|
||||
&SHADER_UNLIT, SHADER_UNLIT_MODEL, SCENE.screenIdentity
|
||||
));
|
||||
|
||||
// Model
|
||||
glm_mat4_identity(model);
|
||||
errorChain(shaderSetMatrix(&SHADER_UNLIT, SHADER_UNLIT_MODEL, model));
|
||||
|
||||
// Camera projection
|
||||
rpgCameraUpdateProjection();
|
||||
errorChain(shaderSetMatrix(
|
||||
&SHADER_UNLIT, SHADER_UNLIT_PROJECTION, RPG_CAMERA.projection
|
||||
));
|
||||
|
||||
// Camera Eye
|
||||
rpgCameraUpdateEye();
|
||||
errorChain(shaderSetMatrix(
|
||||
&SHADER_UNLIT, SHADER_UNLIT_VIEW, RPG_CAMERA.eye
|
||||
));
|
||||
|
||||
// Base terrain meshes, drawn with normal depth testing.
|
||||
// Chunk tiles
|
||||
errorChain(displaySetState((displaystate_t){
|
||||
.flags = DISPLAY_STATE_FLAG_DEPTH_TEST | DISPLAY_STATE_FLAG_CULL
|
||||
}));
|
||||
errorChain(sceneOverworldDrawChunksBase(overworld));
|
||||
|
||||
// Entities are drawn with depth testing fully disabled so sloped tiles
|
||||
// (ramps) never clip them; entity-vs-entity overlap falls back to
|
||||
// array draw order instead of true depth.
|
||||
|
||||
// Entities
|
||||
errorChain(displaySetState((displaystate_t){
|
||||
.flags = DISPLAY_STATE_FLAG_CULL
|
||||
}));
|
||||
|
||||
// Entities
|
||||
for(uint8_t i = 0; i < ENTITY_COUNT; i++) {
|
||||
entity_t *ent = &ENTITIES[i];
|
||||
if(ent->type == ENTITY_TYPE_NULL) continue;
|
||||
errorChain(sceneOverworldDrawEntity(overworld, ent));
|
||||
}
|
||||
|
||||
// Other chunk meshes (trees, buildings, etc), drawn last with normal
|
||||
// depth testing so they correctly occlude entities standing beneath
|
||||
// them.
|
||||
// Chunk props
|
||||
errorChain(displaySetState((displaystate_t){
|
||||
.flags = DISPLAY_STATE_FLAG_DEPTH_TEST | DISPLAY_STATE_FLAG_CULL
|
||||
}));
|
||||
errorChain(sceneOverworldDrawChunksProps(overworld));
|
||||
|
||||
// Weather effects
|
||||
// errorChain(shaderSetMatrix(
|
||||
// &SHADER_UNLIT, SHADER_UNLIT_PROJECTION, SCENE.screenProj
|
||||
// ));
|
||||
// errorChain(shaderSetMatrix(
|
||||
// &SHADER_UNLIT, SHADER_UNLIT_VIEW, SCENE.screenView
|
||||
// ));
|
||||
// errorChain(displaySetState((displaystate_t){
|
||||
// .flags = DISPLAY_STATE_FLAG_BLEND
|
||||
// }));
|
||||
|
||||
// spritebatchsprite_t skyboxSprite;
|
||||
// memoryZero(&skyboxSprite, sizeof(spritebatchsprite_t));
|
||||
// skyboxSprite.max[0] = (float_t)(SCREEN.width / SCREEN.scaleUi);
|
||||
// skyboxSprite.max[1] = (float_t)(SCREEN.height / SCREEN.scaleUi);
|
||||
// shadermaterial_t skyboxMaterial = {
|
||||
// .unlit = { .color = color(0xFF, 0x00, 0x00, 0xFF/2), .texture = NULL }
|
||||
// };
|
||||
// errorChain(spriteBatchBuffer(&skyboxSprite, 1, &SHADER_UNLIT, skyboxMaterial));
|
||||
// errorChain(spriteBatchFlush());
|
||||
|
||||
errorOk();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user