GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


A Paste by Anonymous
1
 
// fragment.glsl::Fig. 1
//
// see: uv_camera_setup.gif

varying vec3 look_at;

uniform vec3 eye;
uniform vec3 light;
uniform vec3 bnd_min;
uniform vec3 bnd_max;
uniform vec3 p_vis;
uniform vec3 m_vis;
uniform int inside_box;


void get_trace_line(inout vec3 start, inout vec3 end)
{
    // if inside box, eye is the start position, otherwise, start at edge of box

    if(1 == inside_box)
    {
        start = eye;
    }
    else
    {
        if(0.5 < p_vis.x)
        {
        
        }
        else
        {
        
        }
    }
}

void main()
{
    // divide the mean side length by 100
    float march_len = 0.003333333333333333 * (abs(bnd_max.x - bnd_min.x) + abs(bnd_max.y - bnd_min.y) + abs(bnd_max.z - bnd_min.z));

    vec3 march_step = normalize(look_at) * march_len;

    vec3 start, end;
    get_trace_line(start, end);
    
    gl_FragColor.a = 1.0;    
}