载入中...
搜索中...
未找到
Water.cpp
浏览该文件的文档.
46 !std::isfinite(settings.sizeX) || !std::isfinite(settings.sizeY) || !std::isfinite(settings.sizeZ) ||
51 DiagnosticCode::InvalidArgument, "water.mesh: finite positive size/density and a supported shape are required"));
58 Diagnostic::error(DiagnosticCode::InvalidArgument, "water.mesh: generated axis point count exceeds 4096"));
66 Diagnostic::error(DiagnosticCode::InvalidArgument, "water.mesh: plane requires at least one polygon"));
69 Diagnostic::error(DiagnosticCode::InvalidArgument, "water.mesh: circle requires at least one ring"));
96 if (!std::isfinite(time) || !std::isfinite(red) || !std::isfinite(green) || !std::isfinite(blue) ||
107 if (!std::isfinite(time) || !std::isfinite(alpha) || time < 0.0F || time > 1.0F || alpha < 0.0F || alpha > 1.0F)
125 Diagnostic::error(DiagnosticCode::InvalidArgument, "water.mesh: triangle count is not representable"));
214 Diagnostic::error(DiagnosticCode::PreconditionViolation, "water.mesh: graphics owner is unavailable"));
282 if (!gfx_ || resolution < 2 || resolution > 4096 || gradient.colorStops.empty() || gradient.alphaStops.empty())
284 DiagnosticCode::InvalidArgument, "water.gradient: graphics, color/alpha keys and resolution 2..4096 required"));
331 Diagnostic::error(DiagnosticCode::InvalidArgument, "water.direction: finite degrees required"));
342void Water::setReflectionIntensity(float v) { config_.reflectionIntensity = std::clamp(v, 0.0F, 4.0F); }
368 shader_->sendVec3("shallowColor", config_.shallowColor.x, config_.shallowColor.y, config_.shallowColor.z);
369 shader_->sendFloat("depthDistance", depthGradientTexture_ ? -config_.depthDistance : config_.depthDistance);
372 shader_->sendVec3("reflTint", config_.reflectionTint.x, config_.reflectionTint.y, config_.reflectionTint.z);
376 shader_->sendFloat("ssrStrength", config_.screenSpaceReflection ? config_.screenSpaceReflectionStrength : -1.0F);
439 shader_->sendFloat("ssrStrength", config_.screenSpaceReflection ? config_.screenSpaceReflectionStrength : -1.0F);
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
void expect(std::string_view message) const
Require success for a void operation.
Definition Result.h:548
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Definition Graphics.h:125
ScreenSpaceReflection * pipelineScreenSpaceReflection()
Pipeline screen space reflection.
Definition Graphics.cpp:1601
virtual std::string getBackendName() const =0
Renderer backend id used by sibling modules (e.g. Gpgpu).
virtual Shader * newMeshShaderFromSpv(const std::vector< uint32_t > &vertSpv, const std::vector< uint32_t > &fragSpv)=0
Create a Mesh3D custom shader (MeshVertex + Frame UBO + albedo). Empty vert → default mesh3d....
Texture * newTextureFromImageData(image::ImageData *data, bool repeatU=false, bool repeatV=false)
Creates a texture from image data. @ownership Caller deletes unless documented otherwise.
Definition Graphics.cpp:1737
virtual void setMesh3DSceneDepth(Texture *depth)=0
Optional scene hardware depth (G-buffer hwDepth, Vulkan NDC z) bound to mesh3d shader binding 7....
virtual eve::Result< void > configureMeshShaderSurface(Shader &, BlendMode, bool, bool)
Prepare a custom mesh shader's blend, depth and culling state.
Definition Graphics.h:1830
virtual Texture * getSceneColorTexture()
Sampleable 3D color target for the current frame (RGB = lit, A = linear depth). Valid after begin3DFr...
Definition Graphics.h:1047
virtual void drawMeshShader(Mesh *mesh, const glm::mat4 &model, Texture *texture, const Color &tint, Shader *shader)=0
Draw mesh with an explicit Mesh3D Shader (nullptr = default PBR pipeline).
RenderControl * getRenderControl()
Shared compilable 3D render control (features → pass list + GBuffer). Owned by Graphics; valid for th...
Definition Graphics.cpp:254
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)....
virtual Shader * newMeshShaderFromWgsl(const std::string &vertWgsl, const std::string &fragWgsl)=0
Create a Mesh3D custom shader from WGSL source (WebGPU backend). The WGSL must declare the engine's F...
virtual void setMesh3DNormalTexture(Texture *normal)=0
Optional normal map for the next drawMesh / drawMeshShader (nullptr = flat).
virtual void setMesh3DHeightTexture(Texture *height)=0
Optional height map for parallax (R channel; nullptr = flat / off).
static void removeCaptureExtraDrawer(uint64_t token)
Unregister an offscreen capture contributor.
Definition RenderSystem3D.cpp:488
static uint64_t addCaptureExtraDrawer(uint32_t reflectionCaptureMask, CaptureExtraDrawer drawer)
Register custom forward geometry for offscreen captures.
Definition RenderSystem3D.cpp:481
Screen-space reflections (SSR) as a fullscreen post pass. @lifetime All Graphics and texture argument...
Definition ScreenSpaceReflection.h:30
bool hasValidHistory() const
True once a temporally resolved reflection frame is safe to sample.
Definition ScreenSpaceReflection.h:112
Texture * getReflectionTexture()
The reflection texture from the owned canvas, or nullptr before first apply.
Definition ScreenSpaceReflection.cpp:321
void sendFloat(const std::string &name, float x)
Definition Shader.cpp:95
void sendVec3(const std::string &name, float x, float y, float z)
Definition Shader.cpp:102
int declareFloat(const std::string &name)
Reserve sequential float slots in the push-constant block. Returns start index.
Definition Shader.cpp:43
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:18
Result< void > setWaveDirectionAngle(float degrees)
Set Pcg PWS_WaterSystem wave direction in finite degrees around world Y.
Definition Water.cpp:328
void setScreenSpaceReflection(bool enabled, float strength=0.85f)
Optional screen-space reflection overlay. When enabled, the shader samples the temporally resolved SS...
Definition Water.cpp:344
Result< int > createProceduralMesh(const WaterMeshSettings &settings)
Validate, generate and atomically publish a Pcg-compatible plane or concentric-circle mesh.
Definition Water.cpp:207
void setRippleAmplitude(float amp)
Amplitude of the occasional middle drop ripples.
Definition Water.cpp:323
Result< std::string > configJson() const
Return the canonical current eve.graphics.stylized-water/1 JSON snapshot.
Definition Water.cpp:391
void draw()
Draw the water plane (uses default mesh3d camera / lighting state).
Definition Water.cpp:393
void setEdgeFalloff(float edge)
Compatibility setter for the world-space shoreline foam width.
Definition Water.cpp:324
void createPlane(float sizeX, float sizeZ, int segX, int segZ)
Build a flat XZ plane (Y-up) sized sizeX × sizeZ with UVs in [0,1]².
Definition Water.cpp:172
static int paramCount()
Names of the push-constant parameters (for UI / inspection).
Definition Water.cpp:152
Result< int > setDepthGradient(const WaterDepthGradient &gradient, int resolution)
Bake Pcg GenerateColorDepth semantics and atomically publish the clamp-sampled texture.
Definition Water.cpp:281
void setViewport(float width, float height)
Window / target size in pixels, used to compute screen-space UVs.
Definition Water.cpp:348
Result< void > applyConfigJson(const std::string &json)
Atomically replace all authored parameters from eve.graphics.stylized-water/1 JSON.
Definition Water.cpp:383
void drawWithPlanarReflection(Texture *planarReflection, float strength=1.0F)
Draw with an optional caller-rendered planar reflection.
Definition Water.cpp:395
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:26
ssq::Table project(HSQUIRRELVM vm, const eve::Result< void > &result)
Project a completed editing result that has no payload.
Definition EditorScriptProjection.h:28
constexpr char kWaterFragWgsl[]
Backend-parity stylized-water WGSL source with depth foam and scene-color refraction.
Definition WaterWgsl.h:36
constexpr char kWaterVertWgsl[]
Vertex-displaced low-frequency water layers for the WebGPU backend.
Definition WaterWgsl.h:6
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
Result< int > calculateWaterMeshTriangles(const WaterMeshSettings &settings)
Calculate Pcg PWS_WaterSystem's triangle count without allocating a mesh.
Definition Water.cpp:117
Shader * newWaterShader(Graphics *gfx)
Create the embedded water fragment shader (owned by Graphics).
Definition Water.cpp:129
@ InvalidArgument
@ PreconditionViolation
@ Failed
@ Project
@ Alpha
Caller-owned color and alpha keys used to bake a water depth-ramp texture.
Definition Water.h:41
std::vector< WaterGradientAlphaStop > alphaStops
Definition Water.h:43
std::vector< WaterGradientColorStop > colorStops
Definition Water.h:42
Result< void > addAlphaStop(float time, float alpha)
Add a finite normalized alpha stop, preserving no external reference.
Definition Water.cpp:106
Result< void > addColorStop(float time, float red, float green, float blue)
Add a finite normalized RGB stop, preserving no external reference.
Definition Water.cpp:95
Authored dimensions and density for Pcg-compatible procedural water geometry.
Definition Water.h:18
float causticsStrength
Definition WaterStyleConfig.h:47
Result< std::string > toJson() const
Serialize canonical JSON after validation.
Definition WaterStyleConfig.cpp:196
glm::vec3 reflectionTint
Definition WaterStyleConfig.h:22
float screenSpaceReflectionStrength
Definition WaterStyleConfig.h:43
bool screenSpaceReflection
Definition WaterStyleConfig.h:42
float rippleAmplitude
Definition WaterStyleConfig.h:28
static Result< WaterStyleConfig > fromJson(std::string_view json)
Parse JSON and decode version one transactionally.
Definition WaterStyleConfig.cpp:190
float refractionStrength
Definition WaterStyleConfig.h:45
float reflectionIntensity
Definition WaterStyleConfig.h:40