Welcome to Dream.In.Code
Become an Expert!

Join 137,226 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,046 people online right now. Registration is fast and FREE... Join Now!




X-File problem

 
Reply to this topicStart new topic

X-File problem, debugging.

ekhmuel
10 Oct, 2008 - 02:27 AM
Post #1

New D.I.C Head
*

Joined: 10 Oct, 2008
Posts: 4

Relevant files are here: (Or on attachment area)

http://www.geocities.com/paul_j_hurley@bti...t.com/laser-1.x
http://www.geocities.com/paul_j_hurley@bti...ertexture-1.bmp

Notes:

There is no meshnormal info. When downloaded x-files have their meshnormals removed, they work fine.

no error messages appear, it just doesn't show on the screen.

can someone view and critisise?

Thanks for your time.

Paul

only one of the files was attached - the other one is on here. (In blue)
CODE

xof 0302txt 0064
template Header {
<3D82AB43-62DA-11cf-AB39-0020AF71E433>
WORD major;
WORD minor;
DWORD flags;
}

template Vector {
<3D82AB5E-62DA-11cf-AB39-0020AF71E433>
FLOAT x;
FLOAT y;
FLOAT z;
}

template Coords2d {
<F6F23F44-7686-11cf-8F52-0040333594A3>
FLOAT u;
FLOAT v;
}

template Matrix4x4 {
<F6F23F45-7686-11cf-8F52-0040333594A3>
array FLOAT matrix[16];
}

template ColorRGBA {
<35FF44E0-6C7C-11cf-8F52-0040333594A3>
FLOAT red;
FLOAT green;
FLOAT blue;
FLOAT alpha;
}

template ColorRGB {
<D3E16E81-7835-11cf-8F52-0040333594A3>
FLOAT red;
FLOAT green;
FLOAT blue;
}

template TextureFilename {
<A42790E1-7810-11cf-8F52-0040333594A3>
STRING filename;
}

template Material {
<3D82AB4D-62DA-11cf-AB39-0020AF71E433>
ColorRGBA faceColor;
FLOAT power;
ColorRGB specularColor;
ColorRGB emissiveColor;
[...]
}

template MeshFace {
<3D82AB5F-62DA-11cf-AB39-0020AF71E433>
DWORD nFaceVertexIndices;
array DWORD faceVertexIndices[nFaceVertexIndices];
}

template MeshTextureCoords {
<F6F23F40-7686-11cf-8F52-0040333594A3>
DWORD nTextureCoords;
array Coords2d textureCoords[nTextureCoords];
}

template MeshMaterialList {
<F6F23F42-7686-11cf-8F52-0040333594A3>
DWORD nMaterials;
DWORD nFaceIndexes;
array DWORD faceIndexes[nFaceIndexes];
[Material]
}

template MeshNormals {
<F6F23F43-7686-11cf-8F52-0040333594A3>
DWORD nNormals;
array Vector normals[nNormals];
DWORD nFaceNormals;
array MeshFace faceNormals[nFaceNormals];
}

template Mesh {
<3D82AB44-62DA-11cf-AB39-0020AF71E433>
DWORD nVertices;
array Vector vertices[nVertices];
DWORD nFaces;
array MeshFace faces[nFaces];
[...]
}

template FrameTransformMatrix {
<F6F23F41-7686-11cf-8F52-0040333594A3>
Matrix4x4 frameMatrix;
}

template Frame {
<3D82AB46-62DA-11cf-AB39-0020AF71E433>
[...]
}
template FloatKeys {
<10DD46A9-775B-11cf-8F52-0040333594A3>
DWORD nValues;
array FLOAT values[nValues];
}

template TimedFloatKeys {
<F406B180-7B3B-11cf-8F52-0040333594A3>
DWORD time;
FloatKeys tfkeys;
}

template AnimationKey {
<10DD46A8-775B-11cf-8F52-0040333594A3>
DWORD keyType;
DWORD nKeys;
array TimedFloatKeys keys[nKeys];
}

template AnimationOptions {
<E2BF56C0-840F-11cf-8F52-0040333594A3>
DWORD openclosed;
DWORD positionquality;
}

template Animation {
<3D82AB4F-62DA-11cf-AB39-0020AF71E433>
[...]
}

template AnimationSet {
<3D82AB50-62DA-11cf-AB39-0020AF71E433>
[Animation]
}

Header {
1;
0;
1;
}

