BRE12
CBuffers.h
1 #pragma once
2 
3 #include <DirectXMath.h>
4 
5 #include <MathUtils\MathUtils.h>
6 #include <SettingsManager\SettingsManager.h>
7 
8 namespace BRE {
9 // Per object constant buffer data
10 struct ObjectCBuffer {
11  ObjectCBuffer() = default;
12  ~ObjectCBuffer() = default;
13  ObjectCBuffer(const ObjectCBuffer&) = default;
14  ObjectCBuffer(ObjectCBuffer&&) = default;
15  ObjectCBuffer& operator=(ObjectCBuffer&&) = default;
16 
17  DirectX::XMFLOAT4X4 mWorldMatrix{ MathUtils::GetIdentity4x4Matrix() };
18  DirectX::XMFLOAT4X4 mInverseTransposeWorldMatrix{ MathUtils::GetIdentity4x4Matrix() };
19  float mTextureScaleFactor{ 2.0f };
20 };
21 
22 // Per frame constant buffer data
23 struct FrameCBuffer {
24  FrameCBuffer() = default;
25  ~FrameCBuffer() = default;
26  FrameCBuffer(const FrameCBuffer&) = default;
27  const FrameCBuffer& operator=(const FrameCBuffer&);
28  FrameCBuffer(FrameCBuffer&&) = default;
29  FrameCBuffer& operator=(FrameCBuffer&&) = default;
30 
31  DirectX::XMFLOAT4X4 mViewMatrix{ MathUtils::GetIdentity4x4Matrix() };
32  DirectX::XMFLOAT4X4 mInverseViewMatrix{ MathUtils::GetIdentity4x4Matrix() };
33  DirectX::XMFLOAT4X4 mProjectionMatrix{ MathUtils::GetIdentity4x4Matrix() };
34  DirectX::XMFLOAT4X4 mInverseProjectionMatrix{ MathUtils::GetIdentity4x4Matrix() };
35  DirectX::XMFLOAT4 mEyeWorldPosition{ 0.0f, 0.0f, 0.0f, 1.0f };
36 };
37 
38 // Immutable constant buffer data (does not change across frames or objects)
40  ImmutableCBuffer() = default;
41  ~ImmutableCBuffer() = default;
42  ImmutableCBuffer(const ImmutableCBuffer&) = default;
44  ImmutableCBuffer& operator=(ImmutableCBuffer&&) = default;
45 
46  float mNearZ_FarZ_ScreenW_ScreenH[4U]{
47  SettingsManager::sNearPlaneZ,
48  SettingsManager::sFarPlaneZ,
49  static_cast<float>(SettingsManager::sWindowWidth),
50  static_cast<float>(SettingsManager::sWindowHeight)
51  };
52 };
53 
54 }
55 
Definition: Camera.cpp:8
Definition: CBuffers.h:10
Definition: CBuffers.h:23
Definition: CBuffers.h:39