diff --git a/docs/api/en/extras/objects/ImmediateRenderObject.html b/docs/api/en/extras/objects/ImmediateRenderObject.html index 820bf80f5a393..f657ab53658d5 100644 --- a/docs/api/en/extras/objects/ImmediateRenderObject.html +++ b/docs/api/en/extras/objects/ImmediateRenderObject.html @@ -12,27 +12,103 @@

[name]

-

base class for immediate rendering objects.

+

+ This experimental class provides a fast code path for rendering meshes with frequently updated + geometry data. When the renderer encounters an instance of [name], it only takes care about + the most primitive rendering operations (e.g. binding vertex attributes, determining correct shader + program or perfoming the actual draw call). Features like view frustum culling, wireframe rendering + or using multiple materials are not supported. Besides [name] can only be used to render triangles. +

+ +

+ [name] does not work with instances of [page:BufferGeometry] or [page:Geometry]. The + raw geometry data have to be maintained as properties of the [name]. +

+ +

+ Using [name] makes only sense if you are updating your geometry data per frame. You can then + benefit of a faster code path compared to the default mesh redering logic. +

+

Examples

+

+ [example:webgl_marchingcubes Marching Cubes] +

Constructor

-

[name]()

+

[name]( [param:Material material] )

- This creates a new [name]. + [page:Material material] — The material of the [name].

+

Properties

+

See the base [page:Object3D] class for common properties.

+ +

[property:Boolean material]

+

+ The material of the [name]. Assigning multiple materials is not supported. +

+ +

[property:Boolean hasPositions]

+

+ Whether position data are defined or not. Default is *false*. +

+ +

[property:Boolean hasNormals]

+

+ Whether normal data are defined or not. Default is *false*. +

+ +

[property:Boolean hasColors]

+

+ Whether color data are defined or not. Default is *false*. +

+ +

[property:Boolean hasUvs]

+

+ Whether texture coordinates are defined or not. Default is *false*. +

+ +

[property:Float32Array positionArray]

+

+ The buffer holding position data. Default is *null*. +

+ +

[property:Float32Array normalArray]

+

+ The buffer holding normal data. Default is *null*. +

+ +

[property:Float32Array colorArray]

+

+ The buffer holding color data. Default is *null*. +

+ +

[property:Float32Array uvArray]

+

+ The buffer holding texture coordinates. Default is *null*. +

+ +

[property:Integer count]

+

+ The number of primitives to be rendered. Default is *0*. + This property will be set to *0* after each rendering so you usually + set it in the implementatio of [page:.render](). +

Methods

+

See the base [page:Object3D] class for common methods.

[method:null render]([param:Function renderCallback])

- renderCallback -- A function to render the generated object. + renderCallback -- A function to render the generated geometry data.

- This function needs to be overridden to start the creation of the object and should call renderCallback when finished. + This method needs to be implemented by the deriving class of [name]. You normally want to implement the + vertex buffer update logic and execute *renderCallback* at the end of your implementation.

Source

diff --git a/docs/api/zh/extras/objects/ImmediateRenderObject.html b/docs/api/zh/extras/objects/ImmediateRenderObject.html index 5cfd8558a064b..982f1260ea866 100644 --- a/docs/api/zh/extras/objects/ImmediateRenderObject.html +++ b/docs/api/zh/extras/objects/ImmediateRenderObject.html @@ -12,27 +12,102 @@

即时渲染对象([name])

-

即时渲染对象的基类。

+

+ This experimental class provides a fast code path for rendering meshes with frequently updated + geometry data. When the renderer encounters an instance of [name], it only takes care about + the most primitive rendering operations (e.g. binding vertex attributes, determining correct shader + program or perfoming the actual draw call). Features like view frustum culling, wireframe rendering + or using multiple materials are not supported. Besides [name] can only be used to render triangles. +

+

+ [name] does not work with instances of [page:BufferGeometry] or [page:Geometry]. The + raw geometry data have to be maintained as properties of the [name]. +

