载入中...
搜索中...
未找到
VolumeFluidShadowCaster.cpp
浏览该文件的文档.
13 return Status::failure(Diagnostic::error(DiagnosticCode::Failed, message, "fluids.volume.shadowCaster"));
17VolumeFluidShadowCaster::VolumeFluidShadowCaster(graphics::Graphics& graphics) : graphics_(&graphics) {}
24Result<void> VolumeFluidShadowCaster::update(const VolumeFluid& fluid, unsigned actorGroup, float radiusScale,
28 auto copied = fluid.copyParticleImpostors(actorGroup, radiusScale, glm::vec4(1.f), alpha, maxParticles, candidate);
37 static constexpr glm::vec3 directions[6] = {{1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}};
38 static constexpr uint32_t faces[24] = {0, 2, 4, 2, 1, 4, 1, 3, 4, 3, 0, 4, 2, 0, 5, 1, 2, 5, 3, 1, 5, 0, 3, 5};
40 const auto q = glm::quat(candidate[i].orientation.w, candidate[i].orientation.x, candidate[i].orientation.y,
56 mesh_ = graphics_->newMeshFromArrays(positions_.data(), normals_.data(), nullptr, int(count * 6),
58 else if (count != 0 && !graphics_->updateMeshVertices(mesh_, positions_.data(), normals_.data(), nullptr,
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Status failure(StatusCode code, Diagnostic diagnostic)
Construct a failed status with one diagnostic.
Definition Status.h:84
Result< void > update(const VolumeFluid &fluid, unsigned actorGroup, float radiusScale, float alpha=1.f, unsigned maxParticles=4096)
Rebuild one actor's bounded octahedral shadow batch.
Definition VolumeFluidShadowCaster.cpp:24
VolumeFluidShadowCaster(graphics::Graphics &graphics)
Constructs a VolumeFluidShadowCaster.
Definition VolumeFluidShadowCaster.cpp:17
~VolumeFluidShadowCaster()
Releases VolumeFluidShadowCaster resources.
Definition VolumeFluidShadowCaster.cpp:19
CPU position-based free-volume fluid with a bounded spatial grid. @ownership Owns all particle state;...
Definition VolumeFluid.h:517
Result< void > copyParticleImpostors(unsigned actorGroup, float radiusScale, glm::vec4 tint, float alpha, unsigned maxInstances, std::vector< VolumeFluidParticleInstance > &instances) const
Writes Fluid3DParticleRenderer-style instances into caller-owned reusable storage.
Definition VolumeFluidTools.cpp:557
Definition Graphics.h:125
virtual bool releaseMesh(Mesh *mesh)
Eagerly releases a mesh created by this Graphics.
Definition Graphics.h:927
virtual void drawMeshShadow(Mesh *mesh, const glm::mat4 &lightMVP, bool doubleSided=true)=0
Queue an opaque shadow caster.
virtual bool updateMeshVertices(Mesh *mesh, const float *posXYZ, const float *nrmXYZ, const float *uvST, int vertexCount, const uint32_t *indices, int indexCount)=0
In-place update of a mesh's vertex/index data (CPU -> host-visible VBO). Mirrors bakeMeshMorph: the u...
virtual Mesh * newMeshFromArrays(const float *posXYZ, const float *nrmXYZ, const float *uvST, int vertexCount, const uint32_t *indices, int indexCount)=0
Upload a triangle mesh from packed CPU arrays. Owned by Graphics. posXYZ required (vertexCount*3)....
static void removeShadowExtraDrawer(uint64_t token)
Remove one shadow callback before destroying its captured state.
Definition RenderSystem3D.cpp:533
static uint64_t addShadowExtraDrawer(ShadowExtraDrawer drawer)
Adds shadow extra drawer.
Definition RenderSystem3D.cpp:526
@ Failed