Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
HLSL-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
// ******************************************************* //************ Texturen*********************************** DWORD NumTextures = 1; STRING Texture1Filename = "Terrain.png"; DWORD Texture1Type = 1; // 1: 2D-Textur; 2: Würfel; 3: Volumen DWORD Texture1ColorKey = 0x00000000; TEXTURE Texture1; // ******************************************************* //************ Matrizen*********************************** float4x4 World; float4x4 View; float4x4 Prj; // ******************************************************* //************ Sampler************************************ sampler Main_sp = sampler_state { Texture = <Texture1>; AddressU = Wrap; AddressV = Wrap; MIPFilter = Linear; MinFilter = Linear; MagFilter = Linear; }; // ******************************************************* //************ SHADER-Strukturen************************** struct VS_INPUT { float4 Position : POSITION; float3 Normal : NORMAL; float2 TexCords : TEXCOORD0; float4 Diffuse : COLOR0; }; struct VS_OUTPUT // PS_INPUT { float4 Position : POSITION; float2 TexCords : TEXCOORD0; float4 Diffuse : COLOR0; }; // ******************************************************* //************ Vertex-Shader Funktion********************* VS_OUTPUT VertexShader_Main(VS_INPUT IN) { VS_OUTPUT OUTPUT = (VS_OUTPUT) (0); float4 TEX = {0.0, 0.0, 0.0, 0.0}; TEX.x = IN.TexCords.x; TEX.y = IN.TexCords.y; TEX.z = 0; TEX.w = 0; // Matrizen herstellen float4x4 WorldView = mul(World, View); float4x4 MATRIX = mul(WorldView, Prj); float4 High_Map = tex2Dlod(Main_sp,TEX ); float4 Position = {0.0, 0.0, 0.0, 0.0}; Position.x += High_Map.x; Position = mul(IN.Position, MATRIX); OUTPUT.Position = Position; OUTPUT.Diffuse = IN.Diffuse; OUTPUT.TexCords = IN.TexCords; return OUTPUT; } // ******************************************************* //************ Pixel-Shader funktion********************** float4 PixelShader_Main(VS_OUTPUT IN) : COLOR0 { float4 Texel = {0.0, 0.0, 0.0, 1.0}; // Pixel Texel = tex2D(Main_sp, IN.TexCords); return Texel; } // ******************************************************* //************ Technik - 1******************************* TECHNIQUE T1 { PASS P1 { VertexShader = compile vs_3_0 VertexShader_Main(); PixelShader = compile ps_3_0 PixelShader_Main(); } } |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Sebastian Müller« (04.01.2014, 23:24)
HLSL-Quelltext |
|
1 2 3 4 5 6 7 |
extern const float g_HeightMapScale; . . . Position.x += High_Map.x * g_HeightMapScale; //oder High_Map *= g_HeightMapScale; |
HLSL-Quelltext |
|
1 2 3 4 5 |
float4 Cam_Vector; // Bewegungsvector der kammer float2 TexCords; // Texturkordinaten TexCords.x *= -Cam_Vector.x; TexCords.y *= -Cam_Vector.y; |
Quellcode |
|
1 2 3 4 5 6 |
// Matrizen herstellen float4x4 WorldView = mul(World, View); float4x4 MATRIX = mul(WorldView, Prj); float4 Position = mul(IN.Position, MATRIX); Position.y += tex2Dlod(Main_sp, float4(Position.xz, 0.0f, 0.0f)).r*g_HeightMapScale; |
HLSL-Quelltext |
|
1 2 |
TexCords.x += Cam_Velocity.x / 20; TexCords.y += Cam_Velocity.z / 20; |
C-/C++-Quelltext |
|
1 |
tbColor HeighMap[x][y]; |
Werbeanzeige