AS3 Papervision3D 访问飞机上的材料
我正在寻求优化我的程序的性能。
我立即将舞台质量设置为中等(如果我将其设置为低一半,则我的影片剪辑不会渲染)。这有帮助,但我想要更多!
我在 P3D Essentials 书中读到的一个提示是在不需要时关闭动画材质。很棒的想法,但没有解释如何实现。
当我创建材质时,我可以设置 material.animated = false
并且可以正常工作,但在另一个函数中我无法访问基元的材质。像 plane.material.animated = false
这样简单的东西会返回 null 异常。那么如何在我的图元上动态打开/关闭动画材质呢?
I'm looking to optimise the performance of my program.
Off the bat I've set stage quality to medium (if I set it to Low half my movieclips don't render). This helped, but I want more!!!
A hint I've read in the P3D Essentials book is to turn of animated materials when not needed. Fantastic idea, but doesn't explain how.
When I create a material I can set material.animated = false
and that works, but in another function I cannot access the material of my primitives. Something as simple as plane.material.animated = false
returns a null exception. So how do I turn on/off animated materials dynamically on my primitives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 API 来看,这似乎是不可能的。不过,为了提高性能,我可以做的是删除不可见的对象,例如,如果一个平面完全隐藏在另一个平面后面,则不要显示(渲染)它。这就是我最初的问题试图实现的目标......
我将所有飞机都放在一个数组中。
这对我有用,因为我知道一次只有一个平面可见(直到它转换到下一个平面,在这种情况下,我使该平面可见,并且当当前平面完成转换时,我将其隐藏)。
Looking through the API this appears to be impossible. What I can do to improve performance, though, is remove the objects that are not visible, e.g. if a plane is completely hidden behind another plane, then don't show (render) it. This is what I was attempting to achieve with my original question...
I have all my planes held in an array.
This works for me because I know that only one plane will be visible at a time (until it transitions to the next plane, in which case I make that plane visible, and when the current plane has finished transitioning, I hide that).