User
Welcome, Guest. Please login or register.
September 09, 2010, 04:58:25 AM

Login with username, password and session length

Search
News
Mogware announces the Advanced Version.
Latest Downloads
Links
« previous next »
Pages: [1] Print
Author Topic: Collada.net questions  (Read 533 times)
Miedon
Mouse
*

Karma: +0/-0
Posts: 4


« on: February 08, 2010, 02:47:16 AM »

Hello.
I hope this is the right place to post but I couldn't find a Collada.net forum or something. I try to work with your library for a couple of days now but I can't find the right place to start. Could you please give me any information on how I get started programming with your library? Any simple starting examples or something?

Thank you in advance!
Logged
JohnRen
Mogware Developer
Rabbit
*****

Karma: +3/-0
Posts: 1046


« Reply #1 on: February 08, 2010, 02:02:54 PM »

We've created a new board for tracking Collada.Net and move your post here.

I'll grab some code examples and paste them into a few posts for you to try...
Logged
Miedon
Mouse
*

Karma: +0/-0
Posts: 4


« Reply #2 on: February 08, 2010, 03:03:15 PM »

Thank you! I realy didn't know how to proceed any further.
Logged
JohnRen
Mogware Developer
Rabbit
*****

Karma: +3/-0
Posts: 1046


« Reply #3 on: February 09, 2010, 05:15:16 PM »

This example shows how to load a ColladaDocument from a file on disk:
Code:
ColladaDocument collada = new ColladaDocument(Filename);
Once the ColladaDocument is loaded into RAM, you simply access the member functions and properties from the ColladaDocument.  How you interact with the class depends greatly on what you want to do with the data.  When you are finished manipulating the data, simply save the file back out to disk.

Here are some simple code samples that might help you see how you traverse through the collada file.

This example shows code that traverses through a loaded ColladaDocument checking for quads:
Code:
protected bool ContainsQuads(ColladaDocument document)
{
foreach (Geometry geometry in document.Geometries)
{
foreach (Mesh mesh in geometry.Meshes)
{
foreach (Primitive primitive in mesh.Primitives)
{
if (primitive is Polygons ||
primitive is Polylist)
{
foreach (Polygon polygon in primitive.Polygons)
{
if (polygon.Vertices.Count > 3)
{
return true;
}
}
}
}
}
}

return false;
}

This example shows code that counts the number of skeletons in a loaded ColladaDocument:
Code:
protected int GetSkeletonCount(ColladaDocument document)
{
int skeletonCount = 0;

if (document.VisualScenes.Count > 0)
{
foreach (Node node in document.VisualScenes[0].Nodes[0].Nodes)
{
if (node.IsSkeleton)
{
skeletonCount++;
}
}
}

return skeletonCount;
}

« Last Edit: February 11, 2010, 12:54:31 PM by JohnRen » Logged
Miedon
Mouse
*

Karma: +0/-0
Posts: 4


« Reply #4 on: February 10, 2010, 02:57:23 PM »

I tried the source you provided but there is already a problem with the first line. The colladadocument class has no funktion called fromfile? Am I missing something?
Logged
JohnRen
Mogware Developer
Rabbit
*****

Karma: +3/-0
Posts: 1046


« Reply #5 on: February 11, 2010, 12:56:20 PM »

Oops, sorry, my bad...I'm working with a slightly newer version of the source...

The old way of loading a ColladaDocument used the class's constructor:
Code:
ColladaDocument collada = new ColladaDocument(Filename);
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by SMF 1.1.9 | SMF © 2006-2007, Simple Machines LLC Epsilon design by Bloc