-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwiHairParticle.h
71 lines (57 loc) · 1.72 KB
/
wiHairParticle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include "CommonInclude.h"
#include "wiGraphicsDevice.h"
#include "wiEnums.h"
#include "wiECS.h"
#include "wiScene_Decl.h"
#include "wiIntersect.h"
#include <memory>
class wiArchive;
namespace wiScene
{
class wiHairParticle
{
private:
wiGraphics::GPUBuffer cb;
wiGraphics::GPUBuffer particleBuffer;
wiGraphics::GPUBuffer simulationBuffer;
wiGraphics::GPUBuffer culledIndexBuffer;
wiGraphics::GPUBuffer indirectBuffer;
wiGraphics::GPUBuffer indexBuffer;
wiGraphics::GPUBuffer vertexBuffer_length;
public:
void UpdateCPU(const TransformComponent& transform, const MeshComponent& mesh, float dt);
void UpdateGPU(const MeshComponent& mesh, const MaterialComponent& material, wiGraphics::CommandList cmd) const;
void Draw(const CameraComponent& camera, const MaterialComponent& material, RENDERPASS renderPass, wiGraphics::CommandList cmd) const;
enum FLAGS
{
EMPTY = 0,
_DEPRECATED_REGENERATE_FRAME = 1 << 0,
REBUILD_BUFFERS = 1 << 1,
};
uint32_t _flags = EMPTY;
wiECS::Entity meshID = wiECS::INVALID_ENTITY;
uint32_t strandCount = 0;
uint32_t segmentCount = 1;
uint32_t randomSeed = 1;
float length = 1.0f;
float stiffness = 10.0f;
float randomness = 0.2f;
float viewDistance = 200;
std::vector<float> vertex_lengths;
// Sprite sheet properties:
uint32_t framesX = 1;
uint32_t framesY = 1;
uint32_t frameCount = 1;
uint32_t frameStart = 0;
// Non-serialized attributes:
XMFLOAT4X4 world;
XMFLOAT4X4 worldPrev;
AABB aabb;
std::vector<uint32_t> indices; // it is dependent on vertex_lengths and contains triangles with non-zero lengths
uint32_t layerMask = ~0u;
mutable bool regenerate_frame = true;
void Serialize(wiArchive& archive, wiECS::EntitySerializer& seri);
static void Initialize();
};
}