multiple textures
This commit is contained in:
parent
1223b56652
commit
579eb9f540
4 changed files with 9 additions and 8 deletions
2
const.h
2
const.h
|
@ -19,7 +19,7 @@ typedef struct Vertex2 {
|
||||||
#define CHUNK_RADIUS_V 4 // 4
|
#define CHUNK_RADIUS_V 4 // 4
|
||||||
|
|
||||||
#define TEXT_GAP_H 1 / 3.0
|
#define TEXT_GAP_H 1 / 3.0
|
||||||
#define TEXT_GAP_V 1 / 1.0
|
#define TEXT_GAP_V 1 / 6.0
|
||||||
|
|
||||||
#define CHUNK_DIAMETER_H (CHUNK_RADIUS_H * 2 + 1)
|
#define CHUNK_DIAMETER_H (CHUNK_RADIUS_H * 2 + 1)
|
||||||
#define CHUNK_DIAMETER_V (CHUNK_RADIUS_V * 2 + 1)
|
#define CHUNK_DIAMETER_V (CHUNK_RADIUS_V * 2 + 1)
|
||||||
|
|
11
cubes.c
11
cubes.c
|
@ -32,11 +32,12 @@ void gen_face(Vertex *cube, int i, int x, int y, int z, int x2, int y2, int z2,
|
||||||
if (is_text) {
|
if (is_text) {
|
||||||
a.pos[i]--;
|
a.pos[i]--;
|
||||||
int exists = 0;
|
int exists = 0;
|
||||||
exists = (cube_exists(x, y, z, dat, ci, read_order) !=
|
int type = cube_exists(x, y, z, dat, ci, read_order);
|
||||||
cube_exists(a.pos[0], a.pos[1], a.pos[2], dat, ci, read_order));
|
int typeB = cube_exists(a.pos[0], a.pos[1], a.pos[2], dat, ci, read_order);
|
||||||
|
exists = ((!!type) != (!!typeB));
|
||||||
|
|
||||||
a2.pos[0] = exists ? TEXT_GAP_H * i : -1.0;
|
a2.pos[0] = exists ? TEXT_GAP_H * (type ? (type - 1) : (typeB-1)) : -1.0;
|
||||||
a2.pos[1] = exists ? TEXT_GAP_V * i : -1.0;
|
a2.pos[1] = exists ? TEXT_GAP_V * (i + (!!type) * 3) : -1.0;
|
||||||
a2.pos[2] = 0;
|
a2.pos[2] = 0;
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
*j = (*j - 6 * a3);
|
*j = (*j - 6 * a3);
|
||||||
|
@ -213,7 +214,7 @@ int gen_cubes(Vertex *cube, Vertex *text, Vertex *cubeO, Vertex *textO, int x,
|
||||||
if (cached) {
|
if (cached) {
|
||||||
thread_return[a2] = i2[a2 / a3];
|
thread_return[a2] = i2[a2 / a3];
|
||||||
thread_id[a2] = -1;
|
thread_id[a2] = -1;
|
||||||
} else if (pos.pos[0] < 0 || pos.pos[1] < 0 || pos.pos[2] < 0 || pos.pos[1] < (y * 0.93)) {
|
} else if (pos.pos[0] < 0 || pos.pos[1] < 0 || pos.pos[2] < 0 || pos.pos[1] < ((y - CHUNK_LENGTH*CHUNK_RADIUS_V) * 1.1)) {
|
||||||
thread_return[a2] = -1;
|
thread_return[a2] = -1;
|
||||||
thread_id[a2] = -1;
|
thread_id[a2] = -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
4
gen.c
4
gen.c
|
@ -139,7 +139,7 @@ Chunk fetch_chunk(int x, int y, int z, int ci, int h, int r_order) {
|
||||||
|
|
||||||
for (int y2 = 0; y2 < CHUNK_LENGTH; y2++) {
|
for (int y2 = 0; y2 < CHUNK_LENGTH; y2++) {
|
||||||
int y3 = y2 + y * CHUNK_LENGTH;
|
int y3 = y2 + y * CHUNK_LENGTH;
|
||||||
chunk.blocks[c] = (y3 < h);
|
chunk.blocks[c] = (y3 < h) ? (((int)((hp + 64.0) * 2.98) % 3) + 1) : 0;
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,5 +182,5 @@ int cube_exists(int x, int y, int z, Chunk dat, int ci, int r_order) {
|
||||||
int h = dat.blocks[(y % CHUNK_LENGTH) + (z % CHUNK_LENGTH) * CHUNK_LENGTH +
|
int h = dat.blocks[(y % CHUNK_LENGTH) + (z % CHUNK_LENGTH) * CHUNK_LENGTH +
|
||||||
(x % CHUNK_LENGTH) * CHUNK_LENGTH * CHUNK_LENGTH];
|
(x % CHUNK_LENGTH) * CHUNK_LENGTH * CHUNK_LENGTH];
|
||||||
|
|
||||||
return !!h;
|
return h;
|
||||||
}
|
}
|
BIN
test.png
BIN
test.png
Binary file not shown.
Before Width: | Height: | Size: 313 B After Width: | Height: | Size: 1.1 KiB |
Loading…
Add table
Add a link
Reference in a new issue