Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBC/P] Cube Primitive - How To Colour/Texture All 6 Sides

Author
Message
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th Apr 2007 20:40 Edited at: 21st Apr 2007 01:42
For DB Classic And DB Pro

When you create a cube with DB, you can texture or colour it as a whole, but not all of the sides individually.

This function creates a cube, but gives it 6 limbs (the DB primitive only has limb 0 by default).

Each of these 6 limbs can then be independently coloured or textured as shown in the demo program below.

The Function:



Call it with:

MakeLimbCube(1,2.0)

Note that the first parameter has to be an integer and the second a float!

The Demo:



Note: Written and tested only in DB Classic. Please report any glitches found running in DBPro (though there shouldn't be any).

TDK_Man

Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 20th Apr 2007 22:43
What a great idea! Nice one TDK!

Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 21st Apr 2007 06:07
@TDK

I ran it in DBPRO. It works, but it seems to be in negative prespective.

I think you know from my preious posts that I do not have any experiance with DBC.

Maybe changeing the limb rotations will clear this up?

Thank you for the code.


Whatever...
Code Dragon
18
Years of Service
User Offline
Joined: 21st Aug 2006
Location: Everywhere
Posted: 22nd Apr 2007 14:18
I've been wondering how to do that, thanks!

By reading this sentence you have given me brief control of your mind.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 22nd Apr 2007 15:56
NP!

I thought I'd add a bit to clear up some confusion that has arisen with the object that is created with the function...

If you use:

MakeLimbCube(10,4.0)

You end up with a DB cube primitive exactly the the same as using:

Make Object Cube 10,4.0

The object is used/controlled with the normal DB object commands in exactly the same way as if you had used the Make Object command - Rotate Object for example.

The only difference is that you can now colour/texture the six sides using the Color Limb or Texture Limb commands.

As for DBPro, I don't have it installed ATM, so if anyone would like to try what Dabbler suggests and report back, it would be appreciated.

TDK_Man

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 23rd Apr 2007 00:59
The DBPro version of the function:



Culling is different in Pro so it just needed the line:

Set Object Cull ObjNum,0

TDK_Man

Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 23rd Apr 2007 03:53 Edited at: 23rd Apr 2007 03:55
@TDK

Yes, it works just fine. My idea of changeing the limb rotation did now work out. The prespective was ok, but the cube was lit on the opposite sides of a primitive cube(see picture, primitive on right).

Thanks again.


Whatever...

Attachments

Login to view attachments
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Apr 2007 11:47
cool. I made a function like that once for someone a long time ago. I think it was for DBC as well.


Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Apr 2007 00:51
I was just looking for an old snippet and came across the function I was talking about in my post above.

http://forum.thegamecreators.com/?m=forum_view&t=32939&b=6


TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Apr 2007 03:51
If I'd known it was there, I wouldn't have bothered posting mine!

TDK_Man

Pricey
21
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 9th Jun 2007 18:42
the only problem is that you can't use

SET OBJECT SMOOTHING

in DBPro to improve its appearence...

dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 10th Jun 2007 17:22 Edited at: 10th Jun 2007 17:23
Quote: "the only problem is that you can't use

SET OBJECT SMOOTHING

in DBPro to improve its appearence..."


Because each 'limb' cannot share vertexes so you can't get shading between them, or at least not easily, or not with DBP. Also why would you want smoothing between them? most people use skyboxes because you can just place 6 pre-rendered images to them, shading would only detract from the appearance.

Azrael
19
Years of Service
User Offline
Joined: 2nd Mar 2005
Location: Germany
Posted: 10th Jun 2007 21:46
Quote: "Because each 'limb' cannot share vertexes so you can't get shading between them, or at least not easily, or not with DBP"


As I know 'set object smoothing' just recalculates the vertices normals. So it's possible to write an own smoothing function - also if they belong to different limbs.

But smoothing on a skybox would certainly be horrible.

Pricey
21
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 12th Jun 2007 13:21
i meant for applications other than skycubes
but yeah it would be horrible to smooth a skycube

however, this command is very very slow compared to the DBPro primitve command, so it wouldn't be useful anywhere were lots of them need to be generated

Login to post a reply

Server time is: 2024-11-22 19:11:10
Your offset time is: 2024-11-22 19:11:10