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.

Newcomers DBPro Corner / dwords, how are they written? and how do you get diffuse in dword?

Author
Message
PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 26th Oct 2008 21:49
i looked trough the forums, but i still do not completley understand how DWORD works.

in the helpfile they are defined as things like "diffuse = 0x040 specular =0x080 but that does not do much, it either messes up the mesh or something, but it doesn't do what the definition said its supposed to

but other people just do simle 3digit numbers

CONVERT OBJECT FVF 32,338

i assume you need to convert to fvf and lock it before using any vertex commands

i looked up that 338 is a diffuse value, but it just makes my shape very dark

so how does this work?

dont hate people who rip you off,cheat and get away with it, learn from them
Jeff032
17
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 26th Oct 2008 22:21 Edited at: 26th Oct 2008 22:25
Slightly confused by what you mean here...

DWORD is just an unsigned int, with a max of 4294967295

0x######## means that the number is in hexadecimal.


FVF describes what kind of data a vertex contains. To get the FVF value, you 'bitwise inclusive or' different flags together.
The value of the diffuse flag is 0x40, and the value of the specular flag is 0x80.
FVF 338 means that the vertices contain texture, diffuse, normal, and position data.

D3DFVF_TEX1 = 0x0100
D3DFVF_DIFFUSE = 0x0040
D3DFVF_NORMAL = 0x0010
D3DFVF_XYZ = 0x0002

0x0100 | 0x0040 | 0x0010 | 0x0002 = 0x0152 = 338


I do not believe you need to use CONVERT FVF before using any vertex commands, as long as you know what FVF the model is using, and can work with that.


And when specifying a color as a DWORD, it should work like this
0xAARRGGBB
so
0xFFFF0000 is red
0xFF00FF00 is green
0xFF0000FF is blue
0xFF000000 is black
0xFFFFFFFF is white

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Oct 2008 22:28
The vertexdata commands work safely - for example, if you have an object without diffuse and attempt to fetch the diffuse value from a vertex, it will return a value of 0. It will not crash out.

When you use the RGB() function to build a colour, it will already be in the correct format to use as a diffuse setting on a vertex.

The 'AA' bit of the colour that Jeff showed is the alpha value (ie transparency level) - FF is completely solid colour and 00 is completely transparent. It doesn't have any effect though unless you set the object transparency on.

PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 27th Oct 2008 05:04
Quote: "I do not believe you need to use CONVERT FVF before using any vertex commands, as long as you know what FVF the model is using, and can work with that."


for 2 days now i was trying to get a diffuse vertex effect on a model. I looked through forums and found a guy having a similar problem

just like me he couldn't get the diffuse vertex effect, another person added the "convert to fvf obj, fvfvalue and his code started to work.

after i added that code to mine, i finally started to get some kind of effect even if its not what i want, it was better than nothing.

before no matter what i did with vertex commands i got no result.

dont hate people who rip you off,cheat and get away with it, learn from them
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Oct 2008 15:40
Quote: "for 2 days now i was trying to get a diffuse vertex effect on a model. I looked through forums and found a guy having a similar problem

just like me he couldn't get the diffuse vertex effect, another person added the "convert to fvf obj, fvfvalue and his code started to work."


Yes, you need to ensure that the object has the vertex component that you are trying to change. In your case I guess the object needed to be given a diffuse component before you could successfully set it. Hence your need for CONVERT OBJECT FVF. If it already has the components you need then you don't need CONVERT OBJECT FVF. I think DBPro primitives like spheres don't have a diffuse component whereas things like Advanced Terrain do. You can find out which FVF your object has by using the mesh and memblock commands, i.e. something like:

make mesh from object
make memblock from mesh
print memblock dword

You'll need to check the details.

Quote: "after i added that code to mine, i finally started to get some kind of effect even if its not what i want, it was better than nothing.

before no matter what i did with vertex commands i got no result"


Check my post on your other thread.

Login to post a reply

Server time is: 2024-09-27 22:33:19
Your offset time is: 2024-09-27 22:33:19