Class FluidRenderer
Constructors
constructor
-
Initializes the class
Parameters
- scene: Scene
Scene in which the objects are part of
Returns FluidRenderer
- scene: Scene
Properties
Readonlyrender Objects
Retrieves all the render objects managed by the class
Readonlytarget Renderers
Retrieves all the render target renderers managed by the class
Accessors
shader Language
-
get shaderLanguage(): ShaderLanguage
Gets the shader language used in this renderer
Returns ShaderLanguage
Methods
add Custom Particles
-
addCustomParticles(
buffers: { [key: string]: FloatArray },
numParticles: number,
generateDiffuseTexture?: boolean,
targetRenderer?: FluidRenderingTargetRenderer,
camera?: any,
): IFluidRenderingRenderObjectAdds a custom particle set to the fluid renderer.
Parameters
- buffers: { [key: string]: FloatArray }
The list of buffers (should contain at least a "position" buffer!)
- numParticles: number
Number of particles in each buffer
OptionalgenerateDiffuseTexture: booleanTrue if you want to generate a diffuse texture from buffers and use it as part of the fluid rendering (default: false). For the texture to be generated correctly, you need a "color" buffer in the set!
OptionaltargetRenderer: FluidRenderingTargetRendererThe target renderer used to display the particle system as a fluid. If not provided, the method will create a new one
Optionalcamera: anyThe camera used by the target renderer (if the target renderer is created by the method)
Returns IFluidRenderingRenderObject
the render object corresponding to the custom particle set
- buffers: { [key: string]: FloatArray }
add Particle System
-
addParticleSystem(
ps: IParticleSystem,
generateDiffuseTexture?: boolean,
targetRenderer?: FluidRenderingTargetRenderer,
camera?: any,
): IFluidRenderingRenderObjectAdds a particle system to the fluid renderer.
Parameters
- ps: IParticleSystem
particle system
OptionalgenerateDiffuseTexture: booleanTrue if you want to generate a diffuse texture from the particle system and use it as part of the fluid rendering (default: false)
OptionaltargetRenderer: FluidRenderingTargetRendererThe target renderer used to display the particle system as a fluid. If not provided, the method will create a new one
Optionalcamera: anyThe camera used by the target renderer (if the target renderer is created by the method)
Returns IFluidRenderingRenderObject
the render object corresponding to the particle system
- ps: IParticleSystem
dispose
-
Disposes of all the resources used by the class
Returns void
get Render Object From Particle System
-
Gets the render object corresponding to a particle system (null if the particle system is not rendered as a fluid)
Parameters
- ps: IParticleSystem
The particle system
Returns Nullable<IFluidRenderingRenderObject>
the render object corresponding to this particle system if any, otherwise null
- ps: IParticleSystem
recreate
-
Reinitializes the class Can be used if you change the object priority (FluidRenderingObject.priority), to make sure the objects are rendered in the right order
Returns void
remove Render Object
-
removeRenderObject(
renderObject: IFluidRenderingRenderObject,
removeUnusedTargetRenderer?: boolean,
): booleanRemoves a render object from the fluid renderer
Parameters
- renderObject: IFluidRenderingRenderObject
the render object to remove
- removeUnusedTargetRenderer: boolean = true
True to remove/dispose of the target renderer if it's not used anymore (default: true)
Returns boolean
True if the render object has been found and released, else false
- renderObject: IFluidRenderingRenderObject
Class responsible for fluid rendering. It is implementing the method described in https://developer.download.nvidia.com/presentations/2010/gdc/Direct3D_Effects.pdf