The Joys of 3D Programming

Richard

Here’s the sourse…

[img:180oz689]http://www.eko.clara.net/ExportASC_Sourse.zip[/img:180oz689]
<!– m –><a class="postlink" href="http://www.eko.clara.net/ExportASC_Sourse.zip">http://www.eko.clara.net/ExportASC_Sourse.zip</a>&lt;!– m –>

For 3DC or any one who wants to modify

May need some ‘ comments deleting and tidying up but works well for BoB (Battle of Britain) and Mig Alley 3D Modelling of Aircraft

You may notice the scale is specific for the above for simplicity…x100 <!– s;) –><img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink" /><!– s;) –>

Also XYZ coordinates are specific for the above for the correct position of the Aircraft andnbsp;in game <!– s;) –><img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink" /><!– s;) –>

Can change or modify <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

I am working on skeletal animation for 5.0.8, and I thought this bug was amusing:

There are two possibilities for this export:

1) A plug-in, which is a compiled ActiveX DLL.

andnbsp; This can be run by anyone who has LP or Pro

2) A script which is non-compiled

andnbsp; This can be run by anyone who has Pro (but not LP users)

The easiest and most powerful situation is to use #1 with Visual Basic. I don’t think the learning edition will work though since I don’t believe that it is capable of creating an ActiveX DLL (I’m not sure) . It would be easy to tell. The source for many of the plug-ins are in the plug-insamples folder. Just try opening one of the projects and compiling it. If you can then you can make changes to it and make it do whatever you want it to do.

Richard

Richard

That’s good to know <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

I’m now looking forward to upgrading to Visual Basic 6 Pro, which is good because I like the Language…I’m glad I found the VB5 learning Edition, with a Teach Yourself Book included, at the Computer Fair @ #20 BP and the last one !, very lucky <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –> andnbsp;

I tried to open the *.VBP (Visual Basic Program) in VB 5 Learning Edition and it said andnbsp;andquot;Retained is a invalid keyandquot; ?…not sure what this means, but I read that the learner edition does not support ActiveX Data objects (ADO)

…Thank you for 3DC and the excellent support <!– s;) –><img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink" /><!– s;) –>

<!– s:D –><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" /><!– s:D –> Its the kind of Bug you want in Programming <!– s:D –><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" /><!– s:D –>

Also about my post on programming (Exporting asc…)

I’m new to programming and would like to know which would be best to use for the plug in scripts, I know you said to use any language I’m proficent at, but I’m not at any

I do have :

C++Standard and
Visual Basic5, learning edition, which I recently bought at a computer fair and I’m enjoying the language so far <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

But I’ve just noticed the 3D Plugins are in VBScript, this is a cut down version of Visual Basic I think and supposed to be the easiest to learn…

Which would be best to concentrate my efforts on for 3D programming for now and the future ?

You’re welcome.

Try to pick up a used version 6, since the next version (.NET) will be available soon.

Richard

I’ve got Visual Basic 6 Professional Edition andnbsp;;D

And the I have managed to open one of the projects…X EXPORT

Now for the learning curve, I’m not sure how long this will take me…but its going to be good fun andnbsp;;)

I hope it is just a question of reading the Object and X, Y, Z
coordinates, provided by 3DC and writing or Exporting to a
ASC 3D Format…

eg…Spitfire.asc Format

1 object of many in a Spitfire model called andquot;NOSEandquot;

Named object: andquot;Nose_Aandquot;
Tri-mesh, Vertices: 22 Faces:18
Hidden
Mapped
Vertix list:
Vertex 0: X:-32.000061 andnbsp;Y:412.003632 Z:13.498594………..

Face list:
Face 0: A:10 B:4 C:AB:1 BC:1 CA:1
Material:andquot;NOSEandquot;
Smoothing: 1…………plus for many more Objects !

It seems straight forward, would I be right to say that this will be simpler Format to write Export for (When I’m proficient <!– s;) –><img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink" /><!– s;) –>)than the X Export Sample in the plugins ?

Any advice on Books or Visual Basic sites ?

Yes. I think ASC is relatively simple (or at least it can be). One thing that I don’t see in this is the texture coordinates. They should be there somewhere.

One thing to remember is that it looks like users will andnbsp;have to use the andquot;Noramlize Framesandquot; plug-in before exporting to ASC.

I don’t really have any suggestions for programming with Visual Basic. I learned it from the manual.

Have fun!

Richard

Thanks Richard andnbsp;:)

You will want to use the FormatExport method instead of the FormatScientific method.

Richard

Hello Richard

A final question…

The Direct Export writes the Coordinates in Scientific, but the asc requires a normal Format…do I write this in VB to convert or do I change the following: FormatScientific:

FileObject.WritLine Indent andamp; m3DC. FormatScientific(X) and…(Y)(Z)

Is the object in 3DC Scientific Format and I need to change this in formula or conversion ?

