DX5 - DirectX Programming #5 Kang, Seongtae Computer...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
DirectX Programming #5 Kang, Seongtae Computer Graphics, 2009 Spring
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Sample Program A blue cylinder with white specular color Gouraud shading with one spotlight
Background image of page 2
Primitives const int CIRCLE_DIVISION = 50; const int PILLAR_DIVISION = 50;
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
User Interface Rotation and panning using mouse ArcBall system
Background image of page 4
We Will… Modify the sample code to use HLSL Creating an effect file which describes functions for Spotlight lighting Gouraud shading Passing variable to the effect Rendering with the effect
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Semantics for VS/PS Input and Output VS and PS 2.0 model Not all semantics are described here Vertex Shader POSITION NORMALn COLORn TEXCOORDn POSITION NORMAL COLORn TEXCOORDn Pixel Shader COLORn DEPTHn VPOS COLORn TEXCOORDn Rasterizer
Background image of page 6
Type Definition Structures for input and output parameters of VS/PS Usual strucutre definition + semantic description Vertex shader input must be matched to the CPU-side vertex description (FVF) struct VS_INPUT { float4 Position : POSITION; float3 Normal : NORMAL; }; struct Gouraud_VS_OUTPUT { float4 Position : POSITION; float4 Color : COLOR0; };
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Type Definition D3D object mappers Just for convenience We will pass D3DLIGHT9 / D3DMATERIAL9 object directly to the effect from CPU-side using this mapping structure struct LIGHT // Light structure which corresponds to D3DLIGHT9 on CPU-side { int Type; // This component will be ignored. We consider the spotlight type only float4 Diffuse; float4 Specular; float4 Ambient; float3 Position; float3 Direction; float Range; float Falloff; float Att0; float Att1; float Att2; float Theta; float Phi; };
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/29/2010 for the course CSE 4190.410 taught by Professor Shinyeonggil during the Spring '09 term at Seoul National.

Page1 / 22

DX5 - DirectX Programming #5 Kang, Seongtae Computer...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online