Exemplo n.º 1
0
void InitLightExam()
{
	ZFXCOLOR color(0, 0, 1, 1);
	g_pDevice->SetShadeMode(RS_SHADE_SOLID, 1.0f, &color);
	ZFXVector vU(0, 1, 0);
	ZFXVIEWPORT vp = { 0, 0, 800, 600 };
	g_pDevice->InitStage(60, &vp, 0);
	g_pDevice->SetClippingPlanes(0.1f, 1000.0f);
	g_pDevice->SetMode(EMD_PERSPECTIVE, 0);

	IShaderManager* sm = g_pDevice->GetShaderManager();
	if (g_vshader)
		sm->BindShader(g_vshader);
	if (g_fshader)
		sm->BindShader(g_fshader);
	if (g_vshader || g_fshader)
		sm->EnableShader(true);


	light.Type = LGT_SPOT;
	light.cAmbient.rgba(0.2, 0.2, 0.2, 1);
	light.cDiffuse.rgba(0, 0, 1, 1);
	light.cSpecular.rgba(1, 0, 0, 1);
	light.fAttenuation0 = 1.0f;
	light.fAttenuation1 = 0.0f;
	light.fTheta = 30;
	light.fPhi = 60;
	light.fRange = 50;
	light.vcDirection = ZFXVector(0, 0, 0);
}
Exemplo n.º 2
0
void InitTriangleExam()
{
	ZFXCOLOR color(0, 0, 1, 1);
	g_pDevice->SetShadeMode(RS_SHADE_SOLID, 1.0f, &color);
	ZFXVector vU(0, 1, 0);
	ZFXVIEWPORT vp = { 0, 0, 800, 600 };
	g_pDevice->InitStage(60, &vp, 0);
	g_pDevice->SetClippingPlanes(0.1f, 1000.0f);
	g_pDevice->SetMode(EMD_ORTHOGONAL, 0);

	IShaderManager* sm = g_pDevice->GetShaderManager();
	if (g_vshader)
		sm->BindShader(g_vshader);
	if (g_fshader)
		sm->BindShader(g_fshader);
	if (g_vshader || g_fshader)
		sm->EnableShader(true);

	sm->EnableShader(false);
}