1.Box.X … FORMAT: (x,y,z) andnbsp; andnbsp; andnbsp; andnbsp;
Mesh mx3dc_1 {
andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;8;
andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;-5.00E-01; -5.00E-01; -5.00E-01;,
andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;-5.00E-01; 5.00E-01; -5.00E-01;,
andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;5.00E-01; 5.00E-01; -5.00E-01;,
andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;5.00E-01; -5.00E-01; -5.00E-01;,
andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;-5.00E-01; -5.00E-01; 5.00E-01;,
andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;5.00E-01; -5.00E-01; 5.00E-01;,
andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;5.00E-01; 5.00E-01; 5.00E-01;,
andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;-5.00E-01; 5.00E-01; 5.00E-01;;

2.Box.asc … FORMAT: (x, y, z)
Named object: andquot;mx3dc_1andquot;
Tri-mesh, Vertices: 8 andnbsp; andnbsp; Faces: 12
Vertex list:
Vertex 0: andnbsp;X:4.65173 andnbsp; andnbsp; andnbsp;Y:0.0 andnbsp; andnbsp; andnbsp;Z:3.37239
Vertex 1: andnbsp;X:4.65173 andnbsp; andnbsp; andnbsp;Y:1.0 andnbsp; andnbsp; andnbsp;Z:3.37239
Vertex 2: andnbsp;X:5.65173 andnbsp; andnbsp; andnbsp;Y:1.0 andnbsp; andnbsp; andnbsp;Z:3.37239
Vertex 3: andnbsp;X:5.65173 andnbsp; andnbsp; andnbsp;Y:0.0 andnbsp; andnbsp; andnbsp;Z:3.37239
Vertex 4: andnbsp;X:4.65173 andnbsp; andnbsp; andnbsp;Y:0.0 andnbsp; andnbsp; andnbsp;Z:4.37239
Vertex 5: andnbsp;X:5.65173 andnbsp; andnbsp; andnbsp;Y:0.0 andnbsp; andnbsp; andnbsp;Z:4.37239
Vertex 6: andnbsp;X:5.65173 andnbsp; andnbsp; andnbsp;Y:1.0 andnbsp; andnbsp; andnbsp;Z:4.37239
Vertex 7: andnbsp;X:4.65173 andnbsp; andnbsp; andnbsp;Y:1.0 andnbsp; andnbsp; andnbsp;Z:4.37239

<!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –> It worked Richard…what fun <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

… lots more to do yet <!– s;) –><img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink" /><!– s;) –>

But it worked he he he andnbsp;;D

Sorry Richard, I would not have asked, but I had got Permission denied in VB…

I can write the Materials and
the X,Y,Z coordinates, but I
Need to write Object Names…
for asc format (Object.GetName)

I wrote this (you may laugh <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>):

Sub WriteObjectFileName(FileObject As Object, Object As 3DCObject, Level)

andnbsp; andnbsp;Dim ObjectFileName As String

andnbsp; andnbsp; ‘Output Object Name
andnbsp; andnbsp; ObjectFileName = Object.GetName
andnbsp; andnbsp;If ObjectFileName [] andquot;andquot; Then
andnbsp; andnbsp; andnbsp; FileObject.WriteLine Space(4) andamp; andquot;ObjectFileName :andquot;
andnbsp; andnbsp; andnbsp; FileObject.WriteLine Space(8) andamp; Chr(34) andamp; andnbsp; andnbsp; andnbsp; ObjectFileName andamp; Chr(34)

andnbsp; andnbsp;End If andnbsp;

The help says:
andquot; One or more attributes that specify what kind of access a user has to data or objects in a database. For example, a table or query with Read Only permission permits a user to retrieve but not edit data in the table or query.andquot;

Simply can I use Object.GetName to write the name of Objects

If yes…its just a case that I still need to learn more <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

Also the PLUGIN: SCENE DETAILS can write Object names:

‘indicate the object
AddLine (andquot;Object: andquot; andamp; Object.GetName)

…should I use this instead ?

It could be that your variable name is andquot;Objectandquot; which is likely a reserved word.

Richard

Richard andnbsp;;D

The word Object being reserved, does this mean I can not copy the Object Name from 3DC to Export ?

It seems Ok in the Scene Details Plugin :

‘Indicate the Object
AddLine (andquot;Object: andquot; andamp; Object.GetName)

Could I use the Scene Details Sample instead or should I stick with the DirectExport Sample or…

The Difference only seems to be the andquot;AddLineandquot; in SceneDetails and andquot;FileObject.WriteLineandquot; in ExportDirectX ?

Please, could you give me an example…

I’m sure I can then work it out and I’m so close to cracking the rest of the code

while I’m here what is the U and V stand for in :
Vertex X, Y, Z, U and V ?

…Sorry for being a pain, but I didn’t want to just give up yet, also you could have the asc (3D Studio) Plugin if I ever complete it andnbsp;:)

You must be logged in to reply in this thread.

93 posts