Пример #1
0
void SYS::pop_2d() {
#ifdef WIN32
	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();
	glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
#endif
	gsMatrixMode(GS_MODELVIEW);
	gsPopMatrix();
	gsMatrixMode(GS_PROJECTION);
	gsPopMatrix();
	gsMatrixMode(GS_MODELVIEW);
	GPU_SetDepthTestAndWriteMask(true, GPU_GREATER, GPU_WRITE_ALL);
}
Пример #2
0
void drawScene(camera_s* c, portal_s* p, int depth, u8 stencil)
{
	if(!c)return;

	gsMatrixMode(GS_MODELVIEW);
	gsPushMatrix();
		gsLoadIdentity();
		useCamera(c);

		drawRoom(&testRoom);

		drawCubeDispensers();
		drawEnergyDevices();
		drawEnergyBalls();
		drawPlatforms();
		drawBigButtons();
		drawTimedButtons();
		drawWallDoors();
		drawDoors();
		drawOBBs();

		if(p && depth)drawPlayer(&testPlayer);
		
		drawSludge(&testRoom);

		drawEmancipators();
		drawEmancipationGrids();

		if(p == &portals[0])drawPortals((portal_s*[]){&portals[0]}, 1, drawScene, c, depth, stencil);
Пример #3
0
void SYS::push_2d() {
#ifdef WIN32
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glLoadIdentity();
	gluOrtho2D(0, m_width, 0, m_height);

	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glLoadIdentity();
#endif
	gsMatrixMode(GS_PROJECTION);
	gsPushMatrix();
	gsOrthoMatrix(400.0f, 240.0f, -1.0f, 1.0f);
	
	gsMatrixMode(GS_MODELVIEW);
	gsPushMatrix();
	gsLoadIdentity();
	GPU_SetDepthTestAndWriteMask(true, GPU_ALWAYS, GPU_WRITE_ALL);
}
Пример #4
0
// topscreen
void renderMenuFrame(u32* outBuffer, u32* outDepthBuffer)
{
	GPU_SetViewport((u32*)osConvertVirtToPhys((u32)outDepthBuffer),(u32*)osConvertVirtToPhys((u32)outBuffer),0,0,240,400);
	
	GPU_DepthMap(-1.0f, 0.0f);
	GPU_SetFaceCulling(GPU_CULL_FRONT_CCW);
	GPU_SetStencilTest(false, GPU_ALWAYS, 0x00, 0xFF, 0x00);
	GPU_SetStencilOp(GPU_STENCIL_KEEP, GPU_STENCIL_KEEP, GPU_STENCIL_KEEP);
	GPU_SetBlendingColor(0,0,0,0);
	GPU_SetDepthTestAndWriteMask(true, GPU_GREATER, GPU_WRITE_ALL);
	
	GPUCMD_AddMaskedWrite(GPUREG_0062, 0x1, 0); 
	GPUCMD_AddWrite(GPUREG_0118, 0);
	
	GPU_SetAlphaBlending(GPU_BLEND_ADD, GPU_BLEND_ADD, GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA);
	GPU_SetAlphaTest(false, GPU_ALWAYS, 0x00);
	
	GPU_SetTextureEnable(GPU_TEXUNIT0);
	
	GPU_SetTexEnv(0, 
		GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, GPU_PRIMARY_COLOR),
		GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, GPU_PRIMARY_COLOR),
		GPU_TEVOPERANDS(0,0,0), 
		GPU_TEVOPERANDS(0,0,0), 
		GPU_MODULATE, GPU_MODULATE, 
		0xFFFFFFFF);
	GPU_SetDummyTexEnv(1);
	GPU_SetDummyTexEnv(2);
	GPU_SetDummyTexEnv(3);
	GPU_SetDummyTexEnv(4);
	GPU_SetDummyTexEnv(5);

	gsMatrixMode(GS_MODELVIEW);
	gsPushMatrix();
		gsLoadIdentity();
		useCamera(&menuCamera);

		gsSwitchRenderMode(md2GsMode);
		md2InstanceDraw(&gladosInstance);
		md2InstanceDraw(&gladosLairInstance);

	gsPopMatrix();

	GPU_SetDepthTestAndWriteMask(true, GPU_ALWAYS, GPU_WRITE_ALL);
	
	if(currentCameraState==2)
	{
		gsPushMatrix();
			gsSwitchRenderMode(-1);

			GPU_SetAttributeBuffers(
				1, // number of attributes
				(u32*)osConvertVirtToPhys(logoBaseAddr), // we use the start of linear heap as base since that's where all our buffers are located
				GPU_ATTRIBFMT(0, 3, GPU_FLOAT), // we want v0 (vertex position)
				0xFFE, // mask : we want v0
				0x0, // permutation : we use identity
				1, // number of buffers : we have one attribute per buffer
				(u32[]){(u32)logoRectangleVertexData-logoBaseAddr}, // buffer offsets (placeholders)
				(u64[]){0x0}, // attribute permutations for each buffer
				(u8[]){1} // number of attributes for each buffer
				);

			gsSetShader(&logoProgram);

			gsMatrixMode(GS_MODELVIEW);
			gsLoadIdentity();

			gsPushMatrix();
				gsTranslate(0.15f, 0.325f, 0.0f);
				gsScale(64.0f * 2.0f / 240.0f, 64.0f * 2.0f / 400.0f, 1.0f);

				gsTranslate(0.5f, 0.5f, 0.0f);
				gsRotateZ(logoangle+=0.01f);
				gsTranslate(-0.5f, -0.5f, 0.0f);

				gsUpdateTransformation();

				textureBind(&rotateLogoTexture, GPU_TEXUNIT0);
				GPU_SetFloatUniform(GPU_VERTEX_SHADER, logoUniformTextureDimensions, (u32*)(float[]){0.0f, 0.0f, 1.0f, 1.0f}, 1);