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
C-/C++-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 |
float4x4 WorldView; float4x4 Projection; float4 GlowColor = float4(0.5f, 0.2f, 0.2f, 1.0f); float GlowThickness = 0.15f; struct SVertexShaderOutput { float4 Position : POSITION; float2 Texture : TEXCOORD0; float4 Diffuse : COLOR0; } SVertexShaderOutput VertexShaderProc(float4 InPosition : POSITION, float3 InNormal : NORMAL, float2 InTexture : TEXCOORD0, float4 InDiffuse : COLOR0) { SVertexShaderOutput Output = (SVertexShaderOutput)(0); float3 Pos = mul(InPosition + GlowThickness * InNormal, (float4x3)(WorldView)); Output.Position = mul(float4(Pos, 1.0f), Projection); Output.Diffuse = GlowColor; return Output; } TECHNIQUE T1 { PASS P1 { VertexShader = compile vs_1_1 VertexShaderProc(); } } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
if(FAILED(hResult = D3DXCreateEffectFromFile(g_pD3DDevice, "effect2.fx", NULL, NULL, 0, NULL, &g_pEffect, NULL))) { // Fehler! Womöglich ein Syntaxfehler in der Effektdatei! MessageBox(g_hWindow, "Der Effekt konnte nicht geladen werden!\nMöglicherweise ist er fehlerhaft.", "Fehler", MB_OK | MB_ICONEXCLAMATION); TB_ERROR_DIRECTX("D3DXCreateEffectFromFile", hResult, TB_ERROR); } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 |
struct SVertexShaderOutput { float4 Position : POSITION; float2 Texture : TEXCOORD0; float4 Diffuse : COLOR0; }; // <-- HIER |
Zitat
pDevice
[in] Pointer to the device that will create the effect. See IDirect3DDevice9.
pSrcFile
[in] Pointer to the filename. This parameter supports both Unicode and ANSI strings. See Remarks.
pDefines
[in] Optional NULL-terminated array of preprocessor macro definitions. See D3DXMACRO.
pInclude
[in] Optional interface pointer, ID3DXInclude, to use for handling #include directives. If this value is NULL, #includes will either be honored when compiling from a file or will cause an error when compiled from a resource or memory.
Flags
[in] If pSrcFile contains a text effect, flags can be a combination of D3DXSHADER Flags and D3DXFX flags; otherwise, pSrcFile contains a binary effect and the only flags honored are D3DXFX flags. The Direct3D 10 HLSL compiler is now the default. See DirectX 10 HLSL Compiler (Direct3D 10) for details.
pPool
[in] Pointer to a ID3DXEffectPool object to use for shared parameters. If this value is NULL, no parameters will be shared.
ppEffect
[out] Returns a pointer to a buffer containing the compiled effect. See ID3DXEffect.
ppCompilationErrors
[out] Returns a pointer to a buffer containing a listing of compile errors. See ID3DXBuffer.
C-/C++-Quelltext |
|
1 2 |
ID3DXBuffer* errors = 0; D3DXCreateEffectFromFile( g_pD3DDevice, "effect2.fx", 0, 0, D3DXSHADER_DEBUG, 0, &g_pEffect, &errors ); |
Werbeanzeige