frame subfrm-laser {
FrameTransformMatrix {
1,0,0,0,
0,1,0,0,
0,0,1,0,
0,0,0,1;;
}
Mesh body {
76;
-0.030000;0.060000;-0.400000;,
0.030000;0.060000;-0.400000;,
0.060000;0.020000;-0.400000;,
0.060000;-0.020000;-0.400000;,
0.030000;-0.060000;-0.400000;,
-0.030000;-0.060000;-0.400000;,
-0.060000;-0.020000;-0.400000;,
-0.060000;0.020000;-0.400000;,
0.000000;0.000000;-0.410000;,
-0.030000;0.060000;0.400000;,
0.030000;0.060000;0.400000;,
0.060000;0.020000;0.400000;,
0.060000;-0.020000;0.400000;,
0.030000;-0.060000;0.400000;,
-0.030000;-0.060000;0.400000;,
-0.060000;-0.020000;0.400000;,
-0.060000;0.020000;0.400000;,
0.000000;0.000000;0.450000;,
-0.010000;0.020000;0.400000;,
0.010000;0.020000;0.400000;,
0.020000;0.010000;0.400000;,
0.020000;-0.010000;0.400000;,
0.010000;-0.020000;0.400000;,
-0.010000;-0.020000;0.400000;,
-0.020000;-0.010000;0.400000;,
-0.020000;0.010000;0.400000;,
-0.010000;0.020000;0.600100;,
0.010000;0.020000;0.600100;,
0.020000;0.010000;0.600100;,
0.020000;-0.010000;0.600100;,
0.010000;-0.020000;0.600100;,
-0.010000;-0.020000;0.600100;,
-0.020000;-0.010000;0.600100;,
-0.020000;0.010000;0.600100;,
-0.020000;0.040000;0.600100;,
0.020000;0.040000;0.600100;,
0.040000;0.020000;0.600100;,
0.040000;-0.020000;0.600100;,
0.020000;-0.040000;0.600100;,
-0.020000;-0.040000;0.600100;,
-0.040000;-0.020000;0.600100;,
-0.040000;0.020000;0.600100;,
0.000000;0.000000;0.600100;,
-0.010000;0.020000;0.630100;,
0.010000;0.020000;0.630100;,
0.020000;0.010000;0.630100;,
0.020000;-0.010000;0.630100;,
0.010000;-0.020000;0.630100;,
-0.010000;-0.020000;0.630100;,
-0.020000;-0.010000;0.630100;,
-0.020000;0.010000;0.630100;,
0.000000;0.000000;0.630100;,
0.000000;0.070000;-0.110000;,
0.010000;0.060000;-0.110000;,
-0.010000;0.060000;-0.110000;,
0.000000;0.070000;0.110000;,
0.010000;0.060000;0.110000;,
-0.010000;0.060000;0.110000;,
0.070000;0.000000;-0.110000;,
0.060000;-0.010000;-0.110000;,
0.060000;0.010000;-0.110000;,
0.070000;0.000000;0.110000;,
0.060000;-0.010000;0.110000;,
0.060000;0.010000;0.110000;,
0.000000;-0.070000;-0.110000;,
-0.010000;-0.060000;-0.110000;,
0.010000;-0.060000;-0.110000;,
0.000000;-0.070000;0.110000;,
-0.010000;-0.060000;0.011000;,
0.010000;-0.060000;0.110000;,
-0.070000;0.000000;-0.011000;,
-0.060000;0.010000;-0.011000;,
-0.060000;-0.010000;-0.011000;,
-0.070000;0.000000;0.011000;,
-0.060000;0.010000;0.011000;,
-0.060000;-0.010000;0.110000;;
104;
3;0,9,1;,
3;1,10,2;,
3;2,11,3;,
3;3,12,4;,
3;4,13,5;,
3;5,14,6;,
3;6,15,7;,
3;7,16,0;,
3;9,10,1;,
3;10,11,2;,
3;11,12,3;,
3;12,13,4;,
3;13,14,5;,
3;14,15,6;,
3;15,16,7;,
3;16,9,0;,
3;18,26,19;,
3;19,27,20;,
3;20,28,21;,
3;21,29,22;,
3;22,30,23;,
3;23,31,24;,
3;24,32,25;,
3;25,33,18;,
3;26,27,19;,
3;27,28,20;,
3;28,29,21;,
3;29,30,22;,
3;30,31,23;,
3;31,32,24;,
3;32,33,25;,
3;33,26,18;,
3;34,43,35;,
3;35,44,36;,
3;36,45,37;,
3;37,46,38;,
3;38,47,39;,
3;39,48,40;,
3;40,49,41;,
3;41,50,34;,
3;43,44,35;,
3;44,45,36;,
3;45,46,37;,
3;46,47,38;,
3;47,48,39;,
3;48,49,40;,
3;49,50,41;,
3;50,43,34;,
3;0,1,8;,
3;1,2,8;,
3;2,3,8;,
3;3,4,8;,
3;4,5,8;,
3;5,6,8;,
3;6,7,8;,
3;7,0,8;,
3;10,9,17;,
3;11,10,17;,
3;12,11,17;,
3;13,12,17;,
3;14,13,17;,
3;15,14,17;,
3;16,15,17;,
3;9,16,17;,
3;34,35,42;,
3;35,36,42;,
3;36,37,42;,
3;37,38,42;,
3;38,39,42;,
3;39,40,42;,
3;40,41,42;,
3;41,34,42;,
3;44,43,51;,
3;45,44,51;,
3;46,45,51;,
3;47,46,51;,
3;48,47,51;,
3;49,48,51;,
3;50,49,51;,
3;43,50,51;,
3;52,53,54;,
3;57,56,55;,
3;52,55,53;,
3;52,54,55;,
3;55,56,53;,
3;54,57,55;,
3;58,59,60;,
3;63,62,61;,
3;58,61,59;,
3;58,60,61;,
3;61,62,59;,
3;60,63,61;,
3;64,65,66;,
3;69,68,67;,
3;64,67,65;,
3;64,66,67;,
3;67,68,65;,
3;66,69,67;,
3;70,71,72;,
3;75,74,73;,
3;70,73,71;,
3;70,72,73;,
3;73,74,71;,
3;72,75,73;;
MeshMaterialList {
1;
104;
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0;
Material {
1.000000;1.000000;1.000000;1.000000;;
100.000000;
1.000000;1.000000;1.000000;;
0.0; 0.0; 0.0;;
TextureFilename {
"lasertexture-1.bmp";
}
}
}
MeshTextureCoords {
76;
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.227273;,
0.000000;0.454545;,
0.000000;0.681818;,
0.000000;0.681818;,
0.000000;0.454545;,
0.000000;0.227273;,
0.000000;0.000000;,
0.801932;0.000000;,
0.801932;0.000000;,
0.801932;0.227273;,
0.801932;0.454545;,
0.801932;0.681818;,
0.801932;0.681818;,
0.801932;0.454545;,
0.812500;0.340909;,
00;0.704546;,
00;1.000000;,
00;0.704546;,
00;1.000000;,
00;0.704546;,
00;1.000000;,
00;0.704546;,
00;1.000000;,
0.230768;0.704546;,
0.230768;1.000000;,
0.230768;0.704546;,
0.230768;1.000000;,
0.230768;0.704546;,
0.230768;1.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.000000;0.000000;,
0.740385;0.840909;,
0.746316;1.000000;,
0.746316;0.704546;,
0.951923;0.840909;,
1.000000;1.000000;,
1.000000;0.704546;,
0.740385;0.840909;,
0.746316;1.000000;,
0.746316;0.704546;,
0.951923;0.840909;,
1.000000;1.000000;,
1.000000;0.704546;,
0.740385;0.840909;,
0.746316;1.000000;,
0.746316;0.704546;,
0.951923;0.840909;,
1.000000;1.000000;,
1.000000;0.704546;,
0.740385;0.840909;,
0.746316;1.000000;,
0.746316;0.704546;,
0.951923;0.840909;,
1.000000;1.000000;,
1.000000;0.704546;;
}
}
}



