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 / Code to return any DBO mesh diffuse color (RGBA)

Author
Message
Bored of the Rings
User Banned
Posted: 30th Oct 2021 05:52 Edited at: 30th Oct 2021 06:35
Here is example code (cut down from my DBOFastReader app), which returns the RGBA color of any specified mesh from a selected DBO. I've attached example DBOs with different diffuse colors Red, Green, Blue, Grey.
It could be stripped further, but will leave as is for now. I will (at some point) make a dll which will do the same thing but with a loaded DBO. There may be a way of doing it in DBPro using IanM matrix which I have some ideas, will see. Currently, DBPro only has vertexdata command to return color of vertices. This code returns the RGBA diffuse color from a material when no texture is applied.

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Bored of the Rings
User Banned
Posted: 30th Oct 2021 07:22
update to come soon to handle multimeshes correctly. I am putting back code that handles that which I incorrectly removed. So the code at the moment will only return correctly if the DBO contains a single mesh with a color.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
User Banned
Posted: 30th Oct 2021 08:49 Edited at: 30th Oct 2021 08:50
ok, multimesh diffuse colors now display per mesh correctly. What I did to test was change the material diffuse color per LOD mesh to Red, Green and Blue (don't ask me how yet) , and then loaded the object back in and the app output the correct diffuse color (DWORD and BYTE values).





will upload code shortly. doing some last moment checks.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
User Banned
Posted: 30th Oct 2021 09:01 Edited at: 30th Oct 2021 09:03
updated code using both single and multi mesh/ material detection. To come will be returning the info when the dbo is loaded. Feel free to do what you want with it. Change function names, reduce code, make it better , whatever suits you/your project if it helps

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
User Banned
Posted: 31st Oct 2021 05:06
updated code again, now can set each mesh color. Uses "Make Object From Pointer" command from IanM Matrix1Utils plugin. Thanks IanM for a great plugin.
Code has been reduced as much as I want to for now. Not sure why DBPro has a "Set Object Diffuse" command but no "Get Object Diffuse" unless undocumented or I'm missing something.
Actually, I will try the Set Object Diffuse command to see if it does anything, I've seen forum posts that state it doesn't work, but will try it myself and see what happens.

[update-set diffuse ok if you want all meshes to be same color-can't set individual meshes to separate colours]



Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
User Banned
Posted: 2nd Nov 2021 06:59 Edited at: 2nd Nov 2021 07:00
small fixes:



if I get time, I will add back in the code that handles GG Classic/MAX type DBO FVF where FVF is usually 0 but the FVF Size could be 2130, XYZ, Normals XYZ, Diffuse and 8 texture coord sets.

even works for FPSC levels:

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Lidot
2
Years of Service
User Offline
Joined: 15th Nov 2021
Location:
Posted: 15th Nov 2021 13:30
Seems cool!
Great

Login to post a reply

Server time is: 2024-04-26 11:00:08
Your offset time is: 2024-04-26 11:00:08