Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / Rendering multiple objects in world trasnformation Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
RPSmith

March 04, 2005, 10:50 AM

I have searched and searched and can not find anything on rendering multiple objects. I have gone from the tutorial of projecting a triangle and spinning it. But what I want to do is have multiple triangles(basic object right now) spinning at different rates and being able to move each object individually. What do I need to do.

 
Rui Martins

March 04, 2005, 11:29 AM

Go study and research some more, because your lack of knowledge to accomplish this can't be answered in a single thread forum!

You need at least the following:
- Control Timming issues (rotation speed)
You can avoid this issue, by assuming all CPUs run at the same speed, and just change the delta angle for each step, implicitly changing the speeds of rotation.

- Resource management (manage several objects in the world).
You can start with a simple Fixed Size Array or a List.

- Mouse picking & Dragging(For selecting and moving objects)
You can use a simpler keyboard interface where you cycle between existing objects though (use TAB for example), and the make the context relative tothat object.

- You possibly need to improve your knowledge on the specific language you are using if the simple/obvious/common sense solutions I mentioned didn't hit you right away.

Hope this guides you on your quest, you have a log way to go 8)
Good luck.

 
theAntiELVIS

March 05, 2005, 01:34 AM

Each object has its own rotation, translation, and scaling - all are optional, you can have all three, one or two, or none.

You don't say you are using DirectX or OpenGL - but the basics are the same for both APIs. The "world transformation" is nothing more than these operations, set for each object. Let's say you want to rotate and position each object. Each object has three rotation angles, we'll call them XROT, YROT, and ZROT, expressed in radians. And each object has a three position coordinates we'll call XPOS, YPOS, and ZPOS.

What you need to do is get these values into matrices. Look at your spinning triangle demo. Somewhere in there you will see the rotation values being placed into a matrix via some function call. Position can also be placed in a matrix. You multiply the rotation matrix by the position matrix, and store the result in the "world transformation" matrix. All the world transformation matrix is, is a "concatenated" matrix - the rotation, position, and possibly the scaling matrix for the object multiplied together.

So - each object has IT'S OWN world transformation matrix. Just set this matrix to the world transform before you draw the object.

I suggest you get a good basic book on 3D programming and study it and work through the examples - that's the way to learn this stuff. A book will help you build your knowledge step-by-step much better than online tutorials will. Once you have some basic knowledge, then use the online tutorials.

Many people put-down the PrimaTech books, but for beginners they can be a good introduction. If you are using DirectX look at "The Zen of Direct3D Programming" and "Special Effects Programming with Direct3D".

You MUST understand these concepts to get anywhere with 3D programming:

= Rotation Angles
= 3D coordinate space
= matrix use, and the underlying theory of how matrices work
= vector math

Good luck!

-tAE-

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.