2022-04-01 20:29:39 +01:00
|
|
|
#pragma once
|
|
|
|
#include "CommonMaterial.h"
|
2022-05-28 10:54:02 +01:00
|
|
|
#include "PCDX11RenderExternalResource.h"
|
2022-05-28 13:08:10 +01:00
|
|
|
#include "surfaces/PCDX11BitmapTexture.h"
|
2022-05-28 18:16:36 +01:00
|
|
|
// #include "buffers/PCDX11StaticConstantBuffer.h"
|
|
|
|
#include "buffers/PCDX11UberConstantBuffer.h"
|
2022-04-01 20:29:39 +01:00
|
|
|
|
|
|
|
namespace cdc {
|
|
|
|
|
2022-05-22 14:36:09 +01:00
|
|
|
class PCDX11StreamDecl;
|
2022-07-15 11:06:33 +01:00
|
|
|
struct MaterialBlobSub;
|
|
|
|
struct MaterialInstanceData;
|
2022-11-08 16:00:30 +00:00
|
|
|
struct VertexDecl;
|
2022-05-22 14:36:09 +01:00
|
|
|
|
2022-04-01 20:29:39 +01:00
|
|
|
class PCDX11Material :
|
2022-05-28 10:54:02 +01:00
|
|
|
public CommonMaterial,
|
|
|
|
public PCDX11RenderExternalResource
|
2022-04-01 20:29:39 +01:00
|
|
|
{
|
2022-05-28 09:57:01 +01:00
|
|
|
unsigned short numTextures = 0; // 1C
|
|
|
|
unsigned short texBits = 0; // 1E
|
|
|
|
// PCDX11BitmapTexture *texture[4]; // 20
|
2022-05-28 18:16:36 +01:00
|
|
|
// PCDX11StaticConstantBuffer *constantBuffersPs[16]; // 30
|
|
|
|
// PCDX11StaticConstantBuffer *constantBuffersVs[16]; // 70
|
2023-04-04 03:36:40 +01:00
|
|
|
PCDX11UberConstantBuffer *constantBuffersPs[16] = {0}; // 30
|
|
|
|
PCDX11UberConstantBuffer *constantBuffersVs[16] = {0}; // 70
|
2022-06-05 19:42:50 +01:00
|
|
|
|
|
|
|
// mg = material globals
|
|
|
|
static uint32_t mg_state; // 00B37BE0
|
2022-06-06 10:07:06 +01:00
|
|
|
static uint32_t mg_vsSelectAndFlags;// 00B37BE4
|
2022-06-05 19:42:50 +01:00
|
|
|
|
|
|
|
// these globals might be declared elsewhere
|
2025-01-07 07:10:03 +00:00
|
|
|
static PCDX11StreamDecl *mg_streamDecl; // 00EAAD18
|
|
|
|
static VertexDecl *mg_layoutA; // 00EAAD1C
|
|
|
|
static PCDX11Material const *mg_material; // 00EAAD20
|
|
|
|
static void *mg_cbdata; // 00EAAD24
|
2022-07-15 11:06:33 +01:00
|
|
|
static MaterialInstanceData *mg_matInstance; // 00EAAD28
|
2025-01-07 07:10:03 +00:00
|
|
|
static bool mg_tesselate; // 00EAAD2C
|
2022-06-05 19:42:50 +01:00
|
|
|
|
2022-04-01 20:29:39 +01:00
|
|
|
public:
|
2022-05-28 09:57:01 +01:00
|
|
|
PCDX11Material(PCDX11RenderDevice *renderDevice) :
|
2022-05-28 10:54:02 +01:00
|
|
|
PCDX11RenderExternalResource(renderDevice)
|
2022-05-28 09:57:01 +01:00
|
|
|
{}
|
2024-07-12 12:19:11 +01:00
|
|
|
void FreeData();
|
2022-04-01 20:29:39 +01:00
|
|
|
|
2022-05-28 10:48:00 +01:00
|
|
|
void load(MaterialBlob *) override;
|
2022-11-07 17:58:22 +00:00
|
|
|
void Release() override;
|
2024-07-12 12:19:11 +01:00
|
|
|
~PCDX11Material() override;
|
2022-04-01 20:29:39 +01:00
|
|
|
void method_18() override;
|
2022-05-22 14:36:09 +01:00
|
|
|
|
2025-01-07 07:10:03 +00:00
|
|
|
void setupVertexResources(uint32_t, MaterialBlobSub*, MaterialInstanceData*, char*, bool) const;
|
|
|
|
void setupPixelResources(uint32_t, MaterialBlobSub*, MaterialInstanceData*, char*, bool) const;
|
2022-05-28 09:57:01 +01:00
|
|
|
|
2025-01-07 07:10:03 +00:00
|
|
|
void setupDepthBias(MaterialInstanceData*) const;
|
|
|
|
void setupStencil(MaterialInstanceData*, bool, uint32_t) const;
|
2022-06-05 19:42:50 +01:00
|
|
|
|
2025-01-07 07:10:03 +00:00
|
|
|
void setupSinglePassOpaque(PCDX11RenderDevice*, MaterialInstanceData*, uint32_t) const;
|
|
|
|
void setupSinglePassTranslucent(PCDX11RenderDevice*, MaterialInstanceData*, uint32_t, float) const;
|
2022-07-18 16:22:14 +01:00
|
|
|
static void invalidate();
|
2022-06-05 19:42:50 +01:00
|
|
|
|
2022-11-07 18:26:17 +00:00
|
|
|
PCDX11StreamDecl *SetupDepthPass(
|
2022-07-15 11:06:33 +01:00
|
|
|
MaterialInstanceData*,
|
2022-05-22 14:36:09 +01:00
|
|
|
void *drawableExtDword50,
|
|
|
|
uint32_t vsSelect,
|
|
|
|
bool arg4,
|
2022-11-08 16:00:30 +00:00
|
|
|
VertexDecl *layout,
|
2022-05-22 14:36:09 +01:00
|
|
|
uint8_t flags,
|
2023-05-17 22:21:58 +01:00
|
|
|
float opacityMultiplier,
|
2025-01-07 07:10:03 +00:00
|
|
|
float floatY) const;
|
2022-05-22 14:36:09 +01:00
|
|
|
|
2022-11-07 18:26:17 +00:00
|
|
|
PCDX11StreamDecl *SetupShadowPass(
|
2022-07-15 11:06:33 +01:00
|
|
|
MaterialInstanceData*,
|
2022-05-22 14:36:09 +01:00
|
|
|
void *drawableExtDword50,
|
|
|
|
uint8_t lightManager434_114,
|
|
|
|
uint32_t vsSelect,
|
2022-11-08 16:00:30 +00:00
|
|
|
VertexDecl *layout,
|
2022-05-22 14:36:09 +01:00
|
|
|
uint8_t flags,
|
2023-05-17 22:21:58 +01:00
|
|
|
float opacityMultiplier,
|
2025-01-07 07:10:03 +00:00
|
|
|
float floatY) const;
|
2022-05-22 14:36:09 +01:00
|
|
|
|
2022-11-07 18:26:17 +00:00
|
|
|
PCDX11StreamDecl *SetupBloomPass(
|
2022-07-15 11:06:33 +01:00
|
|
|
MaterialInstanceData*,
|
2022-05-22 14:36:09 +01:00
|
|
|
void *drawableExtDword50,
|
|
|
|
uint32_t vsSelect,
|
2022-11-08 16:00:30 +00:00
|
|
|
VertexDecl *layout,
|
2022-05-22 14:36:09 +01:00
|
|
|
uint8_t flags,
|
2025-01-07 07:10:03 +00:00
|
|
|
float opacityMultiplier) const;
|
2022-05-22 14:36:09 +01:00
|
|
|
|
2022-11-07 18:26:17 +00:00
|
|
|
PCDX11StreamDecl *SetupSinglePass(
|
2022-07-15 11:06:33 +01:00
|
|
|
MaterialInstanceData*,
|
2022-05-22 14:36:09 +01:00
|
|
|
void *drawableExtDword50,
|
2022-05-28 23:29:55 +01:00
|
|
|
void *drawableDword24,
|
2022-05-22 14:36:09 +01:00
|
|
|
uint32_t vsSelect,
|
2022-11-08 16:00:30 +00:00
|
|
|
VertexDecl *layout,
|
2022-05-22 14:36:09 +01:00
|
|
|
uint8_t flags,
|
2022-11-01 01:42:15 +00:00
|
|
|
bool isTranslucentPass,
|
2022-11-12 22:38:30 +00:00
|
|
|
float opacityMultiplier,
|
2025-01-07 07:10:03 +00:00
|
|
|
float lodDistance) const;
|
2022-05-22 14:36:09 +01:00
|
|
|
|
2022-11-07 18:26:17 +00:00
|
|
|
PCDX11StreamDecl *SetupNormalMapPass(
|
2022-07-15 11:06:33 +01:00
|
|
|
MaterialInstanceData*,
|
2022-05-22 14:36:09 +01:00
|
|
|
void *drawableExtDword50,
|
|
|
|
uint32_t vsSelect,
|
2022-11-08 16:00:30 +00:00
|
|
|
VertexDecl *layout,
|
2022-05-22 14:36:09 +01:00
|
|
|
uint8_t flags,
|
2023-05-17 22:21:58 +01:00
|
|
|
float opacityMultiplier,
|
2025-01-07 07:10:03 +00:00
|
|
|
float floatY) const;
|
2022-04-01 20:29:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|