Crystal Space
Welcome, Guest. Please login or register.
October 21, 2014, 10:07:44 am

Login with username, password and session length
Search:     Advanced search
9010 Posts in 2044 Topics by 8773 Members
Latest Member: Betuls
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Dynamic MeshFactory Creation and Static Class Created Meshes
« previous next »
Pages: [1] Print
Author Topic: Dynamic MeshFactory Creation and Static Class Created Meshes  (Read 2015 times)
Valcar
Newbie
*
Posts: 2

5930539
View Profile
« on: April 07, 2005, 04:25:09 pm »

First of all this is my first post.  I would like to say so far the CS Community seems very helpful.  I've spent the last day or so working with the CS engine and I'm trying to create a simple project for myself to get things going.

I've realized the ease of use by dynamically loading from my library a mesh factory.  But this has lead me to three problems.
1) Can I use dynamically created mesh factories (loaded from the library file) to create meshes in static/compiled code?  For example, I have a need to build ball meshes, in my program.  Instead of creating a hard coded ball factory, can I add:
Code:
   <meshfact name="ball_factory">
        <plugin>crystalspace.mesh.loader.factory.ball</plugin>
        <params/>
    </meshfact>

to a library file, load it in, and some how create my mesh using "ball_factory"?  like:
Code:
 csRef<iMeshWrapper> BBall = engine->CreateMeshWrapper ("ball_factory", "bouncy_ball", room, csVector3 (sx, sy, sz));


2) Can I create multiple library files by different names and load them all as needed?  I had difficulties doing this and I had to resort to using library and library.bak

3) Are the .bak files required or is the extentionless XML file enough?

Thanks in advance for all the clarification.  Believe me I wouldn't of asked it if I was able to locate it in the manuals/tutorials/articles.
Logged
Valcar
Newbie
*
Posts: 2

5930539
View Profile
« Reply #1 on: April 07, 2005, 05:46:55 pm »

Quote from: Valcar

1) Can I use dynamically created mesh factories (loaded from the library file) to create meshes in static/compiled code?  


I found a solution for this one.

iEngine has a function that returns a list of mesh factories (type iMeshFactoryList).  With this list you can invoke a "FindByName()" function call with the name "ball_factory".

This makes it easier (especially for a simple project), because you can later use a single factory for all meshes of that particular type, with little/to no coding overhead for adding in a new or changing a mesh type.

I'm still looking for answers to 2 and 3.  2 seems to be allowed, but for some reason during my attempts it couldn't find the library file by another name.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.155 seconds with 15 queries.