#}
class ent_unlock(Structure):#{
- _fields_ = [("pstr_alias",c_uint32),
+ _fields_ = [("transform",mdl_transform),
+ ("pstr_alias",c_uint32),
("target",c_uint32),
("target_event",c_uint32),
("status",c_uint32)]
elif ent_type == 'ent_unlock':#{
unlock = ent_unlock()
obj_data = obj.SR_data.ent_unlock[0]
+ compile_obj_transform( obj, unlock.transform )
unlock.pstr_alias = sr_compile_string( obj_data.alias )
unlock.target = sr_entity_id( obj_data.target )
unlock.target_event = obj_data.target_event
indexables[] = {
{ k_ent_gate, &world->ent_gate },
{ k_ent_challenge, &world->ent_challenge },
- { k_ent_volume, &world->ent_volume }
+ { k_ent_volume, &world->ent_volume },
+ { k_ent_unlock, &world->ent_unlock }
};
for( u32 i=0; i<vg_list_size(indexables); i++ )
ent_volume *volume = mdl_arritm( &world->ent_volume, index );
return volume->transform.co[axis];
}
+ else if( type == k_ent_unlock ){
+ ent_unlock *unlock = mdl_arritm( &world->ent_unlock, index );
+ return unlock->transform.co[axis];
+ }
else {
vg_fatal_error( "Programming error\n" );
return INFINITY;
#include "world.h"
#include "world_render.h"
+#include "font.h"
+#include "gui.h"
static int ccmd_set_time( int argc, const char *argv[] ){
if( argc == 1 ){
VG_STATIC
void world_render_challenges( world_instance *world, struct world_pass *pass,
- v3f pos ){
+ v3f pos, int layer_depth ){
if( !world ) return;
- glDisable( GL_CULL_FACE );
- mesh_bind( &world->mesh_no_collide );
-
- u32 last_material = 0;
-
+ /* sort lists */
const f32 radius = 40.0f;
-
bh_iter it;
bh_iter_init_range( 0, &it, pos, radius );
i32 idx;
+ u32 challenge_list[ 32 ],
+ unlock_list[ 32 ];
+
+ u32 challenge_count = 0,
+ unlock_count = 0;
+
while( bh_next( world->entity_bh, &it, &idx ) ){
u32 id = world->entity_list[ idx ],
type = mdl_entity_id_type( id ),
index = mdl_entity_id_id( id );
- if( type != k_ent_challenge ) continue;
+ if( type == k_ent_challenge ) {
+ if( challenge_count < vg_list_size(challenge_list) )
+ challenge_list[ challenge_count ++ ] = index;
+ }
+ else if( type == k_ent_unlock ){
+ if( unlock_count < vg_list_size(unlock_list) )
+ unlock_list[ unlock_count ++ ] = index;
+ }
+ }
- ent_challenge *challenge = mdl_arritm(&world->ent_challenge,index);
+ /* render challenges */
+ glDisable( GL_CULL_FACE );
+ mesh_bind( &world->mesh_no_collide );
+ u32 last_material = 0;
+ for( u32 i=0; i<challenge_count; i++ ){
+ u32 index = challenge_list[ i ];
+ ent_challenge *challenge = mdl_arritm( &world->ent_challenge, index );
if( challenge->flags & k_ent_challenge_hidden ) continue;
f32 dist = v3_dist( challenge->transform.co, pos ) * (1.0f/radius),
mdl_draw_submesh( sm );
}
}
-}
-VG_STATIC void render_world_fxglow( world_instance *world, camera *cam ){
- //glDrawBuffers( 1, (GLenum[]){ GL_COLOR_ATTACHMENT0 } );
+ /* render texts */
+ font3d_bind( &gui.font, &skaterift.cam );
+ shader_model_font_uColour( (v4f){1.0f,1.0f,1.0f,1.0f} );
+
+ for( u32 i=0; i<unlock_count; i++ ){
+ u32 index = unlock_list[ i ];
+ ent_unlock *unlock = mdl_arritm( &world->ent_unlock, index );
+ m4x3f mmdl;
+ mdl_transform_m4x3( &unlock->transform, mmdl );
+ font3d_simple_draw( &gui.font, 0, "Test!", &skaterift.cam, mmdl );
+ }
+}
+VG_STATIC void render_world_fxglow( world_instance *world, camera *cam,
+ int layer_depth ){
shader_scene_fxglow_use();
shader_scene_fxglow_uTexMain(1);
shader_scene_fxglow_uPv( cam->mtx.pv );
};
world_render_both_stages( world, &pass );
- world_render_challenges( world, &pass, cam->pos );
+ world_render_challenges( world, &pass, cam->pos, layer_depth );
glEnable(GL_CULL_FACE);
- //glDrawBuffers( 2, (GLenum[]){ GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 } );
}
VG_STATIC void bindpoint_terrain( world_instance *world,
render_world_vb( world, cam );
render_world_alphatest( world, cam );
- render_world_fxglow( world, cam );
+ render_world_fxglow( world, cam, layer_depth );
render_terrain( world, cam );
if( layer_depth == 0 ){