Attached File(s)
Attached File  lasertexture_1.bmp ( 192.05k ) Number of downloads: 6
User is offlineProfile CardPM
+Quote Post

stayscrisp
RE: X-File Problem
10 Oct, 2008 - 03:43 AM
Post #2

D.I.C Regular
***

Joined: 14 Feb, 2008
Posts: 268



Thanked: 8 times
My Contributions

How did you export the .x file?

what did you use?
User is offlineProfile CardPM
+Quote Post

ekhmuel
RE: X-File Problem
10 Oct, 2008 - 03:49 AM
Post #3

New D.I.C Head
*

Joined: 10 Oct, 2008
Posts: 4

QUOTE(stayscrisp @ 10 Oct, 2008 - 04:43 AM) *

How did you export the .x file?

what did you use?


If you mean how did I create it, i used a programme of my own design (using a template called DARK BASIC), which created the file as a text document which was then re-opened with MS Notepad and saved as a ".x" This has always sufficed before. The difference this time is that I've never tried texturing - my models were always really 'flat' - or incredibly complicated to get the details with just coloured blocks.
User is offlineProfile CardPM
+Quote Post

stayscrisp
RE: X-File Problem
10 Oct, 2008 - 04:12 AM
Post #4

D.I.C Regular
***

Joined: 14 Feb, 2008
Posts: 268



