Rise
The Vieneo Province
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
7namespace Rendering
8{
9 // Canonical native geometry for the legacy unprogrammed draw paths.
10 // Authored packed colors retain their original ARGB integer representation.
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
22 enum class TextureArg11 : int {Current,Diffuse,Specular,Texture,Factor};
24 enum class Fog11 : int {None,Linear,Exp,ExpSquared};
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{};
44 float theta=0,phi=0,falloff=1;
45 DirectX::XMFLOAT3 beamUp{0,1,0};DirectX::XMFLOAT4 beamAngles{},beamParameters{};bool profiledBeam=false;
46 };
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{};
54 float power=0;
57 // Old integer-centered object/screen geometry gets the half-pixel
58 // conversion once here. New native screen geometry can opt out.
60 bool fogEnabled=false,rangeFog=false;
62 DirectX::XMFLOAT4 fogColor{};
64 bool alphaTest=false;
65 D3D11_COMPARISON_FUNC alphaFunction=D3D11_COMPARISON_ALWAYS;
66 uint8_t alphaReference=0;
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.
78 DirectX::XMFLOAT4 displayUvBounds{0,0,1,1};
79 std::array<FixedLight11,8> lights;
80 std::array<TextureStage11,8> stages;
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.
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{};
101 std::string status;
102 };
103}
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
@ None
Definition ServerTypes.h:97
HRESULT Initialize(ID3D11Device *device, const std::filesystem::path &shaderDirectory={})
const std::string & Status() const
std::array< D3D11_SAMPLER_DESC, 8 > samplerDescriptions
HRESULT Bind(ID3D11DeviceContext *context, const FixedState11 &state, bool pointList=false)
Microsoft::WRL::ComPtr< ID3D11GeometryShader > points
Microsoft::WRL::ComPtr< ID3D11Buffer > pointConstants
Microsoft::WRL::ComPtr< ID3D11Device > device
std::array< Microsoft::WRL::ComPtr< ID3D11SamplerState >, 8 > samplers
DirectX::XMFLOAT4 ambient
DirectX::XMFLOAT4 specular
DirectX::XMFLOAT4 diffuse
DirectX::XMFLOAT4 beamAngles
DirectX::XMFLOAT3 direction
DirectX::XMFLOAT3 beamUp
DirectX::XMFLOAT4 beamParameters
DirectX::XMFLOAT3 position
MaterialSource11 specularSource
DirectX::XMFLOAT4X4 world
std::array< TextureStage11, 8 > stages
DirectX::XMFLOAT4X4 view
MaterialSource11 emissiveSource
DirectX::XMFLOAT4X4 projection
MaterialSource11 diffuseSource
DirectX::XMFLOAT4 materialSpecular
DirectX::XMFLOAT4 displayUvBounds
DirectX::XMFLOAT4 ambient
DirectX::XMFLOAT4 fogColor
MaterialSource11 ambientSource
DirectX::XMFLOAT4 materialAmbient
DirectX::XMFLOAT4 textureFactor
D3D11_COMPARISON_FUNC alphaFunction
DirectX::XMFLOAT4 materialDiffuse
std::array< FixedLight11, 8 > lights
DirectX::XMFLOAT4 materialEmissive
DirectX::XMFLOAT4 nightVisionSurface
DirectX::XMFLOAT4 viewport
DirectX::XMFLOAT4 clipPlane
DirectX::XMFLOAT3 uv[2]
DirectX::XMFLOAT3 normal
DirectX::XMFLOAT4 position
DirectX::XMFLOAT4X4 transform
Microsoft::WRL::ComPtr< ID3D11ShaderResourceView > texture
D3D11_SAMPLER_DESC sampler