Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
BuildingDrawBatches.h
Go to the documentation of this file.
1
#pragma once
2
#include "
GeometryBounds.h
"
3
#include <cstdint>
4
#include <limits>
5
#include <vector>
6
7
// Only adjacent triangles with identical building shader/state inputs merge.
8
// The original component list remains intact for physics, lights and animation.
9
struct
BuildingDrawBatch
10
{
11
unsigned
component
= 0,
first
= 0,
primitives
= 0;
12
short
texture
= 0;
13
unsigned
char
type
= 0;
14
GeometryBounds
bounds
;
15
};
16
17
inline
GeometryBounds
&
AppendBuildingDrawBatch
(std::vector<BuildingDrawBatch>& batches,
18
unsigned
component,
unsigned
first,
unsigned
primitives,
short
texture,
unsigned
char
type)
19
{
20
// Campaign groups can differ even when adjacent signs share a basemap.
21
if
(!batches.empty() && primitives && type != 78 && type != 8 && type != 26)
22
{
23
auto
& previous = batches.back();
24
if
(previous.primitives && previous.texture == texture && previous.type == type &&
25
uint64_t(previous.first) + uint64_t(previous.primitives) * 3 == first &&
26
uint64_t(previous.primitives) + primitives <= (std::numeric_limits<unsigned>::max)())
27
{
28
previous.primitives += primitives;
29
return
previous.bounds;
30
}
31
}
32
batches.push_back({component, first, primitives, texture, type, {}});
33
return
batches.back().bounds;
34
}
AppendBuildingDrawBatch
GeometryBounds & AppendBuildingDrawBatch(std::vector< BuildingDrawBatch > &batches, unsigned component, unsigned first, unsigned primitives, short texture, unsigned char type)
Definition
BuildingDrawBatches.h:17
GeometryBounds.h
BuildingDrawBatch
Definition
BuildingDrawBatches.h:10
BuildingDrawBatch::type
unsigned char type
Definition
BuildingDrawBatches.h:13
BuildingDrawBatch::primitives
unsigned primitives
Definition
BuildingDrawBatches.h:11
BuildingDrawBatch::texture
short texture
Definition
BuildingDrawBatches.h:12
BuildingDrawBatch::first
unsigned first
Definition
BuildingDrawBatches.h:11
BuildingDrawBatch::bounds
GeometryBounds bounds
Definition
BuildingDrawBatches.h:14
BuildingDrawBatch::component
unsigned component
Definition
BuildingDrawBatches.h:11
GeometryBounds
Definition
GeometryBounds.h:11
Viewscreen
BuildingDrawBatches.h
Generated on
for Rise by
1.18.0