Add state to easyrender objects
This commit is contained in:
parent
ef1df7d160
commit
df78b26686
2
haloo3d
2
haloo3d
@ -1 +1 @@
|
|||||||
Subproject commit b4e784495638c02367be81c84453994e2aae8692
|
Subproject commit 689d9b750cbb221aa3bbdb844beba333ec045a01
|
26
maze.c
26
maze.c
@ -31,7 +31,7 @@
|
|||||||
#define FARCLIP 100.0
|
#define FARCLIP 100.0
|
||||||
#define LIGHTANG -MPI / 4.0
|
#define LIGHTANG -MPI / 4.0
|
||||||
#define AVGWEIGHT 0.85
|
#define AVGWEIGHT 0.85
|
||||||
// Try 0.5 and 6 or something
|
// Try 0.5 and 3.5 or something
|
||||||
#define DITHERSTART 10000
|
#define DITHERSTART 10000
|
||||||
#define DITHEREND 10000
|
#define DITHEREND 10000
|
||||||
|
|
||||||
@ -241,7 +241,8 @@ void maze_generate(uint8_t *maze, int size, struct vec2i *start,
|
|||||||
void create_painting(struct vec2i mazepos, uint8_t dir,
|
void create_painting(struct vec2i mazepos, uint8_t dir,
|
||||||
haloo3d_easyinstancer *ins, mecs *ecs, ecs_world *world) {
|
haloo3d_easyinstancer *ins, mecs *ecs, ecs_world *world) {
|
||||||
// Create the painting render instance, set up the ecs instance, etc.
|
// Create the painting render instance, set up the ecs instance, etc.
|
||||||
haloo3d_obj_instance *painting = haloo3d_easyinstantiate(ins, PAINTINGNAME);
|
haloo3d_obj_instance *painting =
|
||||||
|
haloo3d_easyinstantiate(ins, PAINTINGNAME, H3D_EASYOBJSTATE_NOTRANS);
|
||||||
ecs_eid id = mecs_newentity(ecs, 0);
|
ecs_eid id = mecs_newentity(ecs, 0);
|
||||||
ECS_SETCOMPONENT(ecs, id, ecs_syncgrow){.obj = painting,
|
ECS_SETCOMPONENT(ecs, id, ecs_syncgrow){.obj = painting,
|
||||||
.scale = &world->scaleto,
|
.scale = &world->scaleto,
|
||||||
@ -276,7 +277,8 @@ void kill_flippoly(haloo3d_obj_instance *obj) { free(obj->lighting); }
|
|||||||
void create_flippoly(struct vec2i mazepos, haloo3d_easyinstancer *ins,
|
void create_flippoly(struct vec2i mazepos, haloo3d_easyinstancer *ins,
|
||||||
mecs *ecs, ecs_world *world) {
|
mecs *ecs, ecs_world *world) {
|
||||||
// Create the render instance, set up the ecs instance, etc.
|
// Create the render instance, set up the ecs instance, etc.
|
||||||
haloo3d_obj_instance *poly = haloo3d_easyinstantiate(ins, POLYNAMES[0]);
|
haloo3d_obj_instance *poly =
|
||||||
|
haloo3d_easyinstantiate(ins, POLYNAMES[0], H3D_EASYOBJSTATE_NOTRANS);
|
||||||
vec3(poly->scale.v, 0.15, world->scaleto, 0.15);
|
vec3(poly->scale.v, 0.15, world->scaleto, 0.15);
|
||||||
vec3(poly->pos.v, (mazepos.x + 0.5) * world->state->cellsize, 0.35,
|
vec3(poly->pos.v, (mazepos.x + 0.5) * world->state->cellsize, 0.35,
|
||||||
(mazepos.y + 0.5) * world->state->cellsize);
|
(mazepos.y + 0.5) * world->state->cellsize);
|
||||||
@ -1037,16 +1039,16 @@ int main() { // int argc, char **argv) {
|
|||||||
vec3(light.v, 0, -MCOS(LIGHTANG), MSIN(LIGHTANG));
|
vec3(light.v, 0, -MCOS(LIGHTANG), MSIN(LIGHTANG));
|
||||||
|
|
||||||
// WARN: the order you draw these things can matter greatly!
|
// WARN: the order you draw these things can matter greatly!
|
||||||
haloo3d_obj_instance *walli =
|
haloo3d_obj_instance *walli = haloo3d_easyrender_addinstance(
|
||||||
haloo3d_easyrender_addinstance(&render, wallo, wallt);
|
&render, wallo, wallt, H3D_EASYOBJSTATE_NOTRANS);
|
||||||
haloo3d_obj_instance *floori =
|
haloo3d_obj_instance *floori = haloo3d_easyrender_addinstance(
|
||||||
haloo3d_easyrender_addinstance(&render, planeo, floort);
|
&render, planeo, floort, H3D_EASYOBJSTATE_NOTRANS);
|
||||||
haloo3d_obj_instance *ceili =
|
haloo3d_obj_instance *ceili = haloo3d_easyrender_addinstance(
|
||||||
haloo3d_easyrender_addinstance(&render, planeo, ceilt);
|
&render, planeo, ceilt, H3D_EASYOBJSTATE_NOTRANS);
|
||||||
haloo3d_obj_instance *starti =
|
haloo3d_obj_instance *starti =
|
||||||
haloo3d_easyrender_addinstance(&render, starto, startt);
|
haloo3d_easyrender_addinstance(&render, starto, startt, 0);
|
||||||
haloo3d_obj_instance *endi =
|
haloo3d_obj_instance *endi =
|
||||||
haloo3d_easyrender_addinstance(&render, endo, endt);
|
haloo3d_easyrender_addinstance(&render, endo, endt, 0);
|
||||||
init_mazeinstances(floori, ceili, walli);
|
init_mazeinstances(floori, ceili, walli);
|
||||||
init_billboard(starti, 1.0);
|
init_billboard(starti, 1.0);
|
||||||
init_billboard(endi, 0.25);
|
init_billboard(endi, 0.25);
|
||||||
@ -1144,7 +1146,7 @@ int main() { // int argc, char **argv) {
|
|||||||
|
|
||||||
for (int i = 0; i < NUMMICE; i++) {
|
for (int i = 0; i < NUMMICE; i++) {
|
||||||
haloo3d_obj_instance *mousei =
|
haloo3d_obj_instance *mousei =
|
||||||
haloo3d_easyrender_addinstance(&render, mouseo, mouset);
|
haloo3d_easyrender_addinstance(&render, mouseo, mouset, 0);
|
||||||
init_billboard(mousei, MOUSESCALE);
|
init_billboard(mousei, MOUSESCALE);
|
||||||
// Mouse should be near the floor
|
// Mouse should be near the floor
|
||||||
mousei->pos.y = MOUSESCALE;
|
mousei->pos.y = MOUSESCALE;
|
||||||
|
Loading…
Reference in New Issue
Block a user