Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
WindshieldRainRenderer.h
Go to the documentation of this file.
1
#pragma once
2
#include "
../Rendering/ClientRuntime11.h
"
3
#include "
../Rendering/WindshieldRain11.h
"
4
class
WindshieldRainRenderer
5
{
6
public
:
7
using
Vertex
=
Rendering::WindshieldRain11::Vertex
;
8
using
DepthLayout
=
Rendering::WindshieldRain11::DepthLayout
;
9
static
RiseMath::Matrix
ToPhysicsTransform
(
const
RiseMath::Matrix
& value){
return
Rendering::WindshieldRain11::ToPhysicsTransform
(value);}
10
static
WindshieldRain::Point
ProjectAcceleration
(
const
RiseMath::Vector3
& acceleration,
const
RiseMath::Matrix
& inverse,
11
const
RiseMath::Vector3
& normal,
const
RiseMath::Vector3
& u,
const
RiseMath::Vector3
& v)
12
{
return
Rendering::WindshieldRain11::ProjectAcceleration
(acceleration,inverse,normal,u,v);}
13
void
Clear
(){
renderer
.
Clear
();}
14
void
SetSimulator
(
bool
value){
renderer
.
SetSimulator
(value);}
15
void
SetGlassCondition
(
int
condition){
renderer
.
SetGlassCondition
(condition);}
16
void
AddGlass
(
int
component,
const
Vertex
* vertices,
size_t
count){
renderer
.
AddGlass
(component,vertices,count);}
17
void
AddWiper
(
int
component,
const
Vertex
* vertices,
size_t
count){
renderer
.
AddWiper
(component,vertices,count);}
18
void
FinishGeometry
(){
renderer
.
FinishGeometry
();}
19
void
Update
(
float
elapsed,
float
rain,
const
RiseMath::Vector3
& acceleration,
const
RiseMath::Vector3
& wind,
20
const
std::vector<RiseMath::Matrix>& transforms,
float
density,
bool
wiping,
float
rainAir=0);
21
template
<
class
Draw>
static
HRESULT
DrawCockpitGlass
(
Rendering::RenderDevice
* device, Draw draw)
22
{
23
constexpr
DWORD
states[]={
Rendering::RenderState::ZENABLE
,
Rendering::RenderState::ZWRITEENABLE
,
Rendering::RenderState::ZFUNC
,
24
Rendering::RenderState::STENCILENABLE
,
Rendering::RenderState::STENCILREF
,
Rendering::RenderState::STENCILFUNC
};
25
DWORD
saved[6]{};
26
for
(
int
i=0;i<6;++i) device->
GetRenderState
(states[i],&saved[i]);
27
device->
SetRenderState
(
Rendering::RenderState::ZENABLE
,TRUE);
28
device->
SetRenderState
(
Rendering::RenderState::ZWRITEENABLE
,FALSE);
29
device->
SetRenderState
(
Rendering::RenderState::STENCILENABLE
,TRUE);
30
device->
SetRenderState
(
Rendering::RenderState::STENCILREF
,3);
31
device->
SetRenderState
(
Rendering::RenderState::STENCILFUNC
,
Rendering::Compare::GREATER
);
// world: 0-2
32
device->
SetRenderState
(
Rendering::RenderState::ZFUNC
,
Rendering::Compare::ALWAYS
);
33
HRESULT
result=draw();
34
if
(SUCCEEDED(result))
35
{
36
device->
SetRenderState
(
Rendering::RenderState::STENCILFUNC
,
Rendering::Compare::EQUAL
);
// cockpit: 3
37
device->
SetRenderState
(
Rendering::RenderState::ZFUNC
,
Rendering::Compare::LESSEQUAL
);
38
result=draw();
39
}
40
for
(
int
i=0;i<6;++i) device->
SetRenderState
(states[i],saved[i]);
41
return
result;
42
}
43
44
HRESULT
Render
(
Rendering::RenderDevice
* device,
Rendering::RenderMaterial
* material,
const
std::vector<RiseMath::Matrix>& world,
45
const
RiseMath::Matrix
& viewProjection,
float
opacity=1,
DepthLayout
layout=DepthLayout::Unified,
float
cockpitLight=0,
46
ID3D11RenderTargetView* adExclusion=
nullptr
);
47
void
OnLostDevice
(){
renderer
.
ReleaseTargets
();}
48
size_t
PaneCount
()
const
{
return
renderer
.
PaneCount
();}
49
bool
Wet
()
const
{
return
renderer
.
Wet
();}
50
float
Wetness
()
const
{
return
renderer
.
Wetness
();}
51
private
:
52
Rendering::WindshieldRain11
renderer
;
53
Microsoft::WRL::ComPtr<ID3D11Device>
nativeDevice
;
54
};
ClientRuntime11.h
HRESULT
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
DWORD
SCRIPT_CONTROL SCRIPT_STATE const void DWORD
Definition
Controls.cpp:5032
WindshieldRain11.h
Rendering::RenderDevice
Definition
ClientRenderer11.h:92
Rendering::RenderDevice::GetRenderState
HRESULT GetRenderState(DWORD state, DWORD *value) const
Definition
ClientRenderer11.cpp:113
Rendering::RenderDevice::SetRenderState
HRESULT SetRenderState(DWORD state, DWORD value)
Definition
ClientRenderer11.cpp:127
Rendering::RenderMaterial
Definition
ClientRenderer11.h:173
Rendering::WindshieldRain11
Definition
WindshieldRain11.h:12
Rendering::WindshieldRain11::SetSimulator
void SetSimulator(bool value)
Definition
WindshieldRain11.cpp:79
Rendering::WindshieldRain11::SetGlassCondition
void SetGlassCondition(int condition)
Definition
WindshieldRain11.cpp:89
Rendering::WindshieldRain11::ToPhysicsTransform
static Matrix ToPhysicsTransform(const Matrix &cockpitToView)
Definition
WindshieldRain11.cpp:42
Rendering::WindshieldRain11::Wetness
float Wetness() const
Definition
WindshieldRain11.cpp:219
Rendering::WindshieldRain11::Wet
bool Wet() const
Definition
WindshieldRain11.cpp:215
Rendering::WindshieldRain11::Clear
void Clear()
Definition
WindshieldRain11.cpp:75
Rendering::WindshieldRain11::ProjectAcceleration
static WindshieldRain::Point ProjectAcceleration(const Vector &acceleration, const Matrix &inverse, const Vector &normal, const Vector &u, const Vector &v)
Definition
WindshieldRain11.cpp:50
Rendering::WindshieldRain11::DepthLayout
DepthLayout
Definition
WindshieldRain11.h:17
Rendering::WindshieldRain11::PaneCount
size_t PaneCount() const
Definition
WindshieldRain11.h:37
Rendering::WindshieldRain11::AddWiper
void AddWiper(int component, const Vertex *vertices, size_t count)
Definition
WindshieldRain11.cpp:140
Rendering::WindshieldRain11::AddGlass
void AddGlass(int component, const Vertex *vertices, size_t count)
Definition
WindshieldRain11.cpp:108
Rendering::WindshieldRain11::FinishGeometry
void FinishGeometry()
Definition
WindshieldRain11.cpp:144
Rendering::WindshieldRain11::ReleaseTargets
void ReleaseTargets()
Definition
WindshieldRain11.cpp:94
WindshieldRainRenderer
Definition
WindshieldRainRenderer.h:5
WindshieldRainRenderer::ProjectAcceleration
static WindshieldRain::Point ProjectAcceleration(const RiseMath::Vector3 &acceleration, const RiseMath::Matrix &inverse, const RiseMath::Vector3 &normal, const RiseMath::Vector3 &u, const RiseMath::Vector3 &v)
Definition
WindshieldRainRenderer.h:10
WindshieldRainRenderer::FinishGeometry
void FinishGeometry()
Definition
WindshieldRainRenderer.h:18
WindshieldRainRenderer::Wet
bool Wet() const
Definition
WindshieldRainRenderer.h:49
WindshieldRainRenderer::OnLostDevice
void OnLostDevice()
Definition
WindshieldRainRenderer.h:47
WindshieldRainRenderer::Render
HRESULT Render(Rendering::RenderDevice *device, Rendering::RenderMaterial *material, const std::vector< RiseMath::Matrix > &world, const RiseMath::Matrix &viewProjection, float opacity=1, DepthLayout layout=DepthLayout::Unified, float cockpitLight=0, ID3D11RenderTargetView *adExclusion=nullptr)
Definition
WindshieldRainRenderer.cpp:8
WindshieldRainRenderer::AddGlass
void AddGlass(int component, const Vertex *vertices, size_t count)
Definition
WindshieldRainRenderer.h:16
WindshieldRainRenderer::Vertex
Rendering::WindshieldRain11::Vertex Vertex
Definition
WindshieldRainRenderer.h:7
WindshieldRainRenderer::SetGlassCondition
void SetGlassCondition(int condition)
Definition
WindshieldRainRenderer.h:15
WindshieldRainRenderer::DepthLayout
Rendering::WindshieldRain11::DepthLayout DepthLayout
Definition
WindshieldRainRenderer.h:8
WindshieldRainRenderer::Wetness
float Wetness() const
Definition
WindshieldRainRenderer.h:50
WindshieldRainRenderer::ToPhysicsTransform
static RiseMath::Matrix ToPhysicsTransform(const RiseMath::Matrix &value)
Definition
WindshieldRainRenderer.h:9
WindshieldRainRenderer::renderer
Rendering::WindshieldRain11 renderer
Definition
WindshieldRainRenderer.h:52
WindshieldRainRenderer::SetSimulator
void SetSimulator(bool value)
Definition
WindshieldRainRenderer.h:14
WindshieldRainRenderer::AddWiper
void AddWiper(int component, const Vertex *vertices, size_t count)
Definition
WindshieldRainRenderer.h:17
WindshieldRainRenderer::Update
void Update(float elapsed, float rain, const RiseMath::Vector3 &acceleration, const RiseMath::Vector3 &wind, const std::vector< RiseMath::Matrix > &transforms, float density, bool wiping, float rainAir=0)
Definition
WindshieldRainRenderer.cpp:2
WindshieldRainRenderer::PaneCount
size_t PaneCount() const
Definition
WindshieldRainRenderer.h:48
WindshieldRainRenderer::nativeDevice
Microsoft::WRL::ComPtr< ID3D11Device > nativeDevice
Definition
WindshieldRainRenderer.h:53
WindshieldRainRenderer::DrawCockpitGlass
static HRESULT DrawCockpitGlass(Rendering::RenderDevice *device, Draw draw)
Definition
WindshieldRainRenderer.h:21
WindshieldRainRenderer::Clear
void Clear()
Definition
WindshieldRainRenderer.h:13
Rendering::Compare::EQUAL
constexpr uint32_t EQUAL
Definition
ClientTypes11.h:203
Rendering::Compare::GREATER
constexpr uint32_t GREATER
Definition
ClientTypes11.h:204
Rendering::Compare::ALWAYS
constexpr uint32_t ALWAYS
Definition
ClientTypes11.h:202
Rendering::Compare::LESSEQUAL
constexpr uint32_t LESSEQUAL
Definition
ClientTypes11.h:207
Rendering::RenderState::STENCILFUNC
constexpr uint32_t STENCILFUNC
Definition
ClientTypes11.h:85
Rendering::RenderState::STENCILREF
constexpr uint32_t STENCILREF
Definition
ClientTypes11.h:88
Rendering::RenderState::STENCILENABLE
constexpr uint32_t STENCILENABLE
Definition
ClientTypes11.h:83
Rendering::RenderState::ZFUNC
constexpr uint32_t ZFUNC
Definition
ClientTypes11.h:112
Rendering::RenderState::ZWRITEENABLE
constexpr uint32_t ZWRITEENABLE
Definition
ClientTypes11.h:113
Rendering::RenderState::ZENABLE
constexpr uint32_t ZENABLE
Definition
ClientTypes11.h:111
Rendering::WindshieldRain11::Vertex
Definition
WindshieldRain11.h:16
RiseMath::Matrix
Definition
ClientMath.h:80
RiseMath::Vector3
Definition
ClientMath.h:38
WindshieldRain::Point
Definition
WindshieldRain.h:66
Viewscreen
WindshieldRainRenderer.h
Generated on
for Rise by
1.18.0