Character is rendering in-game

This commit is contained in:
2021-08-22 23:30:53 -07:00
parent fabb35b7cf
commit 87e7f599a6
20 changed files with 284 additions and 161 deletions

View File

@ -42,7 +42,7 @@
#include "game/poker/pokergame.h" #include "game/poker/pokergame.h"
#include "game/poker/pokerdiscussion.h" #include "game/poker/pokerdiscussion.h"
#include "game/poker/pokergameassets.h" #include "game/poker/pokergameassets.h"
#include "game/poker/pokerrender.h" #include "game/poker/pokerworld.h"
#include "game/poker/pokerui.h" #include "game/poker/pokerui.h"
// Player Input // Player Input
@ -63,6 +63,7 @@
#include "poker/turn.h" #include "poker/turn.h"
#include "poker/winner.h" #include "poker/winner.h"
// User Interface Objects // User Interface Objects
#include "ui/frame.h" #include "ui/frame.h"
#include "ui/label.h" #include "ui/label.h"

View File

@ -8,7 +8,7 @@
#pragma once #pragma once
#include "../../libs.h" #include "../../libs.h"
#include "pokergameassets.h" #include "pokergameassets.h"
#include "pokerrender.h" #include "pokerworld.h"
#include "pokerui.h" #include "pokerui.h"
#include "../../poker/poker.h" #include "../../poker/poker.h"
#include "../../vn/vnconversation.h" #include "../../vn/vnconversation.h"
@ -24,8 +24,8 @@ typedef struct {
/** Assets (Files) for the game. */ /** Assets (Files) for the game. */
pokergameassets_t assets; pokergameassets_t assets;
/** Rendering Engine for the game. */ /** Poker Game World. */
pokerrender_t render; pokerworld_t world;
/** UI For the Game */ /** UI For the Game */
pokerui_t ui; pokerui_t ui;

View File

@ -14,7 +14,9 @@ typedef struct {
font_t font; font_t font;
shader_t shader; shader_t shader;
language_t language; language_t language;
texture_t testTexture;
texture_t testTexture;
texture_t roomTexture; texture_t roomTexture;
texture_t pennyTexture;
} pokergameassets_t; } pokergameassets_t;

View File

@ -11,4 +11,4 @@
typedef struct { typedef struct {
primitive_t skywall; primitive_t skywall;
} pokerrender_t; } pokerworld_t;

View File

@ -17,16 +17,23 @@
/** How many quads the VN Character has. Base, Eyes, Mouth and Eyebrows */ /** How many quads the VN Character has. Base, Eyes, Mouth and Eyebrows */
#define VN_CHARACTER_QUAD_COUNT 4 #define VN_CHARACTER_QUAD_COUNT 4
#define VN_CHARACTER_QUAD_BASE 0
#define VN_CHARACTER_QUAD_EYEBROWS 1
#define VN_CHARACTER_QUAD_EYES 2
#define VN_CHARACTER_QUAD_MOUTH 3
typedef struct { typedef struct {
float x, y, z; float x, y, z;
float yaw, pitch, roll; float yaw, pitch, roll;
float scaleX, scaleY; float scaleX, scaleY;
bool talking; bool talking;
float blinkStart;
primitive_t primitive; primitive_t primitive;
texture_t *texture; texture_t *texture;
int32_t baseWidth, baseHeight; int32_t baseWidth, baseHeight;
int32_t faceX, faceY;
int32_t faceWidth, faceHeight; int32_t faceWidth, faceHeight;
} vncharacter_t; } vncharacter_t;

View File

@ -28,6 +28,8 @@ void skywallInit(primitive_t *primitive) {
r = p * MATH_PI * 2.0f;// Convert % to radians r = p * MATH_PI * 2.0f;// Convert % to radians
} }
r += mathDeg2Rad(90);
// Determine the X/Z for the given radian // Determine the X/Z for the given radian
x = SKYWALL_SIZE * (float)cos(r); x = SKYWALL_SIZE * (float)cos(r);
z = SKYWALL_SIZE * (float)sin(r); z = SKYWALL_SIZE * (float)sin(r);

View File

