Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWD files broken on HTML5 (distinct from native platform bug) (Bounty 100EUR) #14

Closed
TerryCavanagh opened this issue Sep 12, 2017 · 3 comments

Comments

@TerryCavanagh
Copy link

related issues: #13 #4

Looks like AWD models don't load at all in away3d for html5 builds. This seems to be true both for the latest version of openfl/lime (6.1.0 and 5.4.0 at time of writing), and also the old versions I've been using for development (5.1.5 and 5.2.1).

In away3d.loaders.parsers.AWD2Parser.hx, if I set debug=true; on line 47, I get the following output in HTML5:

AWD2Parser.hx:339: Import AWDFile of version = 2 - 1
AWD2Parser.hx:340: Global Settings = Compression = 189 | Streaming = true | Matrix-Precision = true | Geometry-Precision = true | Properties-Precision = true

It's reading a compression value of 189, which is well out of bounds and clearly wrong. For comparison, here is the same debug output in flash, where the test model loads correctly:

AWD2Parser.hx:339: Import AWDFile of version = 2 - 1
AWD2Parser.hx:340: Global Settings = Compression = 1 | Streaming = false | Matrix-Precision = false | Geometry-Precision = false | Properties-Precision = false
AWD2Parser.hx:404: AWDBlock:  ID = 1 | TypeID = 255 | Compression = false | Matrix-Precision = false | Geometry-Precision = false | Properties-Precision = false
AWD2Parser.hx:1998: Parsed a MetaDataBlock: TimeStamp         = 958575047
AWD2Parser.hx:1999:                         EncoderName       = AwayBuilder
AWD2Parser.hx:2000:                         EncoderVersion    = 1.0.0
AWD2Parser.hx:2001:                         GeneratorName     = AwayBuilder
AWD2Parser.hx:2002:                         GeneratorVersion  = 1.0.0
AWD2Parser.hx:497: 

AWD2Parser.hx:404: AWDBlock:  ID = 2 | TypeID = 254 | Compression = false | Matrix-Precision = false | Geometry-Precision = false | Properties-Precision = false
AWD2Parser.hx:1990: Parsed a NameSpaceBlock: ID = 1 | String = http://example.com/myawdns
AWD2Parser.hx:497: 

AWD2Parser.hx:404: AWDBlock:  ID = 3 | TypeID = 1 | Compression = false | Matrix-Precision = false | Geometry-Precision = false | Properties-Precision = false
AWD2Parser.hx:628: Parsed a TriangleGeometry: Name = geometry| SubGeometries = 1
AWD2Parser.hx:497: 

AWD2Parser.hx:404: AWDBlock:  ID = 4 | TypeID = 82 | Compression = false | Matrix-Precision = false | Geometry-Precision = false | Properties-Precision = false
AWD2Parser.hx:1398: Start parsing a embed Bitmap for Texture
AWD2Parser.hx:497: 

AWD2Parser.hx:192: Successfully loadet Bitmap for texture
AWD2Parser.hx:193: Parsed CubeTexture: Name = file:///C:/Users/terry/Desktop/cat.jpg
AWD2Parser.hx:404: AWDBlock:  ID = 5 | TypeID = 81 | Compression = false | Matrix-Precision = false | Geometry-Precision = false | Properties-Precision = false
AWD2Parser.hx:1364: Parsed a TextureMaterial(SinglePass): Name = 'Material1' | Texture-Name = file:///C:/Users/terry/Desktop/cat.jpg
AWD2Parser.hx:497: 

AWD2Parser.hx:404: AWDBlock:  ID = 6 | TypeID = 23 | Compression = false | Matrix-Precision = false | Geometry-Precision = false | Properties-Precision = false
AWD2Parser.hx:796: Parsed a Mesh: Name = 'Cube_Cube.001' | Parent-Name = Root (TopLevel)| Geometry-Name = geometry | SubMeshes = 1 | Mat-Names = Material1
AWD2Parser.hx:497: 

AWD2Parser.hx:404: AWDBlock:  ID = 7 | TypeID = 1 | Compression = false | Matrix-Precision = false | Geometry-Precision = false | Properties-Precision = false
AWD2Parser.hx:628: Parsed a TriangleGeometry: Name = geometry| SubGeometries = 1
AWD2Parser.hx:497: 

(I'm using cat.awd from this issue as the test model: #13)

I'm really interested in getting these three interconnected bugs fixed (this one, #13 and #4) so that I can release a project I've been working on! Therefore, I'm going to try offering a bounty, which I've never done before. (inspired by a recent openfl issue)

I offer a bounty of 100 EUR for a pull request to this project that fixes AWD parsing for both native and html5, for the most recent builds of openfl and lime. I consider AWD parsing sufficiently fixed for me if the demo cat model in this issue (#13) can be loaded successfully in both native and html5.

@Greg209
Copy link
Contributor

Greg209 commented Sep 12, 2017

It was a weird one to find, as the byte arrays looked different between Flash and HTML5. It turns out that in the Asset loading system, binary files are detected by extension. AWD is not in that list. As such it was being interpretted as text and resulting in odd values.

Adding the following to the project.xml seemed to fix it for me, forcing the file type to be binary

<assets path="Assets" rename="assets" include="*.awd" type="binary"/>

@jgranick
Copy link
Member

openfl/lime@2932a9b
d42dd71

@TerryCavanagh
Copy link
Author

This is fixed! That was fast! Thank you both very much!

I'll message on the openfl slack to figure out the bounty right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants