void DrawAxis(float size)
	{
		glLineWidth(5.0f);
		g_MVPMatrix->PushMatrix();

		SetUtilsColor(1.0f, 0.0f, 0.0f, 1.0f);
		DrawBegin(CL_LINES);
		clVertex3(0.0f, 0.0f, 0.0f);
		clVertex3(size, 0.0f, 0.0f);
		DrawEnd();

		SetUtilsColor(0.0f, 1.0f, 0.0f, 1.0f);
		DrawBegin(CL_LINES);
		clVertex3(0.0f, 0.0f, 0.0f);
		clVertex3(0.0f, size, 0.0f);
		DrawEnd();

		SetUtilsColor(0.0f, 0.0f, 1.0f, 1.0f);
		DrawBegin(CL_LINES);
		clVertex3(0.0f, 0.0f, 0.0f);
		clVertex3(0.0f, 0.0f, size);
		DrawEnd();

		g_MVPMatrix->PopMatrix();
		glLineWidth(1.0f);
	}
	void DrawLine(const Vector3Df& l1, const Vector3Df& l2)
	{
		DrawBegin(CL_LINES);
		clVertex3(l1.x, l1.y, l1.z);
		clVertex3(l2.x, l2.y, l2.z);
		DrawEnd();
	}
void AABoundingBox::DebugDraw() const
{
    SetUtilsColor(Color::White);
    GetCurrentProgram()->SetUniform("emissive", 1.0f);

    DrawBegin(CL_LINES);
    clVertex3(m_min.x, m_min.y, m_min.z);
    clVertex3(m_min.x, m_min.y, m_max.z);
    clVertex3(m_min.x, m_min.y, m_min.z);
    clVertex3(m_max.x, m_min.y, m_min.z);
    clVertex3(m_min.x, m_min.y, m_max.z);
    clVertex3(m_max.x, m_min.y, m_max.z);
    clVertex3(m_max.x, m_min.y, m_min.z);
    clVertex3(m_max.x, m_min.y, m_max.z);

    clVertex3(m_min.x, m_max.y, m_min.z);
    clVertex3(m_min.x, m_max.y, m_max.z);
    clVertex3(m_min.x, m_max.y, m_min.z);
    clVertex3(m_max.x, m_max.y, m_min.z);
    clVertex3(m_min.x, m_max.y, m_max.z);
    clVertex3(m_max.x, m_max.y, m_max.z);
    clVertex3(m_max.x, m_max.y, m_min.z);
    clVertex3(m_max.x, m_max.y, m_max.z);

    clVertex3(m_min.x, m_min.y, m_min.z);
    clVertex3(m_min.x, m_max.y, m_min.z);
    clVertex3(m_min.x, m_min.y, m_max.z);
    clVertex3(m_min.x, m_max.y, m_max.z);
    clVertex3(m_max.x, m_min.y, m_min.z);
    clVertex3(m_max.x, m_max.y, m_min.z);
    clVertex3(m_max.x, m_min.y, m_max.z);
    clVertex3(m_max.x, m_max.y, m_max.z);
    DrawEnd();
}
	void DeferredLight_Ambient::ApplyLight(const Vector3Df& cameraPos, GLTexture* renderTarget0, GLTexture* renderTarget1, GLTexture* renderTarget2)
	{
		UNUSED(cameraPos)
        UNUSED(renderTarget0)
        UNUSED(renderTarget1)
        UNUSED(renderTarget2)

		g_MVPMatrix->SetProjectionMode(CL_ORTHOGRAPHIC);

		g_MVPMatrix->PushMatrix();
		g_MVPMatrix->LoadIdentity();

		SetGLProgram(m_glProgram);

		SetUniform("lightColor", m_color);
		SetUniform("intensity", m_intensity);

		DrawBegin(CL_QUADS);
		{
			clVertex3(0.0f,			 0.0f,		     0.0f);
			clVertex3(WINDOW_WIDTHf, 0.0f,		     0.0f);
			clVertex3(WINDOW_WIDTHf, WINDOW_HEIGHTf, 0.0f);
			clVertex3(0.0f,		     WINDOW_HEIGHTf, 0.0f);
		}
		DrawEnd();

		SetGLProgram(NULL);

		g_MVPMatrix->SetProjectionMode(CL_PROJECTION);
		g_MVPMatrix->PopMatrix();
	}
