Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion D3D11Engine/BaseGraphicsEngine.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include "WorldObjects.h"
#include "GraphicsEventRecord.h"
#include "RenderToTextureBuffer.h"
#include "ShaderCategory.h"

class BaseLineRenderer;
Expand Down Expand Up @@ -210,7 +211,10 @@ class BaseGraphicsEngine {
virtual void DrawFrameParticleMeshes( std::unordered_map<zCVob*, MeshVisualInfo*>& progMeshes ) {}

/** Draws particle effects */
virtual void DrawFrameParticles( std::map<zCTexture*, std::vector<ParticleInstanceInfo>>& particles, std::map<zCTexture*, ParticleRenderInfo>& info ) {}
virtual void DrawFrameParticles(std::map<zCTexture*, std::vector<ParticleInstanceInfo>>& particles,
std::map<zCTexture*, ParticleRenderInfo>& info,
RenderToTextureBuffer* bufferParticleColor,
RenderToTextureBuffer* bufferParticleDistortion) {}

virtual void DrawString( const std::string& str, float x, float y, const zFont* font, zColor& fontColor ) {};

Expand Down
29 changes: 29 additions & 0 deletions D3D11Engine/ConstantBufferStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,35 @@ struct VS_ExConstantBuffer_PerInstanceSkeletal {
float3 PI_Pad1;
};

// Maximum bones per skeleton (must match shader)
static const int NUM_MAX_BONES = 96;

// Maximum instances per batch (adjustable based on GPU memory)
static const int MAX_SKELETAL_INSTANCES = 64;

// Per-instance data for instanced skeletal rendering
// Stored in a StructuredBuffer for GPU access
__declspec(align(16)) struct SkeletalInstanceData {
XMFLOAT4X4 World; // World transform
XMFLOAT4X4 PrevWorld; // Previous World transform
float4 Color; // Model color (RGBA)
float Fatness; // Model fatness for vertex displacement
float Scale; // Uniform scale factor
uint32_t BoneOffset; // Offset into the bone transform buffer
uint32_t Padding; // Alignment padding
};

// Instance data for node attachments (weapons, heads, etc.)
// Must be 16-byte aligned for SIMD operations
__declspec(align(16)) struct NodeAttachmentInstanceData {
XMFLOAT4X4 World; // World transform (includes bone transform)
XMFLOAT4X4 PrevWorld; // Previous World transform (includes bone transform)
float4 Color; // Model color
float Fatness; // Fatness for MMS meshes
float Scaling; // Scaling for MMS meshes
float2 Padding; // Alignment padding
};

struct ScreenFadeConstantBuffer {
float GA_Alpha;
float3 GA_Pad;
Expand Down
6 changes: 6 additions & 0 deletions D3D11Engine/D3D11Effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,12 @@ XRESULT D3D11Effect::DrawRainShadowmap() {
XMStoreFloat4x4( &cr.ProjectionReplacement, XMMatrixTranspose( crProjectionReplacement ) );
XMStoreFloat3( &cr.PositionReplacement, p );
XMStoreFloat3( &cr.LookAtReplacement, lookAt );

cr.frustum.BuildOrthographic( crViewReplacement,
size * legacySingleShadowMapScaleFactor,
size * legacySingleShadowMapScaleFactor,
1.0f,
20000.f );

// Replace gothics camera
Engine::GAPI->SetCameraReplacementPtr( &cr );
Expand Down
10 changes: 10 additions & 0 deletions D3D11Engine/D3D11Engine.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ copy "$(OutDir)$(TargetName).pdb" "$(G1_SYSTEM_PATH)\ddraw.pdb"</Command>
<ClInclude Include="D3D11RenderQueue.h" />
<ClInclude Include="D3D11ShaderManager.h" />
<ClInclude Include="D3D11ShadowMap.h" />
<ClInclude Include="D3D11StructuredBuffer.h" />
<ClInclude Include="D3D11Texture.h" />
<ClInclude Include="D3D11VertexBuffer.h" />
<ClInclude Include="D3D11VShader.h" />
Expand Down Expand Up @@ -967,14 +968,19 @@ copy "$(OutDir)$(TargetName).pdb" "$(G1_SYSTEM_PATH)\ddraw.pdb"</Command>
<ClInclude Include="InstructionSet.h" />
<ClInclude Include="Logger.h" />
<ClInclude Include="MemoryTracker.h" />
<ClInclude Include="MeshManager.h" />
<ClInclude Include="MeshModifier.h" />
<ClInclude Include="oCGame.h" />
<ClInclude Include="oCNPC.h" />
<ClInclude Include="oCSpawnManager.h" />
<ClInclude Include="oCVisFX.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="BaseShadowedPointLight.h" />
<ClInclude Include="RenderGraph.h" />
<ClInclude Include="RenderPass.h" />
<ClInclude Include="RenderQueue.h" />
<ClInclude Include="RGBuilder.h" />
<ClInclude Include="RGTextureDesc.h" />
<ClInclude Include="ShaderCategory.h" />
<ClInclude Include="SMAA\D3D11SMAA.h" />
<ClInclude Include="SteamOverlay.h" />
Expand Down Expand Up @@ -1150,6 +1156,7 @@ copy "$(OutDir)$(TargetName).pdb" "$(G1_SYSTEM_PATH)\ddraw.pdb"</Command>
<ClCompile Include="include\imgui\imgui_draw.cpp" />
<ClCompile Include="include\imgui\imgui_tables.cpp" />
<ClCompile Include="include\imgui\imgui_widgets.cpp" />
<ClCompile Include="MeshManager.cpp" />
<ClCompile Include="MeshModifier.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
Expand Down Expand Up @@ -1181,6 +1188,9 @@ copy "$(OutDir)$(TargetName).pdb" "$(G1_SYSTEM_PATH)\ddraw.pdb"</Command>
<None Include="Shaders\PS_Grass.hlsl" />
<None Include="Shaders\VS_GrassInstanced.hlsl" />
<None Include="Shaders\PS_PFX_VelocityDebug.hlsl" />
<ClCompile Include="RenderGraph.cpp" />
<ClCompile Include="RenderPass.cpp" />
<ClCompile Include="RGBuilder.cpp" />
<ClCompile Include="SMAA\D3D11SMAA.cpp" />
<ClCompile Include="SteamOverlay.cpp" />
<ClCompile Include="StackWalker.cpp" />
Expand Down
32 changes: 32 additions & 0 deletions D3D11Engine/D3D11Engine.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
<Filter Include="Engine\Shaders">
<UniqueIdentifier>{7b924380-794f-4471-9819-06c3fca71231}</UniqueIdentifier>
</Filter>
<Filter Include="Engine\Graph">
<UniqueIdentifier>{e7532fd2-04b8-499d-a2a9-5b64abda0850}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
Expand Down Expand Up @@ -791,6 +794,23 @@
<ClInclude Include="TexturePool.h" />
<ClInclude Include="D3D11RenderQueue.h" />
<ClInclude Include="RenderQueue.h" />
<ClInclude Include="RGTextureDesc.h">
<Filter>Engine\Graph</Filter>
</ClInclude>
<ClInclude Include="RGBuilder.h">
<Filter>Engine\Graph</Filter>
</ClInclude>
<ClInclude Include="RenderPass.h">
<Filter>Engine\Graph</Filter>
</ClInclude>
<ClInclude Include="RenderGraph.h">
<Filter>Engine\Graph</Filter>
</ClInclude>
<ClInclude Include="D3D11StructuredBuffer.h" />
<ClInclude Include="D3D11RenderQueue.h" />
<ClInclude Include="MeshManager.h">
<Filter>Engine\GAPI</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp" />
Expand Down Expand Up @@ -1059,6 +1079,18 @@
<Filter>Engine\D3D11\PFX\Effects</Filter>
</ClCompile>
<ClCompile Include="D3D11RenderQueue.cpp" />
<ClCompile Include="RGBuilder.cpp">
<Filter>Engine\Graph</Filter>
</ClCompile>
<ClCompile Include="RenderPass.cpp">
<Filter>Engine\Graph</Filter>
</ClCompile>
<ClCompile Include="RenderGraph.cpp">
<Filter>Engine\Graph</Filter>
</ClCompile>
<ClCompile Include="MeshManager.cpp">
<Filter>Engine\GAPI</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="ddraw.def">
Expand Down
Loading