Map stuff some more, about to do more packing stuff
This commit is contained in:
@ -27,7 +27,9 @@ void mapUpdate() {
|
||||
memoryCopyRangeSafe(
|
||||
&MAP_DATA.tileIds,
|
||||
&OVERWORLD.tileIds[0],
|
||||
&OVERWORLD.tileIds[OVERWORLD.mapWidth * OVERWORLD.mapHeight],
|
||||
&OVERWORLD.tileIds[
|
||||
OVERWORLD.mapWidth * OVERWORLD.mapHeight * OVERWORLD.mapLayerCount
|
||||
],
|
||||
sizeof(MAP_DATA.tileIds)
|
||||
);
|
||||
|
||||
@ -35,7 +37,7 @@ void mapUpdate() {
|
||||
memoryCopyRangeSafe(
|
||||
&MAP_DATA.mapSize,
|
||||
&OVERWORLD.mapWidth,
|
||||
&OVERWORLD.mapHeight + sizeof(uint8_t),
|
||||
&OVERWORLD.mapLayerCount + sizeof(uint8_t),
|
||||
sizeof(MAP_DATA.mapSize)
|
||||
);
|
||||
|
||||
|
@ -22,13 +22,25 @@ vec2 mapGetVertice(uint instanceIndex, uint indiceIndex) {
|
||||
|
||||
uint mapWidth = packedGetU8(0u, mapSize);
|
||||
uint mapHeight = packedGetU8(1u, mapSize);
|
||||
uint mapLayerCount = packedGetU8(2u, mapSize);
|
||||
|
||||
quad += vec2(
|
||||
float(instanceIndex % mapWidth),
|
||||
float(instanceIndex / mapWidth)
|
||||
);
|
||||
// Get x and y within layer
|
||||
uint x = instanceIndex % mapWidth;
|
||||
uint y = (instanceIndex / mapWidth) % mapHeight;
|
||||
|
||||
// Get quad position, consider layer count
|
||||
quad += vec2(x, y);
|
||||
quad *= mapTileGetSize();
|
||||
|
||||
return quad;
|
||||
}
|
||||
|
||||
uint mapGetLayer(uint instanceIndex) {
|
||||
uint mapWidth = packedGetU8(0u, mapSize);
|
||||
uint mapHeight = packedGetU8(1u, mapSize);
|
||||
return instanceIndex / (mapWidth * mapHeight);
|
||||
}
|
||||
|
||||
uint mapGetTileId(uint instanceIndex) {
|
||||
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
typedef struct {
|
||||
uvec4_t tileIds[OVERWORLD_TILE_COUNT_MAX / MAP_TILE_PACK_SIZE];
|
||||
uint_t mapSize;
|
||||
uvec3_t _padding0;
|
||||
uvec3_t _p0;
|
||||
} mapdata_t;
|
||||
|
||||
extern shaderbuffer_t MAP_BUFFER;
|
||||
|
@ -35,8 +35,8 @@ void transformsUpdate() {
|
||||
);
|
||||
|
||||
glm_lookat(
|
||||
(vec3){ 300, 300, 300 },
|
||||
(vec3){ 0, 0, 0 },
|
||||
(vec3){ 0, 0, 300 },
|
||||
(vec3){ 0, 32, 0 },
|
||||
(vec3){ 0, 1, 0 },
|
||||
TRANSFORMS_DATA.view
|
||||
);
|
||||
|
Reference in New Issue
Block a user