Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

marcalva

Light?

This topic is 5938 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I''m trying to create a light, but I can''t. could somebody help me? ************************ procedure TForm1.DXDrawInitializeSurface(Sender: TObject); var View : TD3DViewport7; Material : TD3DMaterial7; Proyeccion : TD3DMatrix; Camara : TD3DMatrix; Normal : TD3DVector; Luz : TD3DLight7; begin // Crea el viewport. FillChar (View, SizeOf (View), 0); View.dwX := 0; View.dwY := 0; View.dwWidth := DXDraw.SurfaceWidth; View.dwHeight := DXDraw.SurfaceHeight; View.dvMinZ := 0.0; View.dvMaxZ := 1.0; DXDraw.D3DDevice7.SetViewport (View); // Crea el material. { FillChar (Material, SizeOf (Material), 0); Material.ambient.r := 1.0; Material.ambient.g := 1.0; Material.ambient.b := 1.0; Material.diffuse.r := 1.0; Material.diffuse.g := 1.0; Material.diffuse.b := 1.0; DXDraw.D3DDevice7.SetMaterial (Material); DXDraw.D3DDevice7.SetRenderState (D3DRENDERSTATE_AMBIENT, $ffffffff);} // Crea la luz. FillChar (Luz, SizeOf (Luz), 0); Luz.dltType := D3DLIGHT_DIRECTIONAL; Luz.dcvAmbient.r := 1.0; Luz.dcvAmbient.g := 1.0; Luz.dcvAmbient.b := 1.0; { Luz.dcvDiffuse.r := 1.0; Luz.dcvDiffuse.g := 1.0; Luz.dcvDiffuse.b := 1.0; Luz.dcvSpecular.r := 1.0; Luz.dcvSpecular.g := 1.0; Luz.dcvSpecular.b := 1.0;} Luz.dvPosition := MakeD3DVector (0, 0, -5); Luz.dvDirection := MakeD3DVector (0, 0, 0); Luz.dvRange := 10; // Luz.dvFalloff := 10; Luz.dvPhi := Pi/4; DXDraw.D3DDevice7.SetLight (0, Luz); DXDraw.D3DDevice7.SetRenderState (D3DRENDERSTATE_LIGHTING, Cardinal (True)); // Crea la matriz de proyeccion. FillChar (Proyeccion, SizeOf (Proyeccion), 0); Proyeccion._11 := 2.0; Proyeccion._22 := 2.0; Proyeccion._33 := 1.0; Proyeccion._34 := 1.0; Proyeccion._43 := -1.0; DXDraw.D3DDevice7.SetTransform (D3DTRANSFORMSTATE_PROJECTION, Proyeccion); // Coloca la camara. FillChar (Camara, SizeOf (Camara), 0); Camara._11 := 1.0; Camara._22 := cos (-0.5); Camara._23 := sin (-0.5); Camara._32 := -sin (-0.5); Camara._33 := cos (-0.5); Camara._43 := 3.0; Camara._44 := 1.0; DXDraw.D3DDevice7.SetTransform (D3DTRANSFORMSTATE_VIEW, Camara); // Crea el cuadro. Normal := MakeD3DVector (0.0, 0.0, -1.0); Cuadro [0] := MakeD3DVertex (MakeD3DVector (-1.0, 1.0, 0.0), Normal, 0.0, 0.0); Cuadro [1] := MakeD3DVertex (MakeD3DVector ( 1.0, 1.0, 0.0), Normal, 0.0, 1.0); Cuadro [2] := MakeD3DVertex (MakeD3DVector (-1.0, -1.0, 0.0), Normal, 1.0, 0.0); Cuadro [3] := MakeD3DVertex (MakeD3DVector ( 1.0, -1.0, 0.0), Normal, 1.0, 1.0); // Activa el reloj. DXTimer.Enabled := True; end;

Share this post


Link to post
Share on other sites
Advertisement
Uhh... You may be forgetting to enable the light itself. In C++, the call is:
IDirect3DDevice8::LightEnable(DWORD LightIndex, BOOL bEnable);
Hope this helps.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!