Author Topic: Working without loading Model  (Read 2150 times)

mazataza

  • Jr. Member
  • **
  • Posts: 2
Working without loading Model
« on: April 23, 2012, 11:25:30 AM »
I am planning to use this engine to build an android apps for CAD modelling.
all tutorials are based on loading models from files, but my case is to let the user to build his model from scratch.
sure i want to begin with basics CAD modelling.
Is there any example on how to create (for example) a Triangle model from scratch without loading a model using this engine?

jerome_j

  • Administrator
  • *****
  • Posts: 116
    • Bonzai Engine
Re: Working without loading Model
« Reply #1 on: April 23, 2012, 11:48:21 AM »
You can use Batch class to generate on the fly dynamic mesh/geometry.
Here's a basic example for drawing a line:


and another for drawing a box:


You can also fill normal an texture coordinates to use lighting and texture mapping.

Alternatly, you can use Model to create dynamic geometry but it would be a little more complex. Basically, create a Model object, add a Mesh which would be initialized with one GeometryData. In this GeometryData, you dynamicaly set each vertex data (position, texture coordinates, normals, ..) and the face indices.
This second is may less memory efficient if you're geometry would be re-generated each frame.

EDIT: Here's an example to generate a static model 'by hand'
« Last Edit: April 23, 2012, 11:56:32 AM by jerome_j »

mazataza

  • Jr. Member
  • **
  • Posts: 2
Re: Working without loading Model
« Reply #2 on: April 23, 2012, 12:20:08 PM »
thanks for ur quick answer.
The Batch example look promising. I will try both to see what will fit in my design later.