AS3 Papervision3D 访问飞机上的材料

发布于 2024-11-02 12:16:07 字数 326 浏览 0 评论 0原文

我正在寻求优化我的程序的性能。

我立即将舞台质量设置为中等(如果我将其设置为低一半,则我的影片剪辑不会渲染)。这有帮助,但我想要更多!

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧情别恋 2024-11-09 12:16:07

从 API 来看,这似乎是不可能的。不过,为了提高性能,我可以做的是删除不可见的对象,例如,如果一个平面完全隐藏在另一个平面后面,则不要显示(渲染)它。这就是我最初的问题试图实现的目标......

我将所有飞机都放在一个数组中。

//make all the planes invisible. Don't want to render them
for(var i = 0; i< planes.length(); i++)
{
  planes[i].visible = false;
}
//show the first plane so we have **something** to see
planes[0].visible = true;

这对我有用,因为我知道一次只有一个平面可见(直到它转换到下一个平面,在这种情况下,我使该平面可见,并且当当前平面完成转换时,我将其隐藏)。

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.

//make all the planes invisible. Don't want to render them
for(var i = 0; i< planes.length(); i++)
{
  planes[i].visible = false;
}
//show the first plane so we have **something** to see
planes[0].visible = true;

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文