Skip to content

Conversation

andburn
Copy link
Member

@andburn andburn commented Mar 26, 2016

Implemented basic OBJ exporting, works for the unity 4 & 5 bundles I have.

Elements not implemented:

  • topology triangles
  • compressed meshes
  • half-floats (16 bits)

Don't know how widespread these missing features are, but I didn't encounter them.

def export(self):
vns = self.vertices["normals"]
vts = self.vertices["uv1"]
out_str = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very slow. Create a list ret = [], and do return "\n".join(ret).

@andburn
Copy link
Member Author

andburn commented Mar 28, 2016

Updated:

  • change string concatenation to list joins
  • remove single quotes
  • remove Vec4 rgba aliases (not used)
  • remove unnecessary temporary variables
  • fix possible trailing slash on face definitions, if normals were empty

return len(streams)


def extract_indicies(mesh):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indices

@andburn
Copy link
Member Author

andburn commented Mar 29, 2016

Updated:

  • Comments addressed.
  • Make vecX_str methods static (I think they fit better inside the OBJMesh class, as they are specific to the OBJ format).
  • Added MeshData class to hold vertex and index info, moved top-level methods into it too.

@jleclanche
Copy link
Member

I think they fit better inside the OBJMesh class, as they are specific to the OBJ format

I wouldn't disagree if these were generic vectors but... just call them OBJVector2, OBJVector3 etc and you should be fine.

@andburn
Copy link
Member Author

andburn commented Mar 29, 2016

Ok.
One other thing. Its outputting the values to 15 decimal places, does rounding it down to 6-8 seem sensible?

@jleclanche
Copy link
Member

We can figure that out another time.

@andburn
Copy link
Member Author

andburn commented Mar 29, 2016

Updated to use __str__

@jleclanche jleclanche merged commit 10aa3df into HearthSim:master Apr 5, 2016
@jleclanche
Copy link
Member

Thank you!

@andburn andburn deleted the meshes branch June 20, 2016 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants