Beispiel #1
0
global
void drag_box(RECT r,
              RECT *bound,
              RECT *dist,
              RECT *last
             )
{
	G_i mb, x, y;
	RECT old = r;
	
	l_color(BLACK);

	wr_mode(MD_XOR);
	new_box(&r, nil);

	do
	{
		Syield();
		vq_mouse(C.vh, &mb, &x, &y);

		r = move_rectangle(x, y, r, dist);
		keep_inside(&r, bound);			/* Ensure we are inside the bounding rectangle */
		new_box(&r, &old);
		
	} while (mb);

	new_box(&r,nil);
	wr_mode(MD_TRANS);

	*last = r;
}
Beispiel #2
0
global
void rubber_box(COMPASS cp,
                RECT r,
                RECT *dist,
                int minw, int minh,
                int maxw, int maxh,
                RECT *last)
{
	G_i x, y, mb;
	RECT old = r;
	
	l_color(BLACK);

	wr_mode(MD_XOR);
	new_box(&r, nil);

	do
	{
		Syield();
		vq_mouse(C.vh, &mb, &x, &y);

		r = widen_rectangle(cp, x, y, r, dist);
		check_wh(&r, minw, minh, maxw, maxh);
		new_box(&r, &old);

	} while(mb);
	
	new_box(&r, nil);
	wr_mode(MD_TRANS);

	*last = r;
}
Beispiel #3
0
global
void line(G_i x, G_i y, G_i x1, G_i y1, int col)
{
	G_i pxy[4];

	pxy[0]=x;pxy[2]=x1;
	pxy[1]=y;pxy[3]=y1;
	l_color(col);
	v_pline(C.vh,2,pxy);
}
Beispiel #4
0
global
void write_menu_line(RECT *cl)
{
	G_i pnt[4];
	l_color(BLACK);
	pnt[0] = cl->x;
	pnt[1] = cl->y + MENU_H;
	pnt[2] = cl->x + cl->w - 1;
	pnt[3] = pnt[1];
	v_pline(C.vh,2,pnt);
}
Beispiel #5
0
void Cube::Draw(int type, const Camera& camera,const Light& light){
	
    //Get new position of the cube and update the model view matrix
    Eigen::Affine3f wMo;//object to world matrix
    Eigen::Affine3f cMw;
    Eigen::Affine3f proj;

    glUseProgram(m_shader);
#ifdef __APPLE__
    glBindVertexArrayAPPLE(m_vertexArrayObject); 
#else
	glBindVertexArray(m_vertexArrayObject);
#endif
    
    glBindBuffer(GL_ARRAY_BUFFER, m_vertexBufferObject);//use as current buffer
  
	GLuint camera_position = glGetUniformLocation(m_shader, "cameraPosition");
    GLuint light_position = glGetUniformLocation(m_shader, "lightPosition");
	GLuint color = glGetUniformLocation(m_shader, "Color");

    GLuint object2world = glGetUniformLocation(m_shader, "wMo");
    GLuint world2camera = glGetUniformLocation(m_shader, "cMw"); 
	GLuint projection = glGetUniformLocation(m_shader, "proj");

    wMo = m_Trans;

    proj = Util::Perspective( camera.m_fovy, camera.m_aspect, camera.m_znear, camera.m_zfar );
	cMw = camera.m_cMw;//Angel::LookAt(camera.position,camera.lookat, camera.up );
 
    glUniformMatrix4fv( object2world , 1, GL_FALSE, wMo.data() );
    glUniformMatrix4fv( world2camera, 1, GL_FALSE, cMw.data());
    glUniformMatrix4fv( projection, 1, GL_FALSE, proj.data());
	glUniform4fv(camera_position, 1, camera.m_position.data());
    glUniform4fv(light_position, 1, light.m_position.data());
	Eigen::Vector4f l_color(m_Color[0],m_Color[1],m_Color[2],1.0);
  	glUniform4fv(color,1,l_color.data());
	
	switch (type) {
        case DRAW_MESH:
            glDrawArrays(GL_LINES, 0, 36);
            break;
        case DRAW_PHONG:
            glDrawArrays(GL_TRIANGLES, 0, 36);
            break;
    }
    

}
Beispiel #6
0
global
void br_hook(int d, RECT *r, int col)
{
	G_i pnt[6],
	    x = r->x - d,
	    y = r->y - d,
	    w = r->w + d+d,
	    h = r->h + d+d;
	l_color(col);
	pnt[0] = x + PW;
	pnt[1] = y + h - 1;
	pnt[2] = x + w - 1;
	pnt[3] = y + h - 1;
	pnt[4] = x + w - 1;
	pnt[5] = y + PW;
	v_pline(C.vh, 3, pnt);
}
Beispiel #7
0
global
void d3_pushbutton(int d, RECT *r, OBJC_COLOURS *col, int state, int thick, int mode)
{
	G_u selected = state&SELECTED;
	int t, j, outline;

	thick = -thick;		/* make thick same direction as d (positive value --> LARGER!) */

	if (thick > 0)		/* outside thickness */
		d += thick;
	d += 2;
	
	if (mode&1)			/* fill ? */
	{
		if (col == nil)
			f_color(screen.dial_colours.bg_col);
		/* otherwise set by set_colours() */
		gbar(d, r);						/* inside bar */
	}

	j = d;
	t = abs(thick);
	outline = j;

#if NAES3D
	if (default_options.naes and !(mode&2))
	{	
		l_color(screen.dial_colours.fg_col);
		
		while (t > 0)
		{
			gbox(j, r);					/* outside box */
			t--, j--;
		}
	
		br_hook(j, r, selected ? screen.dial_colours.lit_col : screen.dial_colours.shadow_col);
		tl_hook(j, r, selected ? screen.dial_colours.shadow_col : screen.dial_colours.lit_col);
	}
	else
#endif
	{
		do
		{
			br_hook(j, r, selected ? screen.dial_colours.lit_col : screen.dial_colours.shadow_col);
			tl_hook(j, r, selected ? screen.dial_colours.shadow_col : screen.dial_colours.lit_col);
			t--, j--;
		} while (t >= 0);
	
	    if (    thick
	        and !(mode&2)		/* full outline ? */
	       )
		{
			l_color(screen.dial_colours.fg_col);
			gbox(outline, r);					/* outside box */
		}
	}

	shadow_object(outline, state, r, screen.dial_colours.border_col, thick);

	l_color(screen.dial_colours.border_col);
}