]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - src/server/voxelctx.h
Cull liquid faces next to unloaded nodes
[dragonblocks_alpha.git] / src / server / voxelctx.h
1 #ifndef _VOXELCTX_H_
2 #define _VOXELCTX_H_
3
4 #define VOXELCTXSTATE(ctx) (*((VoxelctxState *) (ctx)->statestack.fst->dat))
5
6 #include <dragonstd/list.h>
7 #include <linmath.h/linmath.h>
8 #include "server/server_terrain.h"
9 #include "types.h"
10
11 typedef struct {
12         vec4 pos;
13         vec3 scale;
14         mat4x4 mat;
15         f32 h, s, l;
16         s32 life;
17 } VoxelctxState;
18
19 typedef struct {
20         v3s32 pos;
21         List *changed_chunks;
22         TerrainGenStage tgs;
23         List statestack;
24         s32 random;
25 } Voxelctx;
26
27 Voxelctx *voxelctx_create(List *changed_chunks, TerrainGenStage tgs, v3s32 pos);
28 void voxelctx_delete(Voxelctx *ctx);
29 void voxelctx_hue(Voxelctx *ctx, f32 value);
30 void voxelctx_sat(Voxelctx *ctx, f32 value);
31 void voxelctx_light(Voxelctx *ctx, f32 value);
32 void voxelctx_life(Voxelctx *ctx, s32 value);
33 void voxelctx_x(Voxelctx *ctx, f32 value);
34 void voxelctx_y(Voxelctx *ctx, f32 value);
35 void voxelctx_z(Voxelctx *ctx, f32 value);
36 void voxelctx_rx(Voxelctx *ctx, f32 value);
37 void voxelctx_ry(Voxelctx *ctx, f32 value);
38 void voxelctx_rz(Voxelctx *ctx, f32 value);
39 void voxelctx_sx(Voxelctx *ctx, f32 value);
40 void voxelctx_sy(Voxelctx *ctx, f32 value);
41 void voxelctx_sz(Voxelctx *ctx, f32 value);
42 void voxelctx_s(Voxelctx *ctx, f32 value);
43 void voxelctx_pop(Voxelctx *ctx);
44 void voxelctx_push(Voxelctx *ctx);
45 bool voxelctx_is_alive(Voxelctx *ctx);
46 void voxelctx_cube(Voxelctx *ctx, NodeType node, bool use_color);
47 void voxelctx_cylinder(Voxelctx *ctx, NodeType node, bool use_color);
48 f32 voxelctx_random(Voxelctx *ctx, f32 base, f32 vary);
49
50 #endif // _VOXELCTX_H_