gpt4 book ai didi

Three.js render complete(Three.js渲染完成)

转载 作者:bug小助手 更新时间:2023-10-26 20:06:28 26 4
gpt4 key购买 nike



Is there a way to tell when the object has finished rendering? I know there is a progress bar in one of the examples, but i am looking for a simple & non-convoluted example. I have looked through the loader i am using (OBJMTLLoader) and the renderer (WebGLRenderer) and i have not noticed a simple

有没有一种方法可以判断对象何时完成渲染?我知道在其中一个示例中有一个进度条,但我正在寻找一个简单而不复杂的示例。我查看了我正在使用的加载器(OBJMTLLoader)和呈现器(WebGLReneller),但我没有注意到一个简单的



renderer.complete(function(){ CODE HERE });


or similar for the loader(s). I want to for example throw up an alert when all objects are completely rendered.

或类似的装载机(S)。例如,我想在所有对象都完全呈现时抛出一个警告。



Thanks in advance.

先谢谢你。


更多回答
优秀答案推荐

Inside of the loader.addEventListener('load'... section, the last line when it adds the scene, put the function after that and it will wait until render is complete before firing.

在loader.addEventListener(‘Load’...部分,添加场景时的最后一行,将函数放在该部分之后,它将等待渲染完成后才触发。



In case anyone else needs it!

以防其他人需要!



Object3D.onAfterRender : Function

Object3D.onAfterRender:函数


In short I'm applying to a Mesh Object.

简而言之,我正在应用于网格对象。


meshCube.onAfterRender = function (){
//Here
}

An optional callback that is executed immediately after a 3D object is rendered. This function is called with the following parameters: renderer, scene, camera, geometry, material, group.

在渲染3D对象后立即执行的可选回调。使用以下参数调用此函数:渲染器、场景、摄影机、几何体、材质、组。


Please notice that this callback is only executed for renderable 3D objects. Meaning 3D objects which define their visual appearance with geometries and materials like instances of Mesh, Line, Points or Sprite. Instances of Object3D, Group or Bone are not renderable and thus this callback is not executed for such objects.

请注意,此回调仅对可渲染的3D对象执行。指的是使用几何图形和材质定义其视觉外观的3D对象,如网格、直线、点或精灵的实例。对象3D、组或骨骼的实例不可渲染,因此不会对此类对象执行此回调。


Refrence: Threejs Object3D documentation

参考:Threejs Object3D文档


更多回答

I do not completely understand your text. Could you post an an example?

我不完全理解你的课文。你能举个例子吗?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com