3#include "EntityDefinition.h"
4#include "Resources/Resources.h"
5#include "Components/Core/DynamicComponent.h"
6#include "Resources/VertexFormats.h"
20 std::vector<glm::vec3> trajectoryPoints;
21 std::vector<float> radius;
22 std::vector<glm::vec3> flowFraction;
23 std::vector<float> wallValues;
24 float heightScale = 1.f;
25 float radiusScale = 1.f;
26 bool showWater =
true;
29 float unitScale = 1.f;
30 std::string unitText =
"m";
31 bool updateNeeded =
true;
35 float fontSize = 20.f;
36 bool showAxialExtents =
true;
37 bool showShadow =
true;
39 bool centerMesh =
true;
40 bool showIndicatorRing =
false;
41 float indicatorRingPosition = 0.f;
42 glm::vec3 indicatorRingColor;
43 void updateFontSize();
46 void initialize(
Context * context);
49 static void registerType();
54 glm::vec3 flowFraction;
57 float wallValue = 0.0f;
64 float widthWaterOil = 0.f;
65 float widthOilGas = 0.f;
66 float heightWaterOil = 0.f;
67 float heightOilGas = 0.f;
81 bool invertedFlow =
false;
82 float invertedFlowRatio = 0.f;
83 bool annularFlow =
false;
84 float annularFlowRatio = 0.f;
85 glm::vec3 rotationUpVector = glm::vec3(0, 1, 0);
91 glm::vec4 normalAndOpacity;
100 static VertexFormatHandle vertexFormat = Cogs::VertexFormats::createVertexFormat(elements, 2);
109 glm::vec4 normalAndOpacity;
120 static VertexFormatHandle vertexFormat = Cogs::VertexFormats::createVertexFormat(elements, 3);
147 static bool isStratified(MeshType liquidType);
148 static bool isAnnular(MeshType liquidType);
149 static unsigned int getNumOfSegmentsInCrossSection(MeshType liquidType);
151 void createMeshEntity(
EntityPtr& mesh, MeshType liquidType);
152 void updateMaterial(
EntityPtr mesh, MeshType liquidType);
153 void generateMultiphaseFlowMesh(
Mesh* mesh,
const std::vector<ControlPoint>& controlPoints, MeshType liquidType);
155 void createGridEntity();
156 void createTextEntity();
157 void createIndicatorRing();
159 void updateGroundGrid();
160 void updateAxisAnnotations();
161 void updateIndicatorRing(
const std::vector<TrajectoryPoint>& trajectory);
163 void generateExtrusionVertices(std::vector<Vertex>& vertexBuffer, std::vector<unsigned int>& indexBuffer,
const std::vector<ControlPoint>& controlPoints, MeshType liquidType);
164 void generateExtrusionVerticesWall(std::vector<WallVertex>& vertexBuffer, std::vector<unsigned int>& indexBuffer,
const std::vector<ControlPoint>& controlPoints, MeshType liquidType);
165 void generateClosingCaps(std::vector<Vertex>& vertexBuffer, std::vector<unsigned int>& indexBuffer,
const ControlPoint& controlPoint, MeshType liquidType);
167 void transformCrossection(
float ratio,
float alpha, std::vector<Vertex>& vertexBuffer,
const ControlPoint& controlPoint, MeshType liquidType,
bool isClosingCap =
false);
169 void removeDuplicatedPoints(std::vector<TrajectoryPoint>& points);
170 void applyScaling(std::vector<TrajectoryPoint>& points);
171 void center(std::vector<TrajectoryPoint>& points);
174 void updateShadowVisibility();
176 void finalizeControlPoints(std::vector<ControlPoint>& controlPoints);
178 static glm::vec3 wallValueToColor(
const ControlPoint& controlPoint);
180 static void calculateNormals(std::vector<Vertex>& vertexBuffer, std::vector<unsigned int>& indexBuffer);
195 Context* context =
nullptr;
196 Material* mainMaterial =
nullptr;
200 EntityPtr meshEntity[MeshType::Last + 1];
206 EntityPtr textEntity[AnnotationAxis::AxisLast + 1];
208 glm::vec3 geometryMin;
209 glm::vec3 geometryMax;
211 glm::vec3 scaledTrajectoryMin;
212 glm::vec3 scaledTrajectoryMax;
214 float currentFontSize = -1.f;
216 bool currentShowAxialExtents =
true;
217 bool currentShowGrid =
true;
218 bool currentCenterMesh =
true;
219 bool currentShowIndicatorRing =
false;
224template<>
inline Cogs::StringView getName<Cogs::Core::MultiphaseFlowComponent>() {
return "MultiphaseFlowComponent"; }
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Base class for components implementing dynamic behavior.
Provides a weakly referenced view over the contents of a string.
std::shared_ptr< ComponentModel::Entity > EntityPtr
Smart pointer for Entity access.
uint16_t VariableKey
Used to lookup material properties.
Contains all Cogs related functionality.
@ VertexData
Per vertex data.
@ Position
Position semantic.
Meshes contain streams of vertex data in addition to index data and options defining geometry used fo...
Vertex element structure used to describe a single data element in a vertex for the input assembler.