+ +

+ Using [name] makes only sense if you are updating your geometry data per frame. You can then + benefit of a faster code path compared to the default mesh redering logic. +

+ +

例子

+

+ [example:webgl_marchingcubes Marching Cubes] +

构造函数(Constructor)

+

[name]( [param:Material material] )

+

+ [page:Material material] — The material of the [name]. +

+ +

Properties

+

See the base [page:Object3D] class for common properties.

+ +

[property:Boolean material]

+

+ The material of the [name]. Assigning multiple materials is not supported. +

+ +

[property:Boolean hasPositions]

+

+ Whether position data are defined or not. Default is *false*. +

+ +

[property:Boolean hasNormals]

+

+ Whether normal data are defined or not. Default is *false*. +

+ +

[property:Boolean hasColors]

+

+ Whether color data are defined or not. Default is *false*. +

+ +

[property:Boolean hasUvs]

+

+ Whether texture coordinates are defined or not. Default is *false*. +

+ +

[property:Float32Array positionArray]

+

+ The buffer holding position data. Default is *null*. +

+ +

[property:Float32Array normalArray]

+

+ The buffer holding normal data. Default is *null*. +

-

[name]()

+

[property:Float32Array colorArray]

- 这会创建一个新的 [name]。 + The buffer holding color data. Default is *null*.

+

[property:Float32Array uvArray]

+

+ The buffer holding texture coordinates. Default is *null*. +

+ +

[property:Integer count]

+

+ The number of primitives to be rendered. Default is *0*. + This property will be set to *0* after each rendering so you usually + set it in the implementatio of [page:.render](). +

方法(Methods)

+

See the base [page:Object3D] class for common methods.

[method:null render]([param:Function renderCallback])

- renderCallback -- 生成对象的渲染函数。 + renderCallback -- A function to render the generated geometry data.

- 需要重写此函数以开始创建对象,并在完成时调用renderCallback。 + This method needs to be implemented by the deriving class of [name]. You normally want to implement the + vertex buffer update logic and execute *renderCallback* at the end of your implementation.

源码(Source)

diff --git a/examples/screenshots/webgl_gpgpu_birds_gltf.png b/examples/screenshots/webgl_gpgpu_birds_gltf.png new file mode 100644 index 0000000000000..0b1e8a5796e28 Binary files /dev/null and b/examples/screenshots/webgl_gpgpu_birds_gltf.png differ diff --git a/src/extras/objects/ImmediateRenderObject.d.ts b/src/extras/objects/ImmediateRenderObject.d.ts index 3145ad7def819..8e6d2adb0b08f 100644 --- a/src/extras/objects/ImmediateRenderObject.d.ts +++ b/src/extras/objects/ImmediateRenderObject.d.ts @@ -8,6 +8,19 @@ export class ImmediateRenderObject extends Object3D { constructor( material: Material ); material: Material; + + hasPositions: boolean; + hasNormals: boolean; + hasColors: boolean; + hasUvs: boolean; + + positionArray: null | Float32Array; + normalArray: null | Float32Array; + colorArray: null | Float32Array; + uvArray: null | Float32Array; + + count: number; + render( renderCallback: Function ): void; } diff --git a/src/extras/objects/ImmediateRenderObject.js b/src/extras/objects/ImmediateRenderObject.js index f10becfd25729..27737b463ff26 100644 --- a/src/extras/objects/ImmediateRenderObject.js +++ b/src/extras/objects/ImmediateRenderObject.js @@ -11,6 +11,18 @@ function ImmediateRenderObject( material ) { this.material = material; this.render = function ( /* renderCallback */ ) {}; + this.hasPositions = false; + this.hasNormals = false; + this.hasColors = false; + this.hasUvs = false; + + this.positionArray = null; + this.normalArray = null; + this.colorArray = null; + this.uvArray = null; + + this.count = 0; + } ImmediateRenderObject.prototype = Object.create( Object3D.prototype );