Esempio n. 5
0
extern "C" int rglGetScreenPitch()
{
    int pitch;
    DrawBegin();
    pitch = scrpitch;
    DrawEnd();
    return pitch;
}
	void DrawLineCircle(const Vector2Df& pos, float spaceing, float radius)
	{
		float radSpacing = DegreesToRadians(spaceing);

		DrawBegin(CL_LINES);
		for(float i = 0; i <= 2 * 3.1415f; i += radSpacing)
		{
			clVertex3(pos.x + cos(i) * radius,				pos.y + sin(i) * radius, 0.0f);
			clVertex3(pos.x + cos(i + radSpacing) * radius,	pos.y + sin(i + radSpacing) * radius, 0.0f);
		}
		DrawEnd();
	}
	void DrawPlus(float x, float y, float z, float size)
	{
		DrawBegin(CL_LINES);
		clVertex3(x - size, y, z);
		clVertex3(x + size, y, z);

		clVertex3(x, y - size, z);
		clVertex3(x, y + size, z);

		clVertex3(x, y, z - size);
		clVertex3(x, y, z + size);
		DrawEnd();
	}
	void DrawArrow(const Vector3Df& from, const Vector3Df& to)
	{
		SetUtilsColor(1.0f, 1.0f, 1.0f, g_CurrentColor.a);

		DrawBegin(CL_LINES);
		clColor4(1.0f, 0.0f, 0.0f, g_CurrentColor.a);
		clVertex3(from.x, from.y, from.z);
		clColor4(0.0f, 1.0f, 0.0f, g_CurrentColor.a);
		clVertex3(to.x, to.y, to.z);
		DrawEnd();

		SetUtilsColor(0.0f, 1.0f, 0.0f, g_CurrentColor.a);
		DrawPlus(to, 0.1f);
	}
Esempio n. 9
0
static void rglCopyToUnpitchedScratchBuffer()
{
    BOOL bSave = bSaveFramebuffer;

    bSaveFramebuffer = FALSE;

    if (!DrawBegin())
    {
        bSaveFramebuffer = bSave;
        return;
    }
    rglswPitchedCopy(scratch_buffer, 2*SCRWIDTH,
                     scrbuf, scrpitch,
                     SCRWIDTH, SCRHEIGHT);

    bSaveFramebuffer = bSave;
}
Esempio n. 10
0
static void rglCopyToScratchBuffer()
{
    BOOL bSave = bSaveFramebuffer;

    if (!useDirectDraw) return;

    bSaveFramebuffer = FALSE;

    if (!DrawBegin())
    {
        bSaveFramebuffer = bSave;
        return;
    }
    rglswPitchedCopy(scratch_buffer, scratch_pitch,
                     scrbuf, scrpitch,
                     SCRWIDTH, SCRHEIGHT);
    DrawEnd();

    bSaveFramebuffer = bSave;
}
Esempio n. 11
0
	void FullScreenPass(int width, int height)
	{
		g_MVPMatrix->PushMatrix();
		g_MVPMatrix->LoadIdentity();
		g_MVPMatrix->SetProjectionMode(CL_ORTHOGRAPHIC);
		DrawBegin(CL_QUADS);
		{
			clVertex3(0.0f,  0.0f, 0.0f);
			clVertex3((float)width, 0.0f, 0.0f);
			clVertex3((float)width, (float)height, 0.0f);
			clVertex3(0.0f,  (float)height, 0.0f);

			clTexCoord(0, 0);
			clTexCoord(1, 0);
			clTexCoord(1, 1);
			clTexCoord(0, 1);
		}
		DrawEnd();
		g_MVPMatrix->SetProjectionMode(CL_PROJECTION);
		g_MVPMatrix->PopMatrix();
	}
	void DeferredLight_Directional::ApplyLight(const Vector3Df& cameraPos, GLTexture* renderTarget0, GLTexture* renderTarget1, GLTexture* renderTarget2)
	{
		UNUSED(cameraPos)

		g_MVPMatrix->SetProjectionMode(CL_ORTHOGRAPHIC);

		g_MVPMatrix->PushMatrix();
		g_MVPMatrix->LoadIdentity();

		SetGLProgram(m_glProgram);

        SetUtilsColor(m_color);

		SetTexture("renderTarget0", renderTarget0);
		SetTexture("renderTarget1", renderTarget1);
		SetTexture("renderTarget2", renderTarget2);

		SetUniform("intensity", m_intensity);
		SetUniform("lightDir", m_lightDir);

		DrawBegin(CL_QUADS);
		{
			clVertex3(0.0f,					0.0f,				 0.0f);
			clVertex3((float)WINDOW_WIDTH,	0.0f,				 0.0f);
			clVertex3((float)WINDOW_WIDTH, (float)WINDOW_HEIGHT, 0.0f);
			clVertex3(0.0f,				   (float)WINDOW_HEIGHT, 0.0f);

			clTexCoord(0, 0);
			clTexCoord(1, 0);
			clTexCoord(1, 1);
			clTexCoord(0, 1);
		}
		DrawEnd();

		SetGLProgram(NULL);

		g_MVPMatrix->SetProjectionMode(CL_PROJECTION);
		g_MVPMatrix->PopMatrix();
	}
