pixel?
This commit is contained in:
@@ -12,8 +12,9 @@
|
||||
#include "rpg/entity/entity.h"
|
||||
#include "display/screen.h"
|
||||
#include "rpg/rpgcamera.h"
|
||||
#include "util/memory.h"
|
||||
|
||||
#define TILE_SIZE 8
|
||||
#define TILE_SIZE 1
|
||||
|
||||
errorret_t sceneMapInit(scenedata_t *data) {
|
||||
cameraInitPerspective(&data->sceneMap.camera);
|
||||
@@ -42,7 +43,7 @@ void sceneMapRender(scenedata_t *data) {
|
||||
);
|
||||
|
||||
// Apply pixel perfect offset and camera offset
|
||||
const float_t camOffset = 32.0f;
|
||||
const float_t camOffset = 0.01f;
|
||||
const float_t pixelPerfectOffset = tanf(
|
||||
data->sceneMap.camera.perspective.fov / 2.0f
|
||||
) * ((float_t)SCREEN.height / 2.0f);
|
||||
@@ -53,6 +54,22 @@ void sceneMapRender(scenedata_t *data) {
|
||||
data->sceneMap.camera.lookat.target[2] + pixelPerfectOffset
|
||||
}, data->sceneMap.camera.lookat.position);
|
||||
|
||||
// TESTING ONLY
|
||||
camera_t backup = data->sceneMap.camera;
|
||||
cameraInitOrthographic(&data->sceneMap.camera);
|
||||
data->sceneMap.camera.projType = CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC;
|
||||
glm_vec3_copy((vec3){
|
||||
RPG_CAMERA.position[0] * TILE_SIZE,
|
||||
RPG_CAMERA.position[1] * TILE_SIZE,
|
||||
10.0f
|
||||
}, data->sceneMap.camera._2d.position);
|
||||
data->sceneMap.camera.orthographic.left = 0.0f;
|
||||
data->sceneMap.camera.orthographic.right = SCREEN.width;
|
||||
data->sceneMap.camera.orthographic.top = 0.0f;
|
||||
data->sceneMap.camera.orthographic.bottom = SCREEN.height;
|
||||
data->sceneMap.camera.nearClip = -100.0f;
|
||||
data->sceneMap.camera.farClip = 100.0f;
|
||||
|
||||
// Push camera
|
||||
cameraPushMatrix(&data->sceneMap.camera);
|
||||
|
||||
@@ -65,6 +82,9 @@ void sceneMapRender(scenedata_t *data) {
|
||||
|
||||
// Finished, pop back camera.
|
||||
cameraPopMatrix();
|
||||
|
||||
//END TESTING
|
||||
data->sceneMap.camera = backup;
|
||||
}
|
||||
|
||||
void sceneMapRenderEntity(entity_t *entity) {
|
||||
@@ -73,7 +93,8 @@ void sceneMapRenderEntity(entity_t *entity) {
|
||||
if(entity->type == ENTITY_TYPE_NULL) return;
|
||||
|
||||
vec3 posMin, posMax;
|
||||
glm_vec3_scale(entity->position, TILE_SIZE, posMin);
|
||||
// glm_vec3_scale(entity->position, TILE_SIZE, posMin);
|
||||
posMin[0] = 1, posMin[1] = 1, posMin[2] = 0;
|
||||
glm_vec3_add(posMin, (vec3){TILE_SIZE, TILE_SIZE, TILE_SIZE }, posMax);
|
||||
|
||||
vec2 uv0 = { 0.0f, 0.0f };
|
||||
|
||||
Reference in New Issue
Block a user