简体   繁体   English

Away3D与Starling

[英]Away3D with Starling

I have an Away3D 4.0 application with UI made in old flash display API, which can be only partly hardware accelerated. 我有一个Away3D 4.0应用程序,在旧的闪存显示API中使用UI,只能部分硬件加速。

On PC works fine, but the frame rate of UI on mobile devices is too low, hence I am porting it to Starling. 在PC上工作正常,但移动设备上的UI帧速率太低,因此我将其移植到Starling。

So I tried using both Away3D and Starling, but they don't work together (it compiles but there are run-time errors). 所以我尝试使用Away3D和Starling,但它们不能一起工作(它编译但存在运行时错误)。 What do I have to change? 我需要改变什么? Specifically or generally for maybe another 2D library such as ND2D. 具体地或通常用于可能的另一个2D库,例如ND2D。 Are there libraries that support this out of the box? 是否有开箱即用的库?

Edit: First I add an Away3D content and there are no errors. 编辑:首先我添加Away3D内容,没有错误。 When initialising Starling, the error is in Starling.as (a library class) on line 249. I also tried this as someone suggested, but didn't make any difference (also information is 3 months old and libraries are being updated). 在初始化Starling时,错误出现在第249行的Starling.as (库类)中。我也按照有人的建议尝试了这个 ,但没有任何区别(信息也是3个月,库正在更新)。

Edit 2: The error was caused by having a different enableDepthAndStencil value as is in Away3D, which is hardcoded in Sparling as false, because it doesn't really need it. 编辑2:错误是由于在Away3D中有一个不同的enableDepthAndStencil值,它在Sparling中被硬编码为false,因为它并不真正需要它。 Well, after "fixing" this there are no runtime errors: Away 3D content displays, but then I add Starling and the canvas becomes black. 好吧,在“修复”之后没有运行时错误:远离3D内容显示,但随后我添加了Starling并且画布变为黑色。 I guess I will have to dive into the Away3D source. 我想我将不得不深入了解Away3D资源。

我把它按照此指导工作的意见和一算账(另外只有改变enableDepthAndStenciltrueStarling.asupdateViewPort()

You can view the source of the starling library on their github repository. 您可以在其github存储库中查看starling库的源代码。 Here is a link to the Starling.as file> https://github.com/PrimaryFeather/Starling-Framework/blob/master/starling/src/starling/core/Starling.as 这是Starling.as文件的链接> https://github.com/PrimaryFeather/Starling-Framework/blob/master/starling/src/starling/core/Starling.as

the Starling method that is throwing an error is this: 抛出错误的Starling方法是这样的:

        private function updateViewPort():void
        {
            if (mContext)
                mContext.configureBackBuffer(mViewPort.width, mViewPort.height, mAntiAliasing, false);

            mStage3D.x = mViewPort.x;
            mStage3D.y = mViewPort.y;
        }

From the look of that you should be able to remove this code for mobile, since your use will not be able to resize the viewport. 从外观上看,您应该可以删除此移动代码,因为您的使用将无法调整视口大小。 To do this, download the library from the github repository, instead of using the swc onthe starling site. 为此,请从github存储库下载库,而不是使用starling站点上的swc。 https://github.com/PrimaryFeather/Starling-Framework Then you can customize your starling build for compatibility with Away3D. https://github.com/PrimaryFeather/Starling-Framework然后您可以自定义您的starling构建以与Away3D兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM