union mdl_texture *tex = &ctx->model->textures[ i ];
struct mdl_file pack_info = tex->file;
_vg_tex_load_stream( &tex->tex, vg_model_stream_pack_stream( ctx, &pack_info ),
- VG_TEX_REPEAT | VG_TEX_NEAREST | VG_TEX_NOMIP );
+ VG_TEX_REPEAT | VG_TEX_LINEAR | VG_TEX_NOMIP );
}
}
u32 submesh_start,
submesh_count,
pstr_name,
- entity_id, /* upper 16 bits: type, lower 16 bits: index. hgn: 11.06.2025 Is this still used??? */
+ entity_id, /* upper 16 bits: type, lower 16 bits: index. hgn: 11.06.2025 Is this still used???
+ hgn: 25.10.2025 Yes it is. */
armature_id;
};
k_ent_flame = 200,
k_ent_waterfall = 201,
+ k_ent_rb2 = 202,
+ k_ent_heatpipe = 203,
k_ent_max
};
k_light_type_spot = 1
};
+#define ENT_LIGHT_FLAG_DAYTIME 0x1
+#define ENT_LIGHT_FLAG_OFF 0x2
+
struct ent_light
{
struct mdl_transform transform;
- u32 daytime,
+ u32 flags,
type;
f32 colour[4];
f32 angle,
range;
- f32 inverse_world[4][3];
- f32 angle_sin_cos[2];
+
+ union
+ {
+ /* These are temporary, we could remove them from the file structure. */
+ struct
+ {
+ f32 inverse_world[4][3];
+ f32 angle_sin_cos[2];
+ };
+
+ struct
+ {
+ f32 lerp_start[3], lerp_end[3];
+ f32 lerp_duration, timer;
+ };
+ };
};
/* v101 */
pixels[ ((row*desc->width) + x)*desc->channels + i ] = px.rgba[i];
}
}
+
+ if( desc->channels == 4 )
+ {
+ for( i32 y=0; y<desc->height; y ++ )
+ {
+ for( i32 x=0; x<desc->width; x ++ )
+ {
+ u32 ia = ((y*desc->width)+x)*4;
+ if( pixels[ ia+3 ] == 0 )
+ {
+ for( i32 yy=-1; yy<=1; yy++ )
+ {
+ for( i32 xx=-1; xx<=1; xx++ )
+ {
+ i32 sx = x+xx,
+ sy = y+yy;
+ if( sx < 0 ) sx = desc->width-1;
+ if( sy < 0 ) sy = desc->height-1;
+ if( sx >= desc->width ) sx = 0;
+ if( sy >= desc->height ) sy = 0;
+ u32 ib = ((sy*desc->width)+sx)*4;
+ if( pixels[ ib + 3 ] > 1 && pixels[ib+3]!=254 )
+ {
+ pixels[ ia+0 ] = pixels[ ib+0 ];
+ pixels[ ia+1 ] = pixels[ ib+1 ];
+ pixels[ ia+2 ] = pixels[ ib+2 ];
+ pixels[ ia+3 ] = 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
u32 vg_query_qoi_max_compressed_size( const struct qoi_desc *desc )
* -----------------------------------------------------------------------------
*/
-static int ray_aabb1( boxf box, v3f co, v3f dir_inv, f32 dist )
+static b8 ray_aabb1( f32 box[2][3], f32 co[3], f32 dir_inv[3], f32 dist )
{
- v3f v0, v1;
- f32 tmin, tmax;
-
+ f32 v0[3], v1[3],
+ tmin, tmax;
v3_sub( box[0], co, v0 );
v3_sub( box[1], co, v1 );
-
v3_mul( v0, dir_inv, v0 );
v3_mul( v1, dir_inv, v1 );
-
- tmin = vg_minf( v0[0], v1[0] );
- tmax = vg_maxf( v0[0], v1[0] );
- tmin = vg_maxf( tmin, vg_minf( v0[1], v1[1] ));
- tmax = vg_minf( tmax, vg_maxf( v0[1], v1[1] ));
- tmin = vg_maxf( tmin, vg_minf( v0[2], v1[2] ));
- tmax = vg_minf( tmax, vg_maxf( v0[2], v1[2] ));
-
+ tmin = f32_min( v0[0], v1[0] );
+ tmax = f32_max( v0[0], v1[0] );
+ tmin = f32_max( tmin, f32_min( v0[1], v1[1] ));
+ tmax = f32_min( tmax, f32_max( v0[1], v1[1] ));
+ tmin = f32_max( tmin, f32_min( v0[2], v1[2] ));
+ tmax = f32_min( tmax, f32_max( v0[2], v1[2] ));
return (tmax >= tmin) && (tmin <= dist) && (tmax >= 0.0f);
}
return t;
}
-static void closest_point_aabb( f32 p[3], f32 box[2][3], f32 dest[3] )
+static inline void closest_point_aabb( f32 p[3], f32 box[2][3], f32 dest[3] )
{
v3_max( p, box[0], dest );
v3_min( dest, box[1], dest );
}
+
+/* FIXME! SHOULDN't BE INLINE */
+static inline b8 ray_aabb1( f32 box[2][3], f32 co[3], f32 dir_inv[3], f32 dist )
+{
+ f32 v0[3], v1[3],
+ tmin, tmax;
+ v3_sub( box[0], co, v0 );
+ v3_sub( box[1], co, v1 );
+ v3_mul( v0, dir_inv, v0 );
+ v3_mul( v1, dir_inv, v1 );
+ tmin = f32_min( v0[0], v1[0] );
+ tmax = f32_max( v0[0], v1[0] );
+ tmin = f32_max( tmin, f32_min( v0[1], v1[1] ));
+ tmax = f32_min( tmax, f32_max( v0[1], v1[1] ));
+ tmin = f32_max( tmin, f32_min( v0[2], v1[2] ));
+ tmax = f32_min( tmax, f32_max( v0[2], v1[2] ));
+ return (tmax >= tmin) && (tmin <= dist) && (tmax >= 0.0f);
+}