Gildor's Forums

Author Topic: UStaticMesh and CMeshSection  (Read 3499 times)
Mwnta2K
Newbie
*
Posts: 2


View Profile
UStaticMesh and CMeshSection
« on: December 25, 2014, 16:55 »

Hello i am building a library that can load unreal packages for using it in Unity3D . Currently i am using EliotVU/Unreal-Library to parse the packages stucture and useing your code as reference  to see for the  data structure inside UObjects itself.
Currently i stuck on rendering the static mesh basicly i can read entire index and vertex buffer and display it properly but cant apply the texture because  i am not sure how to map CMeshSection's to the vertex buffer and to know the vertexes for each "sub mesh" (section).

Can you give me kind of direction how i can extract the vertexes for each section ?
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7921



View Profile WWW
Re: UStaticMesh and CMeshSection
« Reply #1 on: December 25, 2014, 17:00 »

Hello.

The purpose of "MeshSection" (for both skeletal and static meshes) is to store mapping between material and range of vertices in vertex buffer.

Take a look at StaticMesh rendering code. It resides at MeshInstance/StatMeshInstance.cpp.
Mesh is loaded into UStaticMesh (UStaticMesh3 for UE3) class and then converted to CStaticMesh. Mesh loading code is quite hard to understand because it supports very large number of format variations. But if you want to support some specific game, you may clean up code by removing #if SOME_GAME_NAME/#endif regions of code - I specially marked code in such way to simplify understanding.
Logged
Mwnta2K
Newbie
*
Posts: 2


View Profile
Re: UStaticMesh and CMeshSection
« Reply #2 on: December 26, 2014, 01:15 »

Thanks for the direction Smiley  I finaly found actually the "missing part of the puzzle" in one of your comments in the source code

// Lineage2 has meshes with UVStream[i>1].Data size less than NumVerts
Logged
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Leviathan design by Bloc | XHTML | CSS