if( mat->shader == k_shader_standard ||
mat->shader == k_shader_standard_cutout ||
mat->shader == k_shader_foliage ||
- mat->shader == k_shader_fxglow )
+ mat->shader == k_shader_fxglow ||
+ mat->shader == k_shader_pipe )
{
keyvalues_read_u32s( &kvs, root, "tex_diffuse", (u32[]){0}, &props->standard.tex_diffuse, 1 );
+ keyvalues_read_u32s( &kvs, root, "tex_normal", (u32[]){0}, &props->standard.tex_normal, 1 );
keyvalues_read_u32s( &kvs, root, "render_flags", (u32[]){0}, &props->standard.render_flags, 1 );
}
else if( mat->shader == k_shader_standard_vertex_blend )
{
*x = _engine.w / fb->resolution_div;
*y = _engine.h / fb->resolution_div;
+
+ if( fb->fixed_ratio != 0.0f )
+ {
+ f32 engine_ratio = (f32)_engine.w / (f32)_engine.h;
+ if( engine_ratio > fb->fixed_ratio )
+ *x = (f32)(*y) * fb->fixed_ratio;
+
+ if( engine_ratio < fb->fixed_ratio )
+ *y = (f32)(*x) / fb->fixed_ratio;
+ }
}
else
{
attachment->purpose == k_framebuffer_attachment_type_texture_depth )
{
glGenTextures( 1, &attachment->tex.name );
- attachment->tex.flags = VG_TEX_COMPLETE|VG_TEX_FRAMEBUFFER_ATTACHMENT|VG_TEX_LINEAR|VG_TEX_CLAMP|VG_TEX_NOMIP;
+ attachment->tex.flags = VG_TEX_COMPLETE|VG_TEX_FRAMEBUFFER_ATTACHMENT|VG_TEX_CLAMP|VG_TEX_NOMIP;
framebuffer_allocate_texture( fb, attachment );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+ if( fb->nearest )
+ {
+ attachment->tex.flags |= VG_TEX_NEAREST;
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
+ }
+ else
+ {
+ attachment->tex.flags |= VG_TEX_LINEAR;
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+ }
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
glFramebufferTexture2D( GL_FRAMEBUFFER, attachment->attachment, GL_TEXTURE_2D, attachment->tex.name, 0 );
struct framebuffer
{
const c8 *display_name;
- int resolution_div, /* If 0: Use fixed_w, fixed_h.
+ i32 resolution_div, /* If 0: Use fixed_w, fixed_h.
If non-0: Automatically size itself to
the window resolution divided by
this value */
render_w, /* The currently rendering resolution */
render_h;
+
+ f32 fixed_ratio;
+ b8 nearest;
+
GLuint id;
u32 attachment_count;