@ -12,6 +12,7 @@ void renderInit() {
glEnable(GL_BLEND); glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
// Setup the alpha blend function. // Setup the alpha blend function.
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

View File

@ -10,17 +10,29 @@
bool pokerGameInit(game_t *game) { bool pokerGameInit(game_t *game) {
pokergame_t *pokerGame = &game->pokerGame; pokergame_t *pokerGame = &game->pokerGame;
// Load the Assets // Load the Assets.
pokerGameAssetsInit(&pokerGame->assets); pokerGameAssetsInit(&pokerGame->assets);
// Initialize the Visual Novel Engine.
vnSceneInit(&pokerGame->scene,
&pokerGame->assets.font,
&pokerGame->assets.testTexture
);
// Initialize the world // Initialize the world
pokerRenderInit(&pokerGame->render); pokerWorldInit(pokerGame);
vnCharacterInit(pokerGame->scene.characters, &pokerGame->assets.pennyTexture,
1000, 1920,
367,256, 280,280
);
pokerGame->scene.characterCount = 1;
// Initialize the UI. // Initialize the UI.
pokerUiInit(pokerGame); pokerUiInit(pokerGame);
// Prep the VN Conversation Engine. // Add the first action, the game action, and then start the action queue.
vnSceneInit(&pokerGame->scene, &pokerGame->assets.font, &pokerGame->assets.testTexture);
pokerGameActionStartAdd(pokerGame); pokerGameActionStartAdd(pokerGame);
queueNext(&pokerGame->scene.conversation.actionQueue); queueNext(&pokerGame->scene.conversation.actionQueue);
@ -31,17 +43,17 @@ void pokerGameUpdate(game_t *game) {
pokergame_t *pokerGame; pokergame_t *pokerGame;
pokerGame = &game->pokerGame; pokerGame = &game->pokerGame;
// Update the scene // Update the VN Engine.
vnSceneUpdate(&pokerGame->scene, &game->engine); vnSceneUpdate(&pokerGame->scene, &game->engine);
// Bind the shader. // Bind the shader.
shaderUse(&pokerGame->assets.shader); shaderUse(&pokerGame->assets.shader);
// Render the visual novel scene // Render the visual novel scene.
vnSceneRenderWorld(&pokerGame->scene,&game->engine,&pokerGame->assets.shader); vnSceneRenderWorld(&pokerGame->scene,&game->engine,&pokerGame->assets.shader);
// Render the world pokerWorldRender(&pokerGame->world, &game->engine, &pokerGame->assets);
pokerRenderRender(&pokerGame->render, &game->engine, &pokerGame->assets); vnSceneRenderCharacters(&pokerGame->scene, &pokerGame->assets.shader);
// Render the UI // Render the UI
vnSceneRenderGui(&pokerGame->scene, &game->engine, &pokerGame->assets.shader); vnSceneRenderGui(&pokerGame->scene, &game->engine, &pokerGame->assets.shader);
@ -49,8 +61,18 @@ void pokerGameUpdate(game_t *game) {
} }
void pokerGameDispose(game_t *game) { void pokerGameDispose(game_t *game) {
pokerUiDispose(&game->pokerGame); pokergame_t *pokerGame;
pokerRenderDispose(&game->pokerGame.render); pokerGame = &game->pokerGame;
vnSceneDispose(&game->pokerGame.scene);
pokerGameAssetsDispose(&game->pokerGame.assets); //Cleanup the UI
pokerUiDispose(pokerGame);
// Cleanup the world
pokerWorldDispose(pokerGame);
// Destroy the Visual Novel engine.
vnSceneDispose(&pokerGame->scene);
// Unload all assets
pokerGameAssetsDispose(&pokerGame->assets);
} }

View File

@ -13,13 +13,9 @@
#include "../../vn/vnscene.h" #include "../../vn/vnscene.h"
#include "actions/start.h" #include "actions/start.h"
#include "pokerui.h" #include "pokerui.h"
#include "pokerrender.h" #include "pokerworld.h"
#include "actions/start.h" #include "actions/start.h"
#include "../../ui/frame.h"
#include "../../physics/aabb.h"
#include "../../input/input.h"
/** /**
* Initializes the game state for the poker game. * Initializes the game state for the poker game.
* *

View File

@ -7,20 +7,35 @@
#include "pokergameassets.h" #include "pokergameassets.h"
bool pokerGameAssetsInit(pokergameassets_t *assets) { bool pokerGameAssetsInit(pokergameassets_t *assets) {
// Load the game's shader
assetShaderLoad(&assets->shader, assetShaderLoad(&assets->shader,
"shaders/textured.vert", "shaders/textured.frag" "shaders/textured.vert", "shaders/textured.frag"
); );
// Load the game's font
assetFontLoad(&assets->font, "fonts/opensans/OpenSans-Bold.ttf"); assetFontLoad(&assets->font, "fonts/opensans/OpenSans-Bold.ttf");
// Initialize the language buffer.
languageInit(&assets->language, "locale/language/en-US.csv"); languageInit(&assets->language, "locale/language/en-US.csv");
// Load the world textures.
assetTextureLoad(&assets->testTexture, "test_texture.png"); assetTextureLoad(&assets->testTexture, "test_texture.png");
assetTextureLoad(&assets->roomTexture, "textures/pub_skywall.png"); assetTextureLoad(&assets->roomTexture, "world/pub/pub_skywall.png");
// Load the character textures.
assetTextureLoad(&assets->pennyTexture, "characters/penny/sprites/sheet.png");
return true; return true;
} }
void pokerGameAssetsDispose(pokergameassets_t *assets) { void pokerGameAssetsDispose(pokergameassets_t *assets) {
// Now we unload in what is essentially the reverse of the above.
textureDispose(&assets->roomTexture);
textureDispose(&assets->testTexture); textureDispose(&assets->testTexture);
languageDispose(&assets->language); languageDispose(&assets->language);
shaderDispose(&assets->shader);
fontDispose(&assets->font); fontDispose(&assets->font);
shaderDispose(&assets->shader);
} }

View File

@ -1,25 +0,0 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "pokerrender.h"
void pokerRenderInit(pokerrender_t *render) {
skywallInit(&render->skywall);
}
void pokerRenderRender(
pokerrender_t *render, engine_t *engine, pokergameassets_t *assets
) {
// Render the wall
shaderUseTexture(&assets->shader, &assets->roomTexture);
shaderUsePosition(&assets->shader, 0, 0, 0, 0,engine->time.current/3,0);
primitiveDraw(&render->skywall, 0, -1);
}
void pokerRenderDispose(pokerrender_t *render) {
primitiveDispose(&render->skywall);
}

View File

@ -1,36 +0,0 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
#include "../../display/shader.h"
#include "../../display/primitive.h"
#include "../../display/primitives/skywall.h"
#include "../../vn/vnscene.h"
/**
* Initialize the poker renderer.
*
* @param render Render to initialize.
*/
void pokerRenderInit(pokerrender_t *render);
/**
* Render the poker game.
* @param render Renderer to use.
* @param engine Engine for rendering.
* @param assets Poker game assets.
*/
void pokerRenderRender(
pokerrender_t *render, engine_t *engine, pokergameassets_t *assets
);
/**
* Cleanup the poker renderer.
* @param render Render to dispose.
*/
void pokerRenderDispose(pokerrender_t *render);

View File

@ -0,0 +1,26 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "pokerworld.h"
void pokerWorldInit(pokergame_t *game) {
// Initialize the skywal
skywallInit(&game->world.skywall);
}
void pokerWorldRender(
pokerworld_t *world, engine_t *engine, pokergameassets_t *assets
) {
// Render the wall
shaderUseTexture(&assets->shader, &assets->roomTexture);
shaderUsePosition(&assets->shader, 0, 0, 0, 0,0,0);
primitiveDraw(&world->skywall, 0, -1);
}
void pokerWorldDispose(pokergame_t *game) {
primitiveDispose(&game->world.skywall);
}

View File

@ -0,0 +1,37 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
#include "../../display/shader.h"
#include "../../display/primitive.h"
#include "../../display/primitives/skywall.h"
#include "../../vn/vnscene.h"
/**
* Initialize the poker renderer.
*
* @param game Game to initialize for.
*/
void pokerWorldInit(pokergame_t *game);
/**
* Render the poker world.
*
* @param world Poker Game World.
* @param engine Game engine.
* @param assets Assets to use.
*/
void pokerWorldRender(
pokerworld_t *world, engine_t *engine, pokergameassets_t *assets
);
/**
* Cleanup the poker world.
* @param game Game to clean up for.
*/
void pokerWorldDispose(pokergame_t *game);

View File

@ -8,6 +8,7 @@
#pragma once #pragma once
#include <dawn/dawn.h> #include <dawn/dawn.h>
#include "../../display/animation/queue.h" #include "../../display/animation/queue.h"
#include "../dealer.h"
#include "../bet.h" #include "../bet.h"
#include "../player.h" #include "../player.h"

View File

@ -34,7 +34,7 @@ void frameSetInnerSize(frame_t *frame, float width, float height) {
float bottomStart = FRAME_BORDER_SIZE + height; float bottomStart = FRAME_BORDER_SIZE + height;
float bottomEnd = bottomStart + FRAME_BORDER_SIZE; float bottomEnd = bottomStart + FRAME_BORDER_SIZE;
float tw = 0.33333; float tw = 1.0f / 3.0f;
float th = tw; float th = tw;
// Buffer the top left edge // Buffer the top left edge

View File

@ -7,14 +7,16 @@
#include "vncharacter.h" #include "vncharacter.h"
void vnCharacterInit( void vnCharacterInit(
vncharacter_t *character, texture_t *texture, vncharacter_t *character, texture_t *texture,
int32_t baseWidth, int32_t baseHeight, int32_t baseWidth, int32_t baseHeight,
int32_t faceX, int32_t faceY,
int32_t faceWidth, int32_t faceHeight int32_t faceWidth, int32_t faceHeight
) { ) {
character->x = 0; character->x = 0.5f;
character->y = 0; character->y = -1.17f;
character->z = 0; character->z = -0.35f;
character->yaw = 0; character->yaw = 0;
character->pitch = 0; character->pitch = 0;
@ -23,97 +25,115 @@ void vnCharacterInit(
character->scaleX = 1; character->scaleX = 1;
character->scaleY = 1; character->scaleY = 1;
character->talking = false; character->texture = texture;
character->talking = true;
character->blinkStart = 0;
// Init the primitive. // Init the primitive.
character->texture = texture;
primitiveInit(&character->primitive, primitiveInit(&character->primitive,
QUAD_VERTICE_COUNT * VN_CHARACTER_QUAD_COUNT, QUAD_VERTICE_COUNT * VN_CHARACTER_QUAD_COUNT,
QUAD_INDICE_COUNT * VN_CHARACTER_QUAD_COUNT QUAD_INDICE_COUNT * VN_CHARACTER_QUAD_COUNT
); );
character->baseWidth = baseWidth; character->baseWidth = baseWidth;
character->baseHeight = baseHeight; character->baseHeight = baseHeight;
character->faceX = faceX;
character->faceY = faceY;
character->faceWidth = faceWidth; character->faceWidth = faceWidth;
character->faceHeight = faceHeight; character->faceHeight = faceHeight;
// Buffer the base quad, this never changes (currently) // Buffer the base quad, this never changes (currently)
quadBuffer(&character->primitive, 0, _vnCharacterBuffer(character,
0,0,0,0, 0, 0, baseWidth, baseHeight, 0, 0, 0
((float)baseWidth / (float)baseHeight), baseHeight, 1, 1,
0, 0
); );
_vnCharacterFaceBuffer(character, 0, 0, VN_CHARACTER_QUAD_EYEBROWS);
_vnCharacterFaceBuffer(character, 0, 1, VN_CHARACTER_QUAD_EYES);
_vnCharacterFaceBuffer(character, 0, 2, VN_CHARACTER_QUAD_MOUTH);
}
// character->blinkStart = randFloatRange(0, VN_CHARACTER_BLINK_TIME_RANGE_MAX); void _vnCharacterBuffer(vncharacter_t *character,
int32_t x, int32_t y, int32_t width, int32_t height, int32_t tx, int32_t ty,
int32_t i
) {
// Calc size for each pixel.
float ps = 1.0f / (float)character->baseHeight;// Prefer Height
float tpx = 1.0f / (float)character->texture->width;
float tpy = 1.0f / (float)character->texture->height;
// character->name = ""; // Center on the X axis
x -= (float)character->baseWidth / 2.0f;
// // Setup Textures // Put on the feet
// character->textureEyes = textureEyes; y -= character->baseHeight;
// character->textureBody = textureBody;
// character->textureMouth = textureMouth;
// character->textureFace = textureFace;
// // Tileset quadBuffer(&character->primitive, 0.001f * (float)i,
// tilesetInit(&character->tilesetEyes, 1, 6, (float)x * ps, 1 - (float)y * ps,
// textureEyes->width, textureEyes->height, (float)tx * tpx, (float)ty * tpy,
// 0, 0, 0, 0 (float)(x + width) * ps, 1 - (float)(y + height) * ps,
// ); (float)(tx + width) * tpx, (float)(ty + height) * tpy,
// tilesetInit(&character->tilesetMouth, 1, 11, i * QUAD_VERTICE_COUNT, i * QUAD_INDICE_COUNT
// textureMouth->width, textureMouth->height, );
// 0, 0, 0, 0 }
// );
// vnCharacterSetEyes(character, 0); void _vnCharacterFaceBuffer(vncharacter_t *character,
// vnCharacterSetMouth(character, 9); int32_t col, int32_t row, int32_t i
) {
// div.x0 = 0, div.x1 = 1; _vnCharacterBuffer(character,
// div.y0 = 0, div.y1 = 1; character->faceX, character->faceY,
character->faceWidth, character->faceHeight,
// _vnCharacterQuad(&character->primitiveBody, &div); character->baseWidth + (character->faceWidth * col),
// _vnCharacterQuad(&character->primitiveFace, &div); character->faceHeight * row,
i
);
} }
void vnCharacterUpdate(vncharacter_t *character, engine_t *engine) { void vnCharacterUpdate(vncharacter_t *character, engine_t *engine) {
// float n; float n;
// // Update the blinking frames // Update the blinking frames
// n = (engine->time.current - character->blinkStart) * 1.5; n = (engine->time.current - character->blinkStart) * 3.0f;
// if(n >= 1) { if(n > 1.0f) {
// character->blinkStart = engine->time.current + randFloatRange( character->blinkStart = engine->time.current + randFloatRange(
// 1, VN_CHARACTER_BLINK_TIME_RANGE_MAX 1, VN_CHARACTER_BLINK_TIME_RANGE_MAX
// ); );
// } else if(n > 0) { } else if(n > 0) {
// n = easeInQuad(easeTimeToForwardAndBackward(n) * 2); n = easeInQuad(easeTimeToForwardAndBackward(n) * 4);
// vnCharacterSetEyes(character, n * character->tilesetEyes.count); _vnCharacterFaceBuffer(character,
// } (int32_t)n, 1, VN_CHARACTER_QUAD_EYES
);
}
// // Updating the talking frames // Updating the talking frames
// if(character->talking) { if(character->talking) {
// vnCharacterSetMouth(character, n = easeTimeToForwardAndBackward(fmod(engine->time.current * 1.6, 1)) * 6;
// (int32_t)(engine->time.current*12) % character->tilesetMouth.count _vnCharacterFaceBuffer(character,
// ); (int32_t)n, 2, VN_CHARACTER_QUAD_MOUTH
// } else { );
// vnCharacterSetMouth(character, 9); } else {
// } _vnCharacterFaceBuffer(character,
0, 2, VN_CHARACTER_QUAD_MOUTH
);
}
// // Update the scale frames // Update the scale frames for talking/breathing
// float speed, amount; float speed, amount;
// if(character->talking) { if(character->talking) {
// speed = 2.5; speed = 1.0f;
// amount = 100; amount = 400.0f;
// n = easeTimeToForwardAndBackward(fmod(engine->time.current, 1 / speed) * speed) * 2; } else {
// n = easeInOutQuad(n) / amount - (1/(amount*2)); speed = 0.4f;
// character->scaleX = 1 + n; amount = 400.0f;
// character->scaleY = 1 - n; // n = easeTimeToForwardAndBackward(fmod(engine->time.current, speed) / speed)*2;
// } else { // n = easeInOutCubic(n) / amount - (1/(amount*2));
// speed = 10; // character->scaleX = 1 + n;
// amount = 50; // character->scaleY = 1 + n*2;
// n = easeTimeToForwardAndBackward(fmod(engine->time.current, speed) / speed)*2; }
// n = easeInOutCubic(n) / amount - (1/(amount*2));
// character->scaleX = 1 + n; n = easeTimeToForwardAndBackward(fmod(engine->time.current, 1 / speed) * speed) * 2.0f;
// character->scaleY = 1 + n*2; n = easeInOutQuad(n) / amount - (1/(amount*2));
// } character->scaleX = 1 + n;
character->scaleY = 1 - n;
} }
void vnCharacterRender(vncharacter_t *character, shader_t *shader) { void vnCharacterRender(vncharacter_t *character, shader_t *shader) {
@ -125,4 +145,8 @@ void vnCharacterRender(vncharacter_t *character, shader_t *shader) {
shaderUseTexture(shader, character->texture); shaderUseTexture(shader, character->texture);
primitiveDraw(&character->primitive, 0, -1); primitiveDraw(&character->primitive, 0, -1);
}
void vnCharacterDispose(vncharacter_t *character) {
primitiveDispose(&character->primitive);
} }

View File

@ -13,10 +13,56 @@
#include "../display/shader.h" #include "../display/shader.h"
#include "../display/primitives/quad.h" #include "../display/primitives/quad.h"
/**
* Initialize a VN Character.
*
* @param character Character to initialize.
* @param texture The characters' texture.
* @param baseWidth The width of the base character within the texture.
* @param baseHeight The height of the base character within the texture.
* @param faceX The X position on the face that the faces are cropped.
* @param faceY The Y position on the face that the faces are cropped.
* @param faceWidth The width of the cropped face.
* @param faceHeight The height of the cropped face.
*/
void vnCharacterInit( void vnCharacterInit(
vncharacter_t *character, texture_t *texture, vncharacter_t *character, texture_t *texture,
int32_t baseWidth, int32_t baseHeight, int32_t baseWidth, int32_t baseHeight,
int32_t faceX, int32_t faceY,
int32_t faceWidth, int32_t faceHeight int32_t faceWidth, int32_t faceHeight
); );
/**
* Buffer part of a VN Character texture onto the primitive. All the below units
* are believed to be in pixels, the relatives will be recalculated on the fly.
*
* @param character Character to buffer to.
* @param x Local X position of the VN Character to buffer to.
* @param y Local Y positon of the VN character to buffer to.
* @param width Width of the subarea.
* @param height Height of the subarea.
* @param tx Texture X position.
* @param ty Texture Y position.
* @param i Quad index to buffer to.
*/
void _vnCharacterBuffer(vncharacter_t *character,
int32_t x, int32_t y, int32_t width, int32_t height, int32_t tx, int32_t ty,
int32_t i
);
/**
* Buffer the face of a VN Character to the primitive.
*
* @param character Character to buffer to.
* @param col Face Column.
* @param row Face Row.
* @param i Quad index to buffer to.
*/
void _vnCharacterFaceBuffer(vncharacter_t *character,
int32_t col, int32_t row, int32_t i
);
void vnCharacterUpdate(vncharacter_t *character, engine_t *engine); void vnCharacterUpdate(vncharacter_t *character, engine_t *engine);
void vnCharacterRender(vncharacter_t *character, shader_t *shader); void vnCharacterRender(vncharacter_t *character, shader_t *shader);
void vnCharacterDispose(vncharacter_t *character);

View File

@ -33,8 +33,6 @@ void vnSceneDispose(vnscene_t *scene) {
} }
void vnSceneRenderWorld(vnscene_t *scene, engine_t *engine, shader_t *shader) { void vnSceneRenderWorld(vnscene_t *scene, engine_t *engine, shader_t *shader) {
uint8_t i;
// Adjust 3D Space position // Adjust 3D Space position
cameraLookAt(&scene->camera, cameraLookAt(&scene->camera,
0.5, 0.5, 0.75, 0.5, 0.5, 0.75,
@ -42,14 +40,18 @@ void vnSceneRenderWorld(vnscene_t *scene, engine_t *engine, shader_t *shader) {
); );
// Set Camera Perspective // Set Camera Perspective
cameraPerspective(&scene->camera, 45, cameraPerspective(&scene->camera, 35,
engine->render.width/engine->render.height, engine->render.width/engine->render.height,
0.01f, 1000.0f 0.01f, 1000.0f
); );
// Update Shader // Update Shader
shaderUseCamera(shader, &scene->camera); shaderUseCamera(shader, &scene->camera);
}
void vnSceneRenderCharacters(vnscene_t *scene, shader_t *shader) {
uint8_t i;
// Render each character // Render each character
for(i = 0; i < scene->characterCount; i++) { for(i = 0; i < scene->characterCount; i++) {
vnCharacterRender(scene->characters + i, shader); vnCharacterRender(scene->characters + i, shader);

View File

@ -21,4 +21,6 @@ void vnSceneDispose(vnscene_t *scene);
void vnSceneRenderWorld(vnscene_t *scene, engine_t *engine, shader_t *shader); void vnSceneRenderWorld(vnscene_t *scene, engine_t *engine, shader_t *shader);
void vnSceneRenderCharacters(vnscene_t *scene, shader_t *shader);
void vnSceneRenderGui(vnscene_t *scene, engine_t *engine, shader_t *shader); void vnSceneRenderGui(vnscene_t *scene, engine_t *engine, shader_t *shader);