Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
FixedFunction11.h
Go to the documentation of this file.
1
#pragma once
2
#include "
Program11.h
"
3
#include <DirectXMath.h>
4
#include <array>
5
#include <filesystem>
6
7
namespace
Rendering
8
{
9
// Canonical native geometry for the legacy unprogrammed draw paths.
10
// Authored packed colors retain their original ARGB integer representation.
11
struct
FixedVertex11
12
{
13
DirectX::XMFLOAT4
position
{0,0,0,1};
14
DirectX::XMFLOAT3
normal
{0,0,0};
15
float
pointSize
=1;
16
uint32_t
diffuse
=0xffffffff,
specular
=0;
17
DirectX::XMFLOAT3
uv
[2]{};
18
};
19
static_assert
(
sizeof
(FixedVertex11)==64);
20
21
enum class
TextureOp11
:
int
{
Disable
,
Select1
,
Select2
,
Modulate
,
Modulate2X
,
AddSmooth
,
BlendFactorAlpha
};
22
enum class
TextureArg11
:
int
{Current,
Diffuse
,
Specular
,
Texture
,Factor};
23
enum class
MaterialSource11
:
int
{
Material
,
Diffuse
,
Specular
};
24
enum class
Fog11
:
int
{
None
,
Linear
,
Exp
,
ExpSquared
};
25
struct
TextureStage11
26
{
27
TextureOp11
color
=
TextureOp11::Disable
,
alpha
=
TextureOp11::Disable
;
28
TextureArg11
color1
=
TextureArg11::Texture
,
color2
=
TextureArg11::Current
;
29
TextureArg11
alpha1
=
TextureArg11::Texture
,
alpha2
=
TextureArg11::Current
;
30
UINT
coordinate
=0,
transformCount
=0;
31
bool
projected
=
false
;
32
DirectX::XMFLOAT4X4
transform
{};
33
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView>
texture
;
34
D3D11_SAMPLER_DESC
sampler
{};
35
TextureStage11
();
36
};
37
struct
FixedLight11
38
{
39
// 0 disabled, 1 directional, 2 point, 3 spot; all poses in world space.
40
int
kind
=0;
41
DirectX::XMFLOAT3
position
{},
direction
{0,0,1};
42
DirectX::XMFLOAT4
diffuse
{},
specular
{},
ambient
{};
43
float
range
=0,
attenuation0
=1,
attenuation1
=0,
attenuation2
=0;
44
float
theta
=0,
phi
=0,
falloff
=1;
45
DirectX::XMFLOAT3
beamUp
{0,1,0};DirectX::XMFLOAT4
beamAngles
{},
beamParameters
{};
bool
profiledBeam
=
false
;
46
};
47
struct
FixedState11
48
{
49
DirectX::XMFLOAT4X4
world
{},
view
{},
projection
{};
50
DirectX::XMFLOAT4
viewport
{0,0,1,1};
51
DirectX::XMFLOAT4
materialDiffuse
{1,1,1,1},
materialAmbient
{1,1,1,1},
materialSpecular
{},
materialEmissive
{},
ambient
{};
52
MaterialSource11
diffuseSource
=
MaterialSource11::Diffuse
,
ambientSource
=
MaterialSource11::Material
;
53
MaterialSource11
specularSource
=
MaterialSource11::Specular
,
emissiveSource
=
MaterialSource11::Material
;
54
float
power
=0;
55
bool
lighting
=
true
,
normalizeNormals
=
false
,
localViewer
=
true
,
specularEnabled
=
false
,
transformed
=
false
;
56
UINT
vertexColorMask
=0,
uvDimensions
[2]{2,2};
57
// Old integer-centered object/screen geometry gets the half-pixel
58
// conversion once here. New native screen geometry can opt out.
59
bool
legacyPixelCenters
=
true
;
60
bool
fogEnabled
=
false
,
rangeFog
=
false
;
61
Fog11
fog
=
Fog11::None
;
62
DirectX::XMFLOAT4
fogColor
{};
63
float
fogStart
=0,
fogEnd
=1,
fogDensity
=1;
64
bool
alphaTest
=
false
;
65
D3D11_COMPARISON_FUNC
alphaFunction
=D3D11_COMPARISON_ALWAYS;
66
uint8_t
alphaReference
=0;
67
float
pointSize
=1,
pointMin
=1,
pointMax
=64;
68
bool
vertexPointSize
=
false
,
pointSprite
=
false
;
69
bool
clipEnabled
=
false
;
70
DirectX::XMFLOAT4
clipPlane
{};
71
DirectX::XMFLOAT4
textureFactor
{1,1,1,1};
72
// Opt-in stage-0 gain: mixed cabin light before paint/emission, or
73
// star sprite signal before atmospheric blending.
74
// RGB is the optical response; W enables it for this draw only.
75
DirectX::XMFLOAT4
nightVisionSurface
{};
76
// Opt-in cockpit monitor treatment; zero preserves ordinary stage output.
77
float
nightVisionDisplay
=0;
78
DirectX::XMFLOAT4
displayUvBounds
{0,0,1,1};
79
std::array<FixedLight11,8>
lights
;
80
std::array<TextureStage11,8>
stages
;
81
FixedState11
();
82
};
83
// Shader/state replacement for fixed-function transformation, lighting,
84
// fog, texture stages, screen vertices and point sprites. Native raster,
85
// depth/stencil and blend states are owned by the surrounding draw pass.
86
class
FixedFunction11
87
{
88
public
:
89
HRESULT
Initialize
(ID3D11Device*
device
,
const
std::filesystem::path& shaderDirectory={});
90
HRESULT
Bind
(ID3D11DeviceContext* context,
const
FixedState11
& state,
bool
pointList=
false
);
91
void
Reset
();
92
const
std::string&
Status
()
const
{
return
status
;}
93
private
:
94
Microsoft::WRL::ComPtr<ID3D11Device>
device
;
95
Microsoft::WRL::ComPtr<ID3D11GeometryShader>
points
;
96
Microsoft::WRL::ComPtr<ID3D11Buffer>
pointConstants
;
97
std::array<Microsoft::WRL::ComPtr<ID3D11SamplerState>,8>
samplers
;
98
std::array<D3D11_SAMPLER_DESC,8>
samplerDescriptions
{};
99
Program11
program
;
100
Parameters11
parameters
;
101
std::string
status
;
102
};
103
}
HRESULT
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
Program11.h
None
@ None
Definition
ServerTypes.h:97
Rendering::FixedFunction11
Definition
FixedFunction11.h:87
Rendering::FixedFunction11::Initialize
HRESULT Initialize(ID3D11Device *device, const std::filesystem::path &shaderDirectory={})
Definition
FixedFunction11.cpp:29
Rendering::FixedFunction11::Status
const std::string & Status() const
Definition
FixedFunction11.h:92
Rendering::FixedFunction11::program
Program11 program
Definition
FixedFunction11.h:99
Rendering::FixedFunction11::samplerDescriptions
std::array< D3D11_SAMPLER_DESC, 8 > samplerDescriptions
Definition
FixedFunction11.h:98
Rendering::FixedFunction11::Bind
HRESULT Bind(ID3D11DeviceContext *context, const FixedState11 &state, bool pointList=false)
Definition
FixedFunction11.cpp:52
Rendering::FixedFunction11::parameters
Parameters11 parameters
Definition
FixedFunction11.h:100
Rendering::FixedFunction11::points
Microsoft::WRL::ComPtr< ID3D11GeometryShader > points
Definition
FixedFunction11.h:95
Rendering::FixedFunction11::status
std::string status
Definition
FixedFunction11.h:101
Rendering::FixedFunction11::Reset
void Reset()
Definition
FixedFunction11.cpp:23
Rendering::FixedFunction11::pointConstants
Microsoft::WRL::ComPtr< ID3D11Buffer > pointConstants
Definition
FixedFunction11.h:96
Rendering::FixedFunction11::device
Microsoft::WRL::ComPtr< ID3D11Device > device
Definition
FixedFunction11.h:94
Rendering::FixedFunction11::samplers
std::array< Microsoft::WRL::ComPtr< ID3D11SamplerState >, 8 > samplers
Definition
FixedFunction11.h:97
Rendering::Parameters11
Definition
Program11.h:15
Rendering::Program11
Definition
Program11.h:56
Rendering
Definition
AdDiagnostics11.cpp:16
Rendering::TextureArg11
TextureArg11
Definition
FixedFunction11.h:22
Rendering::TextureArg11::Current
@ Current
Definition
FixedFunction11.h:22
Rendering::TextureArg11::Specular
@ Specular
Definition
FixedFunction11.h:22
Rendering::TextureArg11::Diffuse
@ Diffuse
Definition
FixedFunction11.h:22
Rendering::TextureArg11::Texture
@ Texture
Definition
FixedFunction11.h:22
Rendering::TextureOp11
TextureOp11
Definition
FixedFunction11.h:21
Rendering::TextureOp11::Modulate2X
@ Modulate2X
Definition
FixedFunction11.h:21
Rendering::TextureOp11::Select1
@ Select1
Definition
FixedFunction11.h:21
Rendering::TextureOp11::Select2
@ Select2
Definition
FixedFunction11.h:21
Rendering::TextureOp11::Disable
@ Disable
Definition
FixedFunction11.h:21
Rendering::TextureOp11::Modulate
@ Modulate
Definition
FixedFunction11.h:21
Rendering::TextureOp11::AddSmooth
@ AddSmooth
Definition
FixedFunction11.h:21
Rendering::TextureOp11::BlendFactorAlpha
@ BlendFactorAlpha
Definition
FixedFunction11.h:21
Rendering::MaterialSource11
MaterialSource11
Definition
FixedFunction11.h:23
Rendering::MaterialSource11::Specular
@ Specular
Definition
FixedFunction11.h:23
Rendering::MaterialSource11::Diffuse
@ Diffuse
Definition
FixedFunction11.h:23
Rendering::MaterialSource11::Material
@ Material
Definition
FixedFunction11.h:23
Rendering::Fog11
Fog11
Definition
FixedFunction11.h:24
Rendering::Fog11::Linear
@ Linear
Definition
FixedFunction11.h:24
Rendering::Fog11::None
@ None
Definition
FixedFunction11.h:24
Rendering::Fog11::ExpSquared
@ ExpSquared
Definition
FixedFunction11.h:24
Rendering::Fog11::Exp
@ Exp
Definition
FixedFunction11.h:24
Rendering::FixedLight11
Definition
FixedFunction11.h:38
Rendering::FixedLight11::theta
float theta
Definition
FixedFunction11.h:44
Rendering::FixedLight11::ambient
DirectX::XMFLOAT4 ambient
Definition
FixedFunction11.h:42
Rendering::FixedLight11::kind
int kind
Definition
FixedFunction11.h:40
Rendering::FixedLight11::specular
DirectX::XMFLOAT4 specular
Definition
FixedFunction11.h:42
Rendering::FixedLight11::diffuse
DirectX::XMFLOAT4 diffuse
Definition
FixedFunction11.h:42
Rendering::FixedLight11::profiledBeam
bool profiledBeam
Definition
FixedFunction11.h:45
Rendering::FixedLight11::attenuation2
float attenuation2
Definition
FixedFunction11.h:43
Rendering::FixedLight11::falloff
float falloff
Definition
FixedFunction11.h:44
Rendering::FixedLight11::beamAngles
DirectX::XMFLOAT4 beamAngles
Definition
FixedFunction11.h:45
Rendering::FixedLight11::phi
float phi
Definition
FixedFunction11.h:44
Rendering::FixedLight11::range
float range
Definition
FixedFunction11.h:43
Rendering::FixedLight11::direction
DirectX::XMFLOAT3 direction
Definition
FixedFunction11.h:41
Rendering::FixedLight11::beamUp
DirectX::XMFLOAT3 beamUp
Definition
FixedFunction11.h:45
Rendering::FixedLight11::attenuation0
float attenuation0
Definition
FixedFunction11.h:43
Rendering::FixedLight11::attenuation1
float attenuation1
Definition
FixedFunction11.h:43
Rendering::FixedLight11::beamParameters
DirectX::XMFLOAT4 beamParameters
Definition
FixedFunction11.h:45
Rendering::FixedLight11::position
DirectX::XMFLOAT3 position
Definition
FixedFunction11.h:41
Rendering::FixedState11
Definition
FixedFunction11.h:48
Rendering::FixedState11::vertexColorMask
UINT vertexColorMask
Definition
FixedFunction11.h:56
Rendering::FixedState11::rangeFog
bool rangeFog
Definition
FixedFunction11.h:60
Rendering::FixedState11::fogDensity
float fogDensity
Definition
FixedFunction11.h:63
Rendering::FixedState11::specularSource
MaterialSource11 specularSource
Definition
FixedFunction11.h:53
Rendering::FixedState11::lighting
bool lighting
Definition
FixedFunction11.h:55
Rendering::FixedState11::alphaReference
uint8_t alphaReference
Definition
FixedFunction11.h:66
Rendering::FixedState11::world
DirectX::XMFLOAT4X4 world
Definition
FixedFunction11.h:49
Rendering::FixedState11::pointSprite
bool pointSprite
Definition
FixedFunction11.h:68
Rendering::FixedState11::stages
std::array< TextureStage11, 8 > stages
Definition
FixedFunction11.h:80
Rendering::FixedState11::fog
Fog11 fog
Definition
FixedFunction11.h:61
Rendering::FixedState11::view
DirectX::XMFLOAT4X4 view
Definition
FixedFunction11.h:49
Rendering::FixedState11::emissiveSource
MaterialSource11 emissiveSource
Definition
FixedFunction11.h:53
Rendering::FixedState11::fogEnabled
bool fogEnabled
Definition
FixedFunction11.h:60
Rendering::FixedState11::power
float power
Definition
FixedFunction11.h:54
Rendering::FixedState11::fogStart
float fogStart
Definition
FixedFunction11.h:63
Rendering::FixedState11::normalizeNormals
bool normalizeNormals
Definition
FixedFunction11.h:55
Rendering::FixedState11::projection
DirectX::XMFLOAT4X4 projection
Definition
FixedFunction11.h:49
Rendering::FixedState11::diffuseSource
MaterialSource11 diffuseSource
Definition
FixedFunction11.h:52
Rendering::FixedState11::specularEnabled
bool specularEnabled
Definition
FixedFunction11.h:55
Rendering::FixedState11::nightVisionDisplay
float nightVisionDisplay
Definition
FixedFunction11.h:77
Rendering::FixedState11::pointSize
float pointSize
Definition
FixedFunction11.h:67
Rendering::FixedState11::localViewer
bool localViewer
Definition
FixedFunction11.h:55
Rendering::FixedState11::materialSpecular
DirectX::XMFLOAT4 materialSpecular
Definition
FixedFunction11.h:51
Rendering::FixedState11::fogEnd
float fogEnd
Definition
FixedFunction11.h:63
Rendering::FixedState11::transformed
bool transformed
Definition
FixedFunction11.h:55
Rendering::FixedState11::displayUvBounds
DirectX::XMFLOAT4 displayUvBounds
Definition
FixedFunction11.h:78
Rendering::FixedState11::ambient
DirectX::XMFLOAT4 ambient
Definition
FixedFunction11.h:51
Rendering::FixedState11::fogColor
DirectX::XMFLOAT4 fogColor
Definition
FixedFunction11.h:62
Rendering::FixedState11::ambientSource
MaterialSource11 ambientSource
Definition
FixedFunction11.h:52
Rendering::FixedState11::materialAmbient
DirectX::XMFLOAT4 materialAmbient
Definition
FixedFunction11.h:51
Rendering::FixedState11::FixedState11
FixedState11()
Definition
FixedFunction11.cpp:18
Rendering::FixedState11::textureFactor
DirectX::XMFLOAT4 textureFactor
Definition
FixedFunction11.h:71
Rendering::FixedState11::vertexPointSize
bool vertexPointSize
Definition
FixedFunction11.h:68
Rendering::FixedState11::legacyPixelCenters
bool legacyPixelCenters
Definition
FixedFunction11.h:59
Rendering::FixedState11::alphaFunction
D3D11_COMPARISON_FUNC alphaFunction
Definition
FixedFunction11.h:65
Rendering::FixedState11::alphaTest
bool alphaTest
Definition
FixedFunction11.h:64
Rendering::FixedState11::clipEnabled
bool clipEnabled
Definition
FixedFunction11.h:69
Rendering::FixedState11::materialDiffuse
DirectX::XMFLOAT4 materialDiffuse
Definition
FixedFunction11.h:51
Rendering::FixedState11::uvDimensions
UINT uvDimensions[2]
Definition
FixedFunction11.h:56
Rendering::FixedState11::pointMax
float pointMax
Definition
FixedFunction11.h:67
Rendering::FixedState11::lights
std::array< FixedLight11, 8 > lights
Definition
FixedFunction11.h:79
Rendering::FixedState11::materialEmissive
DirectX::XMFLOAT4 materialEmissive
Definition
FixedFunction11.h:51
Rendering::FixedState11::nightVisionSurface
DirectX::XMFLOAT4 nightVisionSurface
Definition
FixedFunction11.h:75
Rendering::FixedState11::viewport
DirectX::XMFLOAT4 viewport
Definition
FixedFunction11.h:50
Rendering::FixedState11::clipPlane
DirectX::XMFLOAT4 clipPlane
Definition
FixedFunction11.h:70
Rendering::FixedState11::pointMin
float pointMin
Definition
FixedFunction11.h:67
Rendering::FixedVertex11
Definition
FixedFunction11.h:12
Rendering::FixedVertex11::uv
DirectX::XMFLOAT3 uv[2]
Definition
FixedFunction11.h:17
Rendering::FixedVertex11::pointSize
float pointSize
Definition
FixedFunction11.h:15
Rendering::FixedVertex11::normal
DirectX::XMFLOAT3 normal
Definition
FixedFunction11.h:14
Rendering::FixedVertex11::specular
uint32_t specular
Definition
FixedFunction11.h:16
Rendering::FixedVertex11::diffuse
uint32_t diffuse
Definition
FixedFunction11.h:16
Rendering::FixedVertex11::position
DirectX::XMFLOAT4 position
Definition
FixedFunction11.h:13
Rendering::Material
Definition
ClientTypes11.h:316
Rendering::TextureStage11::transform
DirectX::XMFLOAT4X4 transform
Definition
FixedFunction11.h:32
Rendering::TextureStage11::transformCount
UINT transformCount
Definition
FixedFunction11.h:30
Rendering::TextureStage11::color1
TextureArg11 color1
Definition
FixedFunction11.h:28
Rendering::TextureStage11::alpha2
TextureArg11 alpha2
Definition
FixedFunction11.h:29
Rendering::TextureStage11::coordinate
UINT coordinate
Definition
FixedFunction11.h:30
Rendering::TextureStage11::texture
Microsoft::WRL::ComPtr< ID3D11ShaderResourceView > texture
Definition
FixedFunction11.h:33
Rendering::TextureStage11::alpha1
TextureArg11 alpha1
Definition
FixedFunction11.h:29
Rendering::TextureStage11::color
TextureOp11 color
Definition
FixedFunction11.h:27
Rendering::TextureStage11::projected
bool projected
Definition
FixedFunction11.h:31
Rendering::TextureStage11::alpha
TextureOp11 alpha
Definition
FixedFunction11.h:27
Rendering::TextureStage11::TextureStage11
TextureStage11()
Definition
FixedFunction11.cpp:11
Rendering::TextureStage11::color2
TextureArg11 color2
Definition
FixedFunction11.h:28
Rendering::TextureStage11::sampler
D3D11_SAMPLER_DESC sampler
Definition
FixedFunction11.h:34
Rendering
FixedFunction11.h
Generated on
for Rise by
1.18.0