Thanked: 8 times
My Contributions

Have you tried using a full filepath for your texture file?
User is offlineProfile CardPM
+Quote Post

ekhmuel
RE: X-File Problem
10 Oct, 2008 - 04:17 AM
Post #5

New D.I.C Head
*

Joined: 10 Oct, 2008
Posts: 4

This, if it helps, is the code I used to create the model script. As said - it worked before on another set of models.

I was just beginning it, the aim was to define a series of standardised subcomponents so that I could build spacecraft quickly by going:

* item number xxxxx at coordinates xxxx facing front.
* item number yyyyy at coordinates xxxx facing up.
* item number zzzzzz at coordinates xxxx facing front.

and so on.

I'd just created a single template (laser type I) to make sure it worked. (Each component was to be a subframe within the model.)

The first bit is the header, then a function stating the required parameters (4 sizes of laser and 10 tech levels allowed for instance - the Tech level affects barrel length- , the tm1_1# entries are the tranformation matrix data.) After this was the subprogramme dealing with each component. the aim was to simply make a list quickly of these functions and then by altering the function list, the ship could be printed off.

CODE

filename$="laser-1.dat"

if file exist(filename$)=1 then delete file filename$

Rem open the file and emplace the header
open to write 1,filename$

write string 1,"xof 0302txt 0064"
write string 1,"template Header {"
write string 1," <3D82AB43-62DA-11cf-AB39-0020AF71E433>"
write string 1," WORD major;"
write string 1," WORD minor;"
write string 1," DWORD flags;"
write string 1,"}"
write string 1,""
write string 1,"template Vector {"
write string 1," <3D82AB5E-62DA-11cf-AB39-0020AF71E433>"
write string 1," FLOAT x;"
write string 1," FLOAT y;"
write string 1," FLOAT z;"
write string 1,"}"
write string 1,""
write string 1,"template Coords2d {"
write string 1," <F6F23F44-7686-11cf-8F52-0040333594A3>"
write string 1," FLOAT u;"
write string 1," FLOAT v;"
write string 1,"}"
write string 1,""
write string 1,"template Matrix4x4 {"
write string 1," <F6F23F45-7686-11cf-8F52-0040333594A3>"
write string 1," array FLOAT matrix[16];"
write string 1,"}"
write string 1,""
write string 1,"template ColorRGBA {"
write string 1," <35FF44E0-6C7C-11cf-8F52-0040333594A3>"
write string 1," FLOAT red;"
write string 1," FLOAT green;"
write string 1," FLOAT blue;"
write string 1," FLOAT alpha;"
write string 1,"}"
write string 1,""
write string 1,"template ColorRGB {"
write string 1," <D3E16E81-7835-11cf-8F52-0040333594A3>"
write string 1," FLOAT red;"
write string 1," FLOAT green;"
write string 1," FLOAT blue;"
write string 1,"}"
write string 1,""
write string 1,"template TextureFilename {"
write string 1," <A42790E1-7810-11cf-8F52-0040333594A3>"
write string 1," STRING filename;"
write string 1,"}"
write string 1,""
write string 1,"template Material {"
write string 1," <3D82AB4D-62DA-11cf-AB39-0020AF71E433>"
write string 1," ColorRGBA faceColor;"
write string 1," FLOAT power;"
write string 1," ColorRGB specularColor;"
write string 1," ColorRGB emissiveColor;"
write string 1," [...]"
write string 1,"}"
write string 1,""
write string 1,"template MeshFace {"
write string 1," <3D82AB5F-62DA-11cf-AB39-0020AF71E433>"
write string 1," DWORD nFaceVertexIndices;"
write string 1," array DWORD faceVertexIndices[nFaceVertexIndices];"
write string 1,"}"
write string 1,""
write string 1,"template MeshTextureCoords {"
write string 1," <F6F23F40-7686-11cf-8F52-0040333594A3>"
write string 1," DWORD nTextureCoords;"
write string 1," array Coords2d textureCoords[nTextureCoords];"
write string 1,"}"
write string 1,""
write string 1,"template MeshMaterialList {"
write string 1," <F6F23F42-7686-11cf-8F52-0040333594A3>"
write string 1," DWORD nMaterials;"
write string 1," DWORD nFaceIndexes;"
write string 1," array DWORD faceIndexes[nFaceIndexes];"
write string 1," [Material]"
write string 1,"}"
write string 1,""
write string 1,"template MeshNormals {"
write string 1," <F6F23F43-7686-11cf-8F52-0040333594A3>"
write string 1," DWORD nNormals;"
write string 1," array Vector normals[nNormals];"
write string 1," DWORD nFaceNormals;"
write string 1," array MeshFace faceNormals[nFaceNormals];"
write string 1,"}"
write string 1,""
write string 1,"template Mesh {"
write string 1," <3D82AB44-62DA-11cf-AB39-0020AF71E433>"
write string 1," DWORD nVertices;"
write string 1," array Vector vertices[nVertices];"
write string 1," DWORD nFaces;"
write string 1," array MeshFace faces[nFaces];"
write string 1," [...]"
write string 1,"}"
write string 1,""
write string 1,"template FrameTransformMatrix {"
write string 1," <F6F23F41-7686-11cf-8F52-0040333594A3>"
write string 1," Matrix4x4 frameMatrix;"
write string 1,"}"
write string 1,""
write string 1,"template Frame {"
write string 1," <3D82AB46-62DA-11cf-AB39-0020AF71E433>"
write string 1," [...]"
write string 1,"}"
write string 1,"template FloatKeys {"
write string 1," <10DD46A9-775B-11cf-8F52-0040333594A3>"
write string 1," DWORD nValues;"
write string 1," array FLOAT values[nValues];"
write string 1,"}"
write string 1,""
write string 1,"template TimedFloatKeys {"
write string 1," <F406B180-7B3B-11cf-8F52-0040333594A3>"
write string 1," DWORD time;"
write string 1," FloatKeys tfkeys;"
write string 1,"}"
write string 1,""
write string 1,"template AnimationKey {"
write string 1," <10DD46A8-775B-11cf-8F52-0040333594A3>"
write string 1," DWORD keyType;"
write string 1," DWORD nKeys;"
write string 1," array TimedFloatKeys keys[nKeys];"
write string 1,"}"
write string 1,""
write string 1,"template AnimationOptions {"
write string 1," <E2BF56C0-840F-11cf-8F52-0040333594A3>"
write string 1," DWORD openclosed;"
write string 1," DWORD positionquality;"
write string 1,"}"
write string 1,""
write string 1,"template Animation {"
write string 1," <3D82AB4F-62DA-11cf-AB39-0020AF71E433>"
write string 1," [...]"
write string 1,"}"
write string 1,""
write string 1,"template AnimationSet {"
write string 1," <3D82AB50-62DA-11cf-AB39-0020AF71E433>"
write string 1," [Animation]"
write string 1,"}"
write string 1,""
write string 1,"Header {"
write string 1," 1;"
write string 1," 0;"
write string 1," 1;"
write string 1,"}"
write string 1,""

REM THE MODEL DATA:

Rem Subprogramme List:

Rem 0000001: Laser Gun

Rem Begin the frame:

param1=0
param2=1
param3=3
param4=0
param5=0
param6=0
param7=0
param8=0
param9$="laser"
param10$=""
tm1_1#=1
tm1_2#=0
tm1_3#=0
tm1_4#=0
tm2_1#=0
tm2_2#=1
tm2_3#=0
tm2_4#=0
tm3_1#=0
tm3_2#=0
tm3_3#=1
tm3_4#=0
tm4_1#=0
tm4_2#=0
tm4_3#=0
tm4_4#=1

0000001(param1,param2,param3,param4,param5,param6,param7,param8,param9$,param10& #036;,tm1_1#,tm1_2#,tm1_3#,tm1_4#,tm2_1#,tm2_2#,tm2_3#,tm2_4#,tm3_1#,tm3_2#,tm3_
3#,tm3_4#,tm4_1#,tm4_2#,tm4_3#,tm4_4#)

close file 1

end

REM SUBPROGRAMMES:

Rem 0000001: Laser Gun

Rem param1=1 if subcomponent
Rem param2=size
Rem param3=techlev
Rem param9$=item name


function 0000001(param1,param2,param3,param4,param5,param6,param7,param8,param9$,param10& #036;,tm1_1#,tm1_2#,tm1_3#,tm1_4#,tm2_1#,tm2_2#,tm2_3#,tm2_4#,tm3_1#,tm3_2#,tm3_
3#,tm3_4#,tm4_1#,tm4_2#,tm4_3#,tm4_4#)

write string 1,"frame subfrm-"+param9$+" {"

write string 1,"FrameTransformMatrix {"
write string 1,str$(tm1_1#)+","+str$(tm1_2#)+","+str$(tm1_3#)+","+str$(tm1_4#)+","
write string 1,str$(tm2_1#)+","+str$(tm2_2#)+","+str$(tm2_3#)+","+str$(tm2_4#)+","
write string 1,str$(tm3_1#)+","+str$(tm3_2#)+","+str$(tm3_3#)+","+str$(tm3_4#)+","
write string 1,str$(tm4_1#)+","+str$(tm4_2#)+","+str$(tm4_3#)+","+str$(tm4_4#)+";;"
write string 1," }"

Rem put in the corners

write string 1,"Mesh body {"
write string 1,"76;"

dim cornerarray#(76,3)
restore lasercornerdata

for i=1 to 3
    for j=1 to 76
        read a
        cornerarray#(j,i)=a
    next j
next i

lasercornerdata:
DATA -30,30,60,60,30,-30,-60,-60,0
DATA -30,30,60,60,30,-30,-60,-60,0
DATA -10,10,20,20,10,-10,-20,-20
DATA -10,10,20,20,10,-10,-20,-20
DATA -20,20,40,40,20,-20,-40,-40,0
DATA -10,10,20,20,10,-10,-20,-20,0
DATA 0,10,-10,00,10,-10
DATA 70,60,60,70,60,60
DATA 0,-10,10,00,-10,10
DATA -70,-60,-60,-70,-60,-60

DATA 60,60,20,-20,-60,-60,-20,20,0
DATA 60,60,20,-20,-60,-60,-20,20,0
DATA 20,20,10,-10,-20,-20,-10,10
DATA 20,20,10,-10,-20,-20,-10,10
DATA 40,40,20,-20,-40,-40,-20,20,0
DATA 20,20,10,-10,-20,-20,-10,10,0
DATA 70,60,60,70,60,60
DATA 0,-10,10,00,-10,10
DATA -70,-60,-60,-70,-60,-60
DATA 0,10,-10,00,10,-10

DATA -400,-400,-400,-400,-400,-400,-400,-400,-410
DATA 400,400,400,400,400,400,400,400,450
DATA 400,400,400,400,400,400,400,400
DATA 600,600,600,600,600,600,600,600
DATA 600,600,600,600,600,600,600,600,600
DATA 630,630,630,630,630,630,630,630,630
DATA -110,-110,-110,110,110,110
DATA -110,-110,-110,110,110,110
DATA -110,-110,-110,110,11,110
DATA -11,-11,-11,11,11,110

Rem temp rescale for viewing

for i=1 to 76
    for j=1 to 3
        cornerarray#(i,j)=cornerarray#(i,j)*1000
    next j
next i

Rem scale x and y to size factor

param2#=param2
scalefactor#=1.4^(param2#-1)

for i=1 to 76
    cornerarray#(i,1)=cornerarray#(i,1)*scalefactor#
    cornerarray#(i,2)=cornerarray#(i,2)*scalefactor#
next i

Rem scale the muzzle positions to the TL

tl#=param3
lengthening#=50*(tl#-1)

for i=27 to 52
    cornerarray#(i,3)=cornerarray#(i,3)+lengthening#
next i

Rem print it off

for i=1 to 76
    if cornerarray#(i,1)<0
        valueneg=1
    else
        valueneg=0
    endif
    value=abs(cornerarray#(i,1))
    value$=str$(value)
    if value<1
        1ststring$="0.000000"
    else
        if value<10
            1ststring$="0.00000"+value$
        else
            if value<100
                1ststring$="0.0000"+value$
            else
                if value<1000
                    1ststring$="0.000"+value$
                else
                    if value<10000
                        1ststring$="0.00"+value$
                    else
                        if value<100000
                            1ststring$="0.0"+value$
                        else
                            if value<1000000
                                1ststring$="0."+value$
                            else
                                1ststring$="1.000000"
                            endif
                        endif
                    endif
                endif
            endif
        endif
    endif
    if valueneg=1 then 1ststring$="-"+1ststring$

    if cornerarray#(i,2)<0
        valueneg=1
    else
        valueneg=0
    endif
    value=abs(cornerarray#(i,2))
    value$=str$(value)
    if value<1
        2ndstring$="0.000000"
    else
        if value<10
            2ndstring$="0.00000"+value$
        else
            if value<100
                2ndstring$="0.0000"+value$
            else
                if value<1000
                    2ndstring$="0.000"+value$
                else
                    if value<10000
                        2ndstring$="0.00"+value$
                    else
                        if value<100000
                            2ndstring$="0.0"+value$
                        else
                            if value<1000000
                                2ndstring$="0."+value$
                            else
                                2ndstring$="1.000000"
                            endif
                        endif
                    endif
                endif
            endif
        endif
    endif
    if valueneg=1 then 2ndstring$="-"+2ndstring$

    if cornerarray#(i,3)<0
        valueneg=1
    else
        valueneg=0
    endif
    value=abs(cornerarray#(i,3))
    value$=str$(value)
    if value<1
        3rdstring$="0.000000"
    else
        if value<10
            3rdstring$="0.00000"+value$
        else
            if value<100
                3rdstring$="0.0000"+value$
            else
                if value<1000
                    3rdstring$="0.000"+value$
                else
                    if value<10000
                        3rdstring$="0.00"+value$
                    else
                        if value<100000
                            3rdstring$="0.0"+value$
                        else
                            if value<1000000
                                3rdstring$="0."+value$
                            else
                                3rdstring$="1.000000"
                            endif
                        endif
                    endif
                endif
            endif
        endif
    endif
    if valueneg=1 then 3rdstring$="-"+3rdstring$

    if i=76
        string$=1ststring$+";"+2ndstring$+";"+3rdstring$+";;"
    else
        string$=1ststring$+";"+2ndstring$+";"+3rdstring$+";,"
    endif

    write string 1,string$
next i

undim cornerarray#(1,1)

Rem print off the sides:

write string 1,"104;"

Rem: Main body

write string 1,"3;0,9,1;,"
write string 1,"3;1,10,2;,"
write string 1,"3;2,11,3;,"
write string 1,"3;3,12,4;,"
write string 1,"3;4,13,5;,"
write string 1,"3;5,14,6;,"
write string 1,"3;6,15,7;,"
write string 1,"3;7,16,0;,"

write string 1,"3;9,10,1;,"
write string 1,"3;10,11,2;,"
write string 1,"3;11,12,3;,"
write string 1,"3;12,13,4;,"
write string 1,"3;13,14,5;,"
write string 1,"3;14,15,6;,"
write string 1,"3;15,16,7;,"
write string 1,"3;16,9,0;,"

Rem Barrel

write string 1,"3;18,26,19;,"
write string 1,"3;19,27,20;,"
write string 1,"3;20,28,21;,"
write string 1,"3;21,29,22;,"
write string 1,"3;22,30,23;,"
write string 1,"3;23,31,24;,"
write string 1,"3;24,32,25;,"
write string 1,"3;25,33,18;,"

write string 1,"3;26,27,19;,"
write string 1,"3;27,28,20;,"
write string 1,"3;28,29,21;,"
write string 1,"3;29,30,22;,"
write string 1,"3;30,31,23;,"
write string 1,"3;31,32,24;,"
write string 1,"3;32,33,25;,"
write string 1,"3;33,26,18;,"

Rem Muzzle

write string 1,"3;34,43,35;,"
write string 1,"3;35,44,36;,"
write string 1,"3;36,45,37;,"
write string 1,"3;37,46,38;,"
write string 1,"3;38,47,39;,"
write string 1,"3;39,48,40;,"
write string 1,"3;40,49,41;,"
write string 1,"3;41,50,34;,"

write string 1,"3;43,44,35;,"
write string 1,"3;44,45,36;,"
write string 1,"3;45,46,37;,"
write string 1,"3;46,47,38;,"
write string 1,"3;47,48,39;,"
write string 1,"3;48,49,40;,"
write string 1,"3;49,50,41;,"
write string 1,"3;50,43,34;,"

Rem Body, muzzlecaps

write string 1,"3;0,1,8;,"
write string 1,"3;1,2,8;,"
write string 1,"3;2,3,8;,"
write string 1,"3;3,4,8;,"
write string 1,"3;4,5,8;,"
write string 1,"3;5,6,8;,"
write string 1,"3;6,7,8;,"
write string 1,"3;7,0,8;,"

write string 1,"3;10,9,17;,"
write string 1,"3;11,10,17;,"
write string 1,"3;12,11,17;,"
write string 1,"3;13,12,17;,"
write string 1,"3;14,13,17;,"
write string 1,"3;15,14,17;,"
write string 1,"3;16,15,17;,"
write string 1,"3;9,16,17;,"

write string 1,"3;34,35,42;,"
write string 1,"3;35,36,42;,"
write string 1,"3;36,37,42;,"
write string 1,"3;37,38,42;,"
write string 1,"3;38,39,42;,"
write string 1,"3;39,40,42;,"
write string 1,"3;40,41,42;,"
write string 1,"3;41,34,42;,"

write string 1,"3;44,43,51;,"
write string 1,"3;45,44,51;,"
write string 1,"3;46,45,51;,"
write string 1,"3;47,46,51;,"
write string 1,"3;48,47,51;,"
write string 1,"3;49,48,51;,"
write string 1,"3;50,49,51;,"
write string 1,"3;43,50,51;,"

Rem (sidebars)

write string 1,"3;52,53,54;,"
write string 1,"3;57,56,55;,"
write string 1,"3;52,55,53;,"
write string 1,"3;52,54,55;,"
write string 1,"3;55,56,53;,"
write string 1,"3;54,57,55;,"

write string 1,"3;58,59,60;,"
write string 1,"3;63,62,61;,"
write string 1,"3;58,61,59;,"
write string 1,"3;58,60,61;,"
write string 1,"3;61,62,59;,"
write string 1,"3;60,63,61;,"

write string 1,"3;64,65,66;,"
write string 1,"3;69,68,67;,"
write string 1,"3;64,67,65;,"
write string 1,"3;64,66,67;,"
write string 1,"3;67,68,65;,"
write string 1,"3;66,69,67;,"

write string 1,"3;70,71,72;,"
write string 1,"3;75,74,73;,"
write string 1,"3;70,73,71;,"
write string 1,"3;70,72,73;,"
write string 1,"3;73,74,71;,"
write string 1,"3;72,75,73;;"

Rem now the mesh materials:

write string 1,"MeshMaterialList {"
write string 1,"1;"
write string 1,"104;"
for i=1 to 103
    write string 1,"0,"
next i
write string 1,"0;"

write string 1,"Material {"
write string 1,"1.000000;1.000000;1.000000;1.000000;;"
write string 1,"100.000000;"
write string 1,"1.000000;1.000000;1.000000;;"
write string 1,"0.0; 0.0; 0.0;;"
write string 1,"TextureFilename {"

if param2=1
    texturefile$="lasertexture-1.ppm"
endif
if param2=2
    texturefile$="lasertexture-2.ppm"
endif
if param2=3
    texturefile$="lasertexture-3.ppm"
endif
if param2=4
    texturefile$="lasertexture-4.ppm"
endif

string$="""
string$=string$+texturefile$
string$=string$+"""
string$=string$+";"

write string 1,string$
write string 1,"}"
write string 1,"}"
write string 1,"}"

write string 1,"MeshTextureCoords {"
write string 1,"76;"
write string 1,"0.000000;0.000000;,"
write string 1,"0.000000;0.000000;,"
write string 1,"0.000000;0.227273;,"
write string 1,"0.000000;0.454545;,"
write string 1,"0.000000;0.681818;,"
write string 1,"0.000000;0.681818;,"
write string 1,"0.000000;0.454545;,"
write string 1,"0.000000;0.227273;,"
write string 1,"0.000000;0.000000;,"
write string 1,"0.801932;0.000000;,"
write string 1,"0.801932;0.000000;,"
write string 1,"0.801932;0.227273;,"
write string 1,"0.801932;0.454545;,"
write string 1,"0.801932;0.681818;,"
write string 1,"0.801932;0.681818;,"
write string 1,"0.801932;0.454545;,"
write string 1,"0.812500;0.340909;,"

write string 1,"0.000000;0.704546;,"
write string 1,"0.000000;1.000000;,"
write string 1,"0.000000;0.704546;,"
write string 1,"0.000000;1.000000;,"
write string 1,"0.000000;0.704546;,"
write string 1,"0.000000;1.000000;,"
write string 1,"0.000000;0.704546;,"
write string 1,"0.000000;1.000000;,"

x#=0.115384+(param3-1)*0.057692

write string 1,str$(x#)+";0.704546;,"
write string 1,str$(x#)+";1.000000;,"
write string 1,str$(x#)+";0.704546;,"
write string 1,str$(x#)+";1.000000;,"
write string 1,str$(x#)+";0.704546;,"
write string 1,str$(x#)+";1.000000;,"

for i=1 to 18
    write string 1,"0.000000;0.000000;,"
next i

for i=1 to 3
    write string 1,"0.740385;0.840909;,"
    write string 1,"0.746316;1.000000;,"
    write string 1,"0.746316;0.704546;,"
    write string 1,"0.951923;0.840909;,"
    write string 1,"1.000000;1.000000;,"
    write string 1,"1.000000;0.704546;,"
next i

write string 1,"0.740385;0.840909;,"
write string 1,"0.746316;1.000000;,"
write string 1,"0.746316;0.704546;,"
write string 1,"0.951923;0.840909;,"
write string 1,"1.000000;1.000000;,"
write string 1,"1.000000;0.704546;;"

write string 1,"}"
write string 1,"}"
write string 1,"}"

endfunction



sorry, was busy typing that last bit when you replied.

I've tried that ( I take it you mean such as "C:\space game\textures\lasertexture-1.bmp")

Edit: A quick edit of code to eliminate an ad-hoc experiment at debugging (was checking i'd got my axis the right way round - i did).

This post has been edited by ekhmuel: 10 Oct, 2008 - 04:35 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 02:36PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month