Rise
The Vieneo Province
Loading...
Searching...
No Matches
buildings.h
Go to the documentation of this file.
1#pragma once
4
5#include <WinSock2.h>
6#include <WS2tcpip.h>
7#include <Windows.h>
8
9#include <vector>
10
11#include "../Logger.h"
12#include "GeometryBounds.h"
13#include "BuildingDrawBatches.h"
14#include "../TerrainAwareness.h"
17
18#define lclC 3
19
21struct LOCALGRID2; // maybe local only, see if we can move from Globals?
22struct RTSGRID; // maybe local only, see if we can move from Globals?
23struct s_light_effect; // shared
24struct s_mesh_component; // shared
25class Viewscreen;
26
28{
30 std::vector<BuildingDrawBatch> drawBatches;
31 std::vector<GeometryBounds> obstacleBounds; // Per component; render batches may merge buildings.
32 std::vector<float> obstacleTops; // Actual radial height, not AABB corner height.
33 std::vector<bool> signOverlayUV;
34 bool hasAnimatedGeometry = false;
37
38 std::vector<RiseMath::Vector3> runwayEdgeLights; // local to terpos, on the terrain triangles
39 std::vector<s_light_effect> effects;
40
43 short u = 0, v = 0;
44 uint64_t adEntity = 0;
46 float emissive = 0.0f;
47 bool powered = false;
48 bool newVersion = false; // we don't have a version in the DAW/DIX but at some point we started exporting with support for more than 32767 vertices?
49
50 long layout1 = 0L, layout2 = 0L, layout3 = 0L, layout4 = 0L;
51 unsigned short components = 0, rtscomponents = 0;
54 RTSGRID* rts = nullptr;
55
56 float dist = 0.0f; // must be computed before Sort is called which in turn uses the custom operator below
57};
58
60{
61public:
62 bool g_bRoad = false;
63
65 ~buildings();
66 void OnDestroyDevice();
67 static bool CheckLayout(unsigned i, LOCALGRID2 localgrid2);
68 HRESULT Building(short t, short s);
69 void Sort();
70 void CollectTerrainObstacles(std::vector<TerrainAwareness::Obstacle>& result) const;
71 void RemoveBuildZone(size_t ordinal);
72 void RenderRts(Rendering::RenderDevice* pd3dDevice, float lightFromStreet) const;
73 void RenderCurbs(Rendering::RenderDevice* pd3dDevice, float lightFromStreet) const;
74 void RenderRocks(Rendering::RenderDevice* pd3dDevice) const;
75 bool CheckCollision(short buildZoneOrdinal, RiseMath::Vector3 position, RiseMath::Vector3 velocity, float bound, float ElapsedTime, RiseMath::Vector3* cross) const;
76 void DamageLandingLightContacts(const RiseMath::Vector3& velocity, float seconds) const;
77 float CheckRtsBumpMap(VECTOR2SHORT rts, VECTOR2SHORT bump, short u, short v);
78 void Render(Rendering::RenderDevice* pd3dDevice, double* fTime, bool drawTransparancy) const;
79 void RenderLights(Rendering::RenderDevice* pd3dDevice, const double* fTime) const;
80 void BuildCurbs(VECTOR2SHORT rts);
81 void BuildRocks();
82
83private:
86
87 std::vector<BUILDZONE> buildzones;
89 mutable std::vector<Rendering::RunwayLightInstance11> runwayLightInstances;
90 std::vector<size_t> sortme;
93 short curbTexture[lclC][lclC] = {};
96 UINT curbPrims[lclC][lclC] = {};
97 UINT rockPrims[lclC][lclC] = {};
100 unsigned short rockComponents = 0;
102 unsigned char oldZone = 0;
103
104 float determinant(float A[8][8], int n) const;
105 void adjoint(float A[8][8], float adj[8][8]) const;
106 void inverse(float A[8][8], float inverse[8][8]) const;
107 void getCofactor(float A[8][8], float temp[8][8], int p, int q, int n) const;
108 void BuildCurb(VECTOR2SHORT rts, short rtsu, short rtsv);
109 static void PushRocksOffRoad(unsigned char roads, unsigned char zone, float* leftToRight, float* topToBottom);
110 static void PushRocksOffRunway(short gridu, short gridv, unsigned char zone, float* leftToRight, float* topToBottom);
111 void BuildRock(short rtsu, short rtsv);
112};
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
PlotType
@ NotZoned
const RiseMath::Vector3 centerC
#define lclC
Definition buildings.h:18
UINT curbPrims[lclC][lclC]
Definition buildings.h:96
Rendering::RenderBuffer * curbVB[lclC][lclC]
Definition buildings.h:91
Logger * logger
Definition buildings.h:85
static bool CheckLayout(unsigned i, LOCALGRID2 localgrid2)
void BuildCurbs(VECTOR2SHORT rts)
float determinant(float A[8][8], int n) const
void RenderRocks(Rendering::RenderDevice *pd3dDevice) const
unsigned short rockComponents
Definition buildings.h:100
buildings(Viewscreen *ptr)
Definition buildings.cpp:20
void DamageLandingLightContacts(const RiseMath::Vector3 &velocity, float seconds) const
void BuildRock(short rtsu, short rtsv)
bool g_bRoad
Definition buildings.h:62
void CollectTerrainObstacles(std::vector< TerrainAwareness::Obstacle > &result) const
RiseMath::Vector3 curbTerpos
Definition buildings.h:94
float CheckRtsBumpMap(VECTOR2SHORT rts, VECTOR2SHORT bump, short u, short v)
void Render(Rendering::RenderDevice *pd3dDevice, double *fTime, bool drawTransparancy) const
void BuildRocks()
GeometryBounds curbBounds[lclC][lclC]
Definition buildings.h:98
RiseMath::Vector3 rockTerpos
Definition buildings.h:95
void RenderRts(Rendering::RenderDevice *pd3dDevice, float lightFromStreet) const
Rendering::RenderBuffer * rockVB[lclC][lclC]
Definition buildings.h:92
void OnDestroyDevice()
void Sort()
void RemoveBuildZone(size_t ordinal)
Rendering::RunwayLights11 runwayLightBatch
Definition buildings.h:88
RiseVertex2Vertex * rockVertexBuffer
Definition buildings.h:99
static void PushRocksOffRunway(short gridu, short gridv, unsigned char zone, float *leftToRight, float *topToBottom)
std::vector< size_t > sortme
Definition buildings.h:90
short curbTexture[lclC][lclC]
Definition buildings.h:93
void RenderCurbs(Rendering::RenderDevice *pd3dDevice, float lightFromStreet) const
bool CheckCollision(short buildZoneOrdinal, RiseMath::Vector3 position, RiseMath::Vector3 velocity, float bound, float ElapsedTime, RiseMath::Vector3 *cross) const
std::vector< BUILDZONE > buildzones
Definition buildings.h:87
GeometryBounds rockBounds[lclC][lclC]
Definition buildings.h:98
void adjoint(float A[8][8], float adj[8][8]) const
HRESULT Building(short t, short s)
void inverse(float A[8][8], float inverse[8][8]) const
std::vector< Rendering::RunwayLightInstance11 > runwayLightInstances
Definition buildings.h:89
Viewscreen * viewscreen
Definition buildings.h:84
s_mesh_component * rockComponentArray
Definition buildings.h:101
void RenderLights(Rendering::RenderDevice *pd3dDevice, const double *fTime) const
unsigned char oldZone
Definition buildings.h:102
void getCofactor(float A[8][8], float temp[8][8], int p, int q, int n) const
void BuildCurb(VECTOR2SHORT rts, short rtsu, short rtsv)
UINT rockPrims[lclC][lclC]
Definition buildings.h:97
static void PushRocksOffRoad(unsigned char roads, unsigned char zone, float *leftToRight, float *topToBottom)
float dist
Definition buildings.h:56
float emissive
Definition buildings.h:46
long layout2
Definition buildings.h:50
std::vector< float > obstacleTops
Definition buildings.h:32
long layout1
Definition buildings.h:50
RiseMath::Matrix matSkew
Definition buildings.h:42
std::vector< RiseMath::Vector3 > runwayEdgeLights
Definition buildings.h:38
GeometryBounds rtsBounds
Definition buildings.h:29
bool newVersion
Definition buildings.h:48
s_mesh_component * rtscomponentarray
Definition buildings.h:53
RiseMath::Vector3 terpos
Definition buildings.h:41
std::vector< BuildingDrawBatch > drawBatches
Definition buildings.h:30
Rendering::RenderBuffer * VB
Definition buildings.h:35
short u
Definition buildings.h:43
s_mesh_component * componentarray
Definition buildings.h:52
GeometryBounds bounds
Definition buildings.h:29
bool powered
Definition buildings.h:47
short v
Definition buildings.h:43
RiseMath::Matrix matrixBase
Definition buildings.h:42
PlotType type
Definition buildings.h:45
long layout3
Definition buildings.h:50
uint64_t adEntity
Definition buildings.h:44
unsigned short components
Definition buildings.h:51
std::vector< GeometryBounds > obstacleBounds
Definition buildings.h:31
bool hasAnimatedGeometry
Definition buildings.h:34
std::vector< bool > signOverlayUV
Definition buildings.h:33
unsigned short rtscomponents
Definition buildings.h:51
long layout4
Definition buildings.h:50
std::vector< s_light_effect > effects
Definition buildings.h:39
RTSGRID * rts
Definition buildings.h:54
Rendering::RenderBuffer * RTSVB
Definition buildings.h:36