BooBoo 2.2.9
Posted by tremblin on 2024-11-11, 6:47pm
Avatar

Allows custom vertex shaders. draw_3d now requires normals to be passed to it, or an empty vector if you aren't using them.
Replies (8)
Posted by tremblin on 2024-11-11, 6:51pm
Avatar

Precision qualifiers are gone. Shaders are always high precision now. shader_load looks like this:

number my_shader_obj
shader_load my_shader_obj "vertex_name" "fragment_name"


To load the default vertex/fragment shader, pass "" an empty string.
Posted by tremblin on 2024-11-11, 7:42pm
Avatar

Input and output names for GLSL:

attribute vec3 in_position;
attribute vec3 in_normal;
attribute vec2 in_texcoord;
attribute vec4 in_colour;

varying vec2 texcoord;
varying vec4 colour;
Posted by tremblin on 2024-11-11, 7:43pm
Avatar

For HLSL:

struct VS_INPUT
{
        float3 Position : POSITION0;
        float3 Normal        : NORMAL0;
        float2 TexCoord : TEXCOORD0;
        float4 Colour        : TEXCOORD1;
};

struct VS_OUTPUT
{
        float4 Position : POSITION0;
        float2 TexCoord : TEXCOORD0;
        float4 Colour        : COLOR0;
};
Posted by tremblin on 2024-11-12, 12:13am
Avatar

I made a vertex shader example in git. This will be in 2.2.10. It's a lighting example:

Posted by tremblin on 2024-11-12, 1:52am
Avatar

Have this one in there too

Posted by tremblin on 2024-11-12, 3:11am
Avatar

It works with model animation now also. I previously wasn't transforming normals along with vertices for animation. I will release 2.2.10 now.
Posted by tremblin on 2024-11-12, 6:15am
Avatar



I will upload 2.2.11 sometime which has this example and fixes matrix multiply which might be crashing for some people.
Posted by tremblin on 2024-11-12, 6:48am
Avatar

This is the code for the last video I posted.

number model
model_load model "zeus.x"
model_set_animation model "ArmatureAction"

number shader
shader_load shader "lit_3d_vertex" "lit_3d_fragment"

set_3d

vector start_light_pos light_pos
vector_init start_light_pos 0 0 0 1
vector_init light_pos 0 0 0
vector m
= m (identity 4)

function draw
{
        clear 100 100 255

        shader_use shader
        shader_set_float_vector shader "light_pos" light_pos

        model_draw model 255 255 255 255
}

function run
{
        identity_3d
        translate_3d 0 -0.5 -5
        scale_3d 0.25 0.25 0.25

        = m (mul m (rotate (/ PI 120) 0 1 0))
        = light_pos (mul m (translate 1000 0 0) start_light_pos)
        vector_erase light_pos 3
}
Post a Reply

Please log in to reply.

© 2024 CMYKilluminatiNetwork