Esempio n. 13
0
File: game.cpp Progetto: rtmf/mclone
    void Draw()
    {
        DrawBegin();

        // Draw the background TODO: Fix glitches over the edge of the level?
        for (int x=0;x<=(320/16);x++)
        {
            for (int y=0;y<=(240/16);y++)
            {
                DrawTile(x*16-(xscroll/4)%16,y*16-(yscroll/4)%16,
                        (x+1)*16-(xscroll/4)%16,(y+1)*16-(yscroll/4)%16,17);
            }
        }

        // Draw each tile plane
        for (IPlane i = Planes.begin(); i != Planes.end(); i++) (*i)->Draw(-xscroll,-yscroll,rsb);

        // Draw each plumber
        for (IMover i = Movers.begin(); i != Movers.end(); i++) (*i)->Draw(-xscroll,-yscroll);

        // Draw each fallers
        for (IFaller i = Fallers.begin(); i != Fallers.end(); i++) (*i)->Draw(-xscroll,-yscroll);
        
        // Diagnostic information HUD
        if (PBACK->jumping)
          DrawTile(0,240-16,16,240,484);

        if (PBACK->jumpthrust>0)
          DrawTile(16,240-16,32,240,4*32+19);

        if (diagCollision)
          DrawTile(32,240-16,48,240,64*32+9);

        // Relinquish the GL
        DrawEnd();

        static unsigned int errstore=0;
        glError("Game::Draw()", &errstore);
    }
