cam test
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "display/spritebatch.h"
|
||||
#include "assert/assert.h"
|
||||
#include "rpg/entity/entity.h"
|
||||
#include "display/screen.h"
|
||||
|
||||
#define TILE_WIDTH 1
|
||||
#define TILE_HEIGHT TILE_WIDTH
|
||||
@@ -17,10 +18,6 @@
|
||||
errorret_t sceneMapInit(scenedata_t *data) {
|
||||
cameraInitPerspective(&data->sceneMap.camera);
|
||||
|
||||
data->sceneMap.camera.lookat.position[0] = 3;
|
||||
data->sceneMap.camera.lookat.position[1] = 3;
|
||||
data->sceneMap.camera.lookat.position[2] = 3;
|
||||
|
||||
errorOk();
|
||||
}
|
||||
|
||||
@@ -28,6 +25,19 @@ void sceneMapUpdate(scenedata_t *data) {
|
||||
}
|
||||
|
||||
void sceneMapRender(scenedata_t *data) {
|
||||
const float_t camOffset = 12.0f;
|
||||
const float_t pixelPerfectOffset = tanf(
|
||||
data->sceneMap.camera.perspective.fov / 2.0f
|
||||
) * ((float_t)SCREEN.height / 2.0f);
|
||||
|
||||
glm_vec3_copy((vec3){
|
||||
data->sceneMap.camera.lookat.target[0],
|
||||
data->sceneMap.camera.lookat.target[1] + camOffset,
|
||||
data->sceneMap.camera.lookat.target[2] + pixelPerfectOffset
|
||||
}, data->sceneMap.camera.lookat.position);
|
||||
|
||||
//
|
||||
|
||||
cameraPushMatrix(&data->sceneMap.camera);
|
||||
|
||||
entity_t *ent = ENTITIES;
|
||||
|
||||
Reference in New Issue
Block a user