Beispiel #1
0
void
matrix_mouse(int button, int state, int x, int y)
{
    selection = 0;
    
    if (state == GLUT_DOWN) {
        polygon_mouse(x, y);
        /* mouse should only hit _one_ of the cells, so adding up all
        the hits just propagates a single hit. */
        selection += cell_hit(&translation[0], x, y);
        selection += cell_hit(&translation[1], x, y);
        selection += cell_hit(&translation[2], x, y);
        selection += cell_hit(&rotation[0], x, y);
        selection += cell_hit(&rotation[1], x, y);
        selection += cell_hit(&rotation[2], x, y);
        selection += cell_hit(&rotation[3], x, y);
        selection += cell_hit(&scale[0], x, y);
        selection += cell_hit(&scale[1], x, y);
        selection += cell_hit(&scale[2], x, y);
    }
    
    old_y = y;
    
    redisplay_all();
}
Beispiel #2
0
void
spotlight_mouse(int button, int state, int x, int y)
{
    selection = 0;

    if (state == GLUT_DOWN) {
        lighting_mouse(x, y);
        /* mouse should only hit _one_ of the cells, so adding up all
        the hits just propagates a single hit. */
        selection += cell_hit(&spot_direction[0], x, y);
        selection += cell_hit(&spot_direction[1], x, y);
        selection += cell_hit(&spot_direction[2], x, y);
        selection += cell_hit(&spot_exponent, x, y);
        selection += cell_hit(&spot_cutoff, x, y);
        selection += cell_hit(&Kc, x, y);
        selection += cell_hit(&Kl, x, y);
        selection += cell_hit(&Kq, x, y);
    }

    old_y = y;

    redisplay_all();
}
Beispiel #3
0
void
command_mouse(int button, int state, int x, int y)
{
    selection = 0;
    
    if (state == GLUT_DOWN) {
    /* mouse should only hit _one_ of the cells, so adding up all
        the hits just propagates a single hit. */
        selection += cell_hit(&color[0], x, y);
        selection += cell_hit(&color[1], x, y);
        selection += cell_hit(&color[2], x, y);
        selection += cell_hit(&color[3], x, y);
        if (mode == GL_LINEAR) {
            selection += cell_hit(&fstart, x, y);
            selection += cell_hit(&fend, x, y);
        } else {
            selection += cell_hit(&density, x, y);
        }
    }
    
    old_y = y;
    
    redisplay_all();
}
Beispiel #4
0
void
lmodel_mouse(int button, int state, int x, int y)
{
    selection = 0;

    if (state == GLUT_DOWN) {
        lighting_mouse(x, y);
        /* mouse should only hit _one_ of the cells, so adding up all
        the hits just propagates a single hit. */
        selection += cell_hit(&lmodel_Ka[0], x, y);
        selection += cell_hit(&lmodel_Ka[1], x, y);
        selection += cell_hit(&lmodel_Ka[2], x, y);
        selection += cell_hit(&lmodel_Ka[3], x, y);
        selection += cell_hit(&local_viewer, x, y);
        selection += cell_hit(&two_side, x, y);
    }

    old_y = y;

    redisplay_all();
}
Beispiel #5
0
void
command_mouse(int button, int state, int x, int y)
{
    selection = 0;
    
    if (state == GLUT_DOWN) {
        if (mode == PERSPECTIVE) {
        /* mouse should only hit _one_ of the cells, so adding up all
            the hits just propagates a single hit. */
            selection += cell_hit(&perspective[0], x, y);
            selection += cell_hit(&perspective[1], x, y);
            selection += cell_hit(&perspective[2], x, y);
            selection += cell_hit(&perspective[3], x, y);
        } else if (mode == FRUSTUM) {
            selection += cell_hit(&frustum[0], x, y);
            selection += cell_hit(&frustum[1], x, y);
            selection += cell_hit(&frustum[2], x, y);
            selection += cell_hit(&frustum[3], x, y);
            selection += cell_hit(&frustum[4], x, y);
            selection += cell_hit(&frustum[5], x, y);
        } else if (mode == ORTHO) {
            selection += cell_hit(&ortho[0], x, y);
            selection += cell_hit(&ortho[1], x, y);
            selection += cell_hit(&ortho[2], x, y);
            selection += cell_hit(&ortho[3], x, y);
            selection += cell_hit(&ortho[4], x, y);
            selection += cell_hit(&ortho[5], x, y);
        }
        selection += cell_hit(&lookat[0], x, y);
        selection += cell_hit(&lookat[1], x, y);
        selection += cell_hit(&lookat[2], x, y);
        selection += cell_hit(&lookat[3], x, y);
        selection += cell_hit(&lookat[4], x, y);
        selection += cell_hit(&lookat[5], x, y);
        selection += cell_hit(&lookat[6], x, y);
        selection += cell_hit(&lookat[7], x, y);
        selection += cell_hit(&lookat[8], x, y);
    }
    
    old_y = y;
    
    redisplay_all();
}
Beispiel #6
0
void
material_mouse(int button, int state, int x, int y)
{
    selection = 0;

    if (state == GLUT_DOWN) {
        lighting_mouse(x, y);
        /* mouse should only hit _one_ of the cells, so adding up all
        the hits just propagates a single hit. */
        selection += cell_hit(&material_Ka[0], x, y);
        selection += cell_hit(&material_Ka[1], x, y);
        selection += cell_hit(&material_Ka[2], x, y);
        selection += cell_hit(&material_Ka[3], x, y);
        selection += cell_hit(&material_Kd[0], x, y);
        selection += cell_hit(&material_Kd[1], x, y);
        selection += cell_hit(&material_Kd[2], x, y);
        selection += cell_hit(&material_Kd[3], x, y);
        selection += cell_hit(&material_Ks[0], x, y);
        selection += cell_hit(&material_Ks[1], x, y);
        selection += cell_hit(&material_Ks[2], x, y);
        selection += cell_hit(&material_Ks[3], x, y);
        selection += cell_hit(&material_Ke[0], x, y);
        selection += cell_hit(&material_Ke[1], x, y);
        selection += cell_hit(&material_Ke[2], x, y);
        selection += cell_hit(&material_Ke[3], x, y);
        selection += cell_hit(&material_Se, x, y);
    }

    old_y = y;

    redisplay_all();
}
Beispiel #7
0
void
lighting_mouse(int x, int y)
{
    /* mouse should only hit _one_ of the cells, so adding up all
        the hits just propagates a single hit. */
    selection += cell_hit(&light_pos[0], x, y);
    selection += cell_hit(&light_pos[1], x, y);
    selection += cell_hit(&light_pos[2], x, y);
    selection += cell_hit(&light_pos[3], x, y);
    selection += cell_hit(&light_Ka[0], x, y);
    selection += cell_hit(&light_Ka[1], x, y);
    selection += cell_hit(&light_Ka[2], x, y);
    selection += cell_hit(&light_Ka[3], x, y);
    selection += cell_hit(&light_Kd[0], x, y);
    selection += cell_hit(&light_Kd[1], x, y);
    selection += cell_hit(&light_Kd[2], x, y);
    selection += cell_hit(&light_Kd[3], x, y);
    selection += cell_hit(&light_Ks[0], x, y);
    selection += cell_hit(&light_Ks[1], x, y);
    selection += cell_hit(&light_Ks[2], x, y);
    selection += cell_hit(&light_Ks[3], x, y);
}
Beispiel #8
0
void
parameters_mouse(int button, int state, int x, int y)
{
    selection = 0;
    
    if (state == GLUT_DOWN) {
        polygon_mouse(x, y);
        selection += cell_hit(&bcolor[0], x, y);
        selection += cell_hit(&bcolor[1], x, y);
        selection += cell_hit(&bcolor[2], x, y);
        selection += cell_hit(&bcolor[3], x, y);
        selection += cell_hit(&ecolor[0], x, y);
        selection += cell_hit(&ecolor[1], x, y);
        selection += cell_hit(&ecolor[2], x, y);
        selection += cell_hit(&ecolor[3], x, y);
        if (!selection) {
            if (y < 145 && y > 125) {
                if (minfilter == GL_NEAREST)
                    minfilter = GL_LINEAR;
                else if (minfilter == GL_LINEAR)
                    minfilter = GL_NEAREST_MIPMAP_NEAREST;
                else if (minfilter == GL_NEAREST_MIPMAP_NEAREST)
                    minfilter = GL_NEAREST_MIPMAP_LINEAR;
                else if (minfilter == GL_NEAREST_MIPMAP_LINEAR)
                    minfilter = GL_LINEAR_MIPMAP_NEAREST;
                else if (minfilter == GL_LINEAR_MIPMAP_NEAREST)
                    minfilter = GL_LINEAR_MIPMAP_LINEAR;
                else 
                    minfilter = GL_NEAREST;
            } else if (y < 165 && y > 145) {
                if (magfilter == GL_NEAREST)
                    magfilter = GL_LINEAR;
                else
                    magfilter = GL_NEAREST;
            } else if (y < 185 && y > 165) {
                if (wraps == GL_REPEAT)
                    wraps = GL_CLAMP;
                else
                    wraps = GL_REPEAT;
            } else if (y < 205 && y > 185) {
                if (wrapt == GL_REPEAT)
                    wrapt = GL_CLAMP;
                else
                    wrapt = GL_REPEAT;
            } else if (y < 225 && y > 205) {
                if (env == GL_REPLACE_EXT)
                    env = GL_DECAL;
                else if (env == GL_DECAL)
                    env = GL_BLEND;
                else if (env == GL_BLEND)
                    env = GL_MODULATE;
                else
                    env = GL_REPLACE_EXT;
            }
        }
    }
    
    glutSetWindow(screen);
    texenv();
    glutSetWindow(world);
    texenv();
    
    old_y = y;
    
    redisplay_all();
}
Beispiel #9
0
void
polygon_mouse(int x, int y)
{
/* mouse should only hit _one_ of the cells, so adding up all
    the hits just propagates a single hit. */
    selection += cell_hit(&texcoords[0], x, y);
    selection += cell_hit(&texcoords[1], x, y);
    selection += cell_hit(&texcoords[2], x, y);
    selection += cell_hit(&texcoords[3], x, y);
    selection += cell_hit(&texcoords[4], x, y);
    selection += cell_hit(&texcoords[5], x, y);
    selection += cell_hit(&texcoords[6], x, y);
    selection += cell_hit(&texcoords[7], x, y);
    selection += cell_hit(&vertices[0], x, y);
    selection += cell_hit(&vertices[1], x, y);
    selection += cell_hit(&vertices[2], x, y);
    selection += cell_hit(&vertices[3], x, y);
    selection += cell_hit(&vertices[4], x, y);
    selection += cell_hit(&vertices[5], x, y);
    selection += cell_hit(&vertices[6], x, y);
    selection += cell_hit(&vertices[7], x, y);
    selection += cell_hit(&vertices[8], x, y);
    selection += cell_hit(&vertices[9], x, y);
    selection += cell_hit(&vertices[10], x, y);
    selection += cell_hit(&vertices[11], x, y);
    selection += cell_hit(&pcolor[0], x, y);
    selection += cell_hit(&pcolor[1], x, y);
    selection += cell_hit(&pcolor[2], x, y);
    selection += cell_hit(&pcolor[3], x, y);
}
Beispiel #10
0
void
command_mouse(int button, int state, int x, int y)
{
    selection = 0;

    if (state == GLUT_DOWN) {
	/* mouse should only hit _one_ of the cells, so adding up all
           the hits just propagates a single hit. */
	selection += cell_hit(&light[0], x, y);
	selection += cell_hit(&light[1], x, y);
	selection += cell_hit(&light[2], x, y);
	selection += cell_hit(&light[3], x, y);
	selection += cell_hit(&lookat[0], x, y);
	selection += cell_hit(&lookat[1], x, y);
	selection += cell_hit(&lookat[2], x, y);
	selection += cell_hit(&lookat[3], x, y);
	selection += cell_hit(&lookat[4], x, y);
	selection += cell_hit(&lookat[5], x, y);
	selection += cell_hit(&lookat[6], x, y);
	selection += cell_hit(&lookat[7], x, y);
	selection += cell_hit(&lookat[8], x, y);
    }

    old_y = y;

    redisplay_all();
}