Esempio n. 14
0
// ////////////////////////////////////////////////////////////////////////////
BOOL runKeyMapEditor(void)
{
	UDWORD id;

	id = widgRunScreen(psWScreen);						// Run the current set of widgets 
	
	if(id == KM_RETURN)			// return
	{
		saveKeyMap();
		changeTitleMode(TITLE);
	}
	if(id == KM_DEFAULT)	
	{
		keyClearMappings();
		keyInitMappings(TRUE);
		widgDelete(psWScreen,FRONTEND_BACKDROP);// readd the widgets
		startKeyMapEditor(FALSE);
	}
	else if( id>=KM_START && id<=KM_END)
	{
		 pushedKeyMap(id);
	}
	
	if(selectedKeyMap)
	{
		id = scanKeyBoardForBinding();
		if(id)
		{
			pushedKeyCombo(id); 
		}
	}
	
	DrawBegin();
	StartCursorSnap(&InterfaceSnap);
	widgDisplayScreen(psWScreen);						// show the widgets currently running
	DrawEnd();

	return TRUE;
}
Esempio n. 15
0
	void DrawDebugBBox(const Vector3Df& pos, const Vector3Df& dimensions)
	{
		float vertices[] =
		{
			-1.0f,  1.0f,  1.0f,
			-1.0f, -1.0f,  1.0f,
			 1.0f, -1.0f,  1.0f,
			 1.0f,  1.0f,  1.0f,

			 1.0f,  1.0f, -1.0f,
			 1.0f, -1.0f, -1.0f,
			-1.0f, -1.0f, -1.0f,
			-1.0f,  1.0f, -1.0f,

			 1.0f, -1.0f,  1.0f,
			 1.0f, -1.0f, -1.0f,
			 1.0f,  1.0f, -1.0f,
			 1.0f,  1.0f,  1.0f,

			-1.0f,  1.0f,  1.0f,
			-1.0f,  1.0f, -1.0f,
			-1.0f, -1.0f, -1.0f,
			-1.0f, -1.0f,  1.0f,

			 1.0f,  1.0f,  1.0f, 
			 1.0f,  1.0f, -1.0f, 
			-1.0f, 1.0f, -1.0f, 
			-1.0f, 1.0f,  1.0f, 

			 1.0f, -1.0f, -1.0f,
			 1.0f, -1.0f,  1.0f,
			-1.0f, -1.0f,  1.0f,
			-1.0f, -1.0f, -1.0f,
		};

		const float hx = dimensions.x * 0.5f;
		const float hy = dimensions.y * 0.5f;
		const float hz = dimensions.z * 0.5f;

		for(int i = 0; i < 72; i += 3)
		{
			vertices[i] *= hx;
			vertices[i + 1] *= hy;
			vertices[i + 2] *= hz;

			vertices[i] += pos.x;
			vertices[i + 1] += pos.y;
			vertices[i + 2] += pos.z;
		}

		float currentAlpha = g_CurrentColor.a;

		glEnable(GL_BLEND);
		glDisable(GL_DEPTH_TEST);
		g_CurrentColor.a = .1f;
		DrawBegin(CL_LINES);
			for(int i = 0; i < 6; ++i)
			{
				const int ROW_INDEX = i * 12;
				for(int j = 0; j < 4; ++j)
				{
					const int index1 = ROW_INDEX + j * 3;
					const int index2 = ROW_INDEX + (j == 3 ? 0 : (j + 1) * 3);

					clVertex3(vertices[index1], vertices[index1 + 1], vertices[index1 + 2]);
					clVertex3(vertices[index2], vertices[index2 + 1], vertices[index2 + 2]);
				}
			}
		DrawEnd();

		glEnable(GL_DEPTH_TEST);
		g_CurrentColor.a = currentAlpha;
		DrawBegin(CL_LINES);
		for(int i = 0; i < 6; ++i)
		{
			const int ROW_INDEX = i * 12;
			for(int j = 0; j < 4; ++j)
			{
				const int index1 = ROW_INDEX + j * 3;
				const int index2 = ROW_INDEX + (j == 3 ? 0 : (j + 1) * 3);

				clVertex3(vertices[index1], vertices[index1 + 1], vertices[index1 + 2]);
				clVertex3(vertices[index2], vertices[index2 + 1], vertices[index2 + 2]);
			}
		}
		DrawEnd();

		g_CurrentColor.a = .05f;
		DrawBegin(CL_QUADS);
		for(int i = 0; i < 72; i += 3)
		{
			clVertex3(vertices[i], vertices[i+1], vertices[i+2]);
		}
		DrawEnd();
	}
Esempio n. 16
0
extern "C" void LockBuffers()
{
    DrawBegin();
}