; FEVF - FERROVIA ELETTRICA VALLE DI FIEMME
; by Roberto Benini - robertobenini@libero.it
; (C) 2005
; in caso di utilizzo citare fonte


; debiti: la struttura base del carro e la texture   
; provengono da CM470.b3d di
; FGC - Ferrovia Genova-Casella
; by Sergio Usai - sergiousai@tin.it
; & Luigi Cartello - cartello.luigi@tiscali.it

;lunghezza 10.76 metri


CreateMeshBuilder ; Fiancata SX carro
AddVertex, -1.3, 3.6, 4.23
AddVertex, -1.3, 3.6, -5
AddVertex, -1.3, 0.0, -5
AddVertex, -1.3, 0.0, 4.23
AddFace2, 0,1,2,3
GenerateNormals
LoadTexture, fianco3.bmp
SetDecalTransparentColor, 0,0,255
SetTextureCoordinates, 0, 0, 0
SetTextureCoordinates, 1, 1, 0
SetTextureCoordinates, 2, 1, 1
SetTextureCoordinates, 3, 0, 1

CreateMeshBuilder ; Fiancata DX carro
AddVertex, 1.3, 3.6, 4.23
AddVertex, 1.3, 3.6, -5
AddVertex, 1.3, 0.0, -5
AddVertex, 1.3, 0.0, 4.23
AddFace2, 3,2,1,0
GenerateNormals
LoadTexture, fianco3.bmp
SetDecalTransparentColor, 0,0,255
SetTextureCoordinates, 0, 0, 0
SetTextureCoordinates, 1, 1, 0
SetTextureCoordinates, 2, 1, 1
SetTextureCoordinates, 3, 0, 1


CreateMeshBuilder  ; Frontale carro (AVANTI)
AddVertex, -1.3, 3.8, -4.87;z=zeta pił arretrato +13 cm
AddVertex, 1.3, 3.8, -4.87;z=zeta pił arretato +13 cm

AddVertex, 1.3, 0.6, -4.87;z=zeta pił arretrato +13 cm

AddVertex, -1.3, 0.6, -4.87;z=zeta pił arretrato +13 cm

AddFace2, 0,1,2,3
GenerateNormals
LoadTexture, Fronte3.bmp
SetTextureCoordinates, 0, 0, 0
SetTextureCoordinates, 1, 1, 0
SetTextureCoordinates, 2, 1, 1
SetTextureCoordinates, 3, 0, 1
SetDecalTransparentColor, 0,0,255

CreateMeshBuilder  ; Frontale carro (DIETRO)
AddVertex, -1.3, 3.8, 4.10;z=zeta pił arretrato +13 cm
AddVertex, 1.3, 3.8, 4.10;z=zeta pił arretato +13 cm

AddVertex, 1.3, 0.6, 4.10;z=zeta pił arretrato +13 cm

AddVertex, -1.3, 0.6,4.10;z=zeta pił arretrato +13 cm

AddFace2, 3,2,1,0
GenerateNormals
LoadTexture, Fronte3.bmp
SetTextureCoordinates, 0, 0, 0
SetTextureCoordinates, 1, 1, 0
SetTextureCoordinates, 2, 1, 1
SetTextureCoordinates, 3, 0, 1
SetDecalTransparentColor, 0,0,255






CreateMeshBuilder ; Predella
Cube, 0.08, 0.02, 1.0
SetColor, 97,97,97
translate, -1.39, 0.66, 0; z= a metą del vagone

CreateMeshBuilder; pavimento vagone
Cube, 1.28, 0.1, 4.40
SetColor, 127,127,127
translate, 0, 0.9, -0.35

; - - - - - - tetto 
CreateMeshBuilder 
AddVertex, -1.33  , 3.37 , 4.25
AddVertex, -1.33  , 3.37 ,-5.05
AddVertex, -1.25  , 3.42 , 4.25
AddVertex, -1.25  , 3.42 ,-5.05
AddVertex, -1.05  , 3.50 , 4.25
AddVertex, -1.05  , 3.50 ,-5.05
AddVertex, -0.60  , 3.57 , 4.25
AddVertex, -0.60  , 3.57 ,-5.05
AddVertex,  0.00  , 3.60 , 4.25
AddVertex,  0.00  , 3.60 ,-5.05
AddVertex,  0.60  , 3.57 , 4.25
AddVertex,  0.60  , 3.57 ,-5.05
AddVertex,  1.05  , 3.50 , 4.25
AddVertex,  1.05  , 3.50 ,-5.05
AddVertex,  1.25  , 3.42 , 4.25
AddVertex,  1.25  , 3.42 ,-5.05
AddVertex,  1.33  , 3.37 , 4.25
AddVertex,  1.33  , 3.37 ,-5.05
AddFace2, 2, 3, 1, 0
AddFace2, 4, 5, 3, 2
AddFace2, 6, 7, 5, 4
AddFace2, 8, 9, 7, 6
AddFace2,10,11, 9, 8
AddFace2,12,13,11,10
AddFace2,14,15,13,12
AddFace2,16,17,15,14

GenerateNormals
LoadTexture,tetto_grigio.bmp
SetTextureCoordinates,0,0,0.1
SetTextureCoordinates,1,0 ,0.9
SetTextureCoordinates,2,0.0286,0.1
SetTextureCoordinates,3,0.0286,0.9
SetTextureCoordinates,4,0.0696,0.1
SetTextureCoordinates,5,0.0696,0.9
SetTextureCoordinates,6,0.2540,0.1
SetTextureCoordinates,7,0.2540,0.9
SetTextureCoordinates,8,0.50,0.1
SetTextureCoordinates,9,0.50,0.9
SetTextureCoordinates,10,0.746,0.1
SetTextureCoordinates,11,0.746,0.9
SetTextureCoordinates,12,0.9304,0.1
SetTextureCoordinates,13,0.9304,0.9
SetTextureCoordinates,14,0.9714,0.1
SetTextureCoordinates,15,0.9714,0.9
SetTextureCoordinates,16,1,0.1
SetTextureCoordinates,17,1,0.9
Translate,0,.21,0



; ------------ Carrelli ----------------------
CreateMeshBuilder
AddVertex, 0, 0.8 , 1.6
AddVertex, 0, 0.8 ,-1.6
AddVertex, 0,-0.1 ,-1.6
AddVertex, 0,-0.12 , 1.6
AddFace2,0,1,2,3
GenerateNormals
LoadTexture,bogie.bmp
SetTextureCoordinates,0,1,0
SetTextureCoordinates,1,0,0
SetTextureCoordinates,2,0,1
SetTextureCoordinates,3,1,1
SetDecalTransparentColor,0,0,255
Translate,0.7,0.08,-2.6

CreateMeshBuilder
AddVertex, 0, 0.8 , 1.6
AddVertex, 0, 0.8 ,-1.6
AddVertex, 0,-0.1 ,-1.6
AddVertex, 0,-0.12 , 1.6
AddFace2,0,1,2,3
GenerateNormals
LoadTexture,bogie.bmp
SetTextureCoordinates,0,1,0
SetTextureCoordinates,1,0,0
SetTextureCoordinates,2,0,1
SetTextureCoordinates,3,1,1
SetDecalTransparentColor,0,0,255
Translate,-0.7,0.12,-2.6

CreateMeshBuilder
AddVertex, 0, 0.8 , 1.6
AddVertex, 0, 0.8 ,-1.6
AddVertex, 0,-0.1 ,-1.6
AddVertex, 0,-0.1 , 1.6
AddFace2,0,1,2,3
GenerateNormals
LoadTexture,bogie.bmp
SetTextureCoordinates,0,1,0
SetTextureCoordinates,1,0,0
SetTextureCoordinates,2,0,1
SetTextureCoordinates,3,1,1
SetDecalTransparentColor,0,0,255
Translate,0.7,0.12,2.6

CreateMeshBuilder
AddVertex, 0, 0.8 , 1.6
AddVertex, 0, 0.8 ,-1.6
AddVertex, 0,-0.1 ,-1.6
AddVertex, 0,-0.1 , 1.6
AddFace2,0,1,2,3
GenerateNormals
LoadTexture,bogie.bmp
SetTextureCoordinates,0,1,0
SetTextureCoordinates,1,0,0
SetTextureCoordinates,2,0,1
SetTextureCoordinates,3,1,1
SetDecalTransparentColor,0,0,255
Translate,-0.7,0.12,2.6

; Route carrello anteriore
; ------------------
CreateMeshBuilder ; Ruota ant sin (3.25 + 0.75 = +4)
cylinder,10, 0.35, 0.38,0.1 
SetColor,24,24,24
rotate,0,0,1,90
translate,-0.55, 0.36, 3.5
CreateMeshBuilder ; Assale ant
cylinder,3, 0.08, 0.08 ,1.1 
SetColor,24,24,24
rotate,0,0,1,-90
translate, 0, 0.36, 3.5
CreateMeshBuilder ; Ruota ant des (3.25 + 0.75 = +4)
cylinder,10, 0.35, 0.38,0.1 
SetColor,24,24,24
rotate,0,0,1,-90
translate, 0.55, 0.36, 3.5

CreateMeshBuilder ; Ruota post sin (3.25 - 0.75 = +2.5)
cylinder,10, 0.35, 0.38,0.1 
SetColor,24,24,24
rotate,0,0,1,90
translate,-0.55, 0.36, 1.70
CreateMeshBuilder ; Assale post
cylinder,3, 0.08, 0.08 ,1.1 
SetColor,24,24,24
rotate,0,0,1,-90
translate, 0, 0.36, 1.70
CreateMeshBuilder ; Ruota post des (3.25 - 0.75 = +2.5)
cylinder,10, 0.35, 0.38,0.1 
SetColor,24,24,24
rotate,0,0,1,-90
translate, 0.55, 0.36, 1.70

; Ruote carrello posteriore
; ------------------
CreateMeshBuilder ; Ruota ant sin (-3.25 + 0.75 = -2.5)
cylinder,10, 0.35, 0.38,0.1 
SetColor,24,24,24
rotate,0,0,1,90
translate,-0.55, 0.36, -1.70
CreateMeshBuilder ; Assale ant
cylinder,3, 0.08, 0.08 ,1.1 
SetColor,24,24,24
rotate,0,0,1,-90
translate, 0, 0.36, -1.70
CreateMeshBuilder ; Ruota ant des (-3.25 + 0.75 = -2.5)
cylinder,10, 0.35, 0.38,0.1 
SetColor,24,24,24
rotate,0,0,1,-90
translate, 0.55, 0.36, -1.70
CreateMeshBuilder ; Ruota post sin (-3.25 - 0.75 = -4)
cylinder,10, 0.35, 0.38,0.1 
SetColor,24,24,24
rotate,0,0,1,90
translate,-0.55, 0.36, -3.5
CreateMeshBuilder ; Assale post
cylinder,3, 0.08, 0.08 ,1.1 
SetColor,24,24,24
rotate,0,0,1,-90
translate, 0, 0.36, -3.5
CreateMeshBuilder ; Ruota post des (-3.25 - 0.75 = -4)
cylinder,10, 0.35, 0.38,0.1 
SetColor,24,24,24
rotate,0,0,1,-90
translate, 0.55, 0.36, -3.5

CreateMeshBuilder ; Respingenti
cylinder,4, 0.12, 0.08 ,0.5 
SetColor,24,24,24
rotate,1,0,0,-90
translate, 0, 0.8, 5.10

CreateMeshBuilder
Cube,0.3,0.15,0.02
SetColor,24,24,24
translate, 0, 0.8, 5.35

CreateMeshBuilder ; Respingenti
cylinder,4, 0.08, 0.12 ,0.5 
SetColor,24,24,24
rotate,1,0,0,-90
translate, 0, 0.8, -5.10

CreateMeshBuilder
Cube,0.3,0.15,0.02
SetColor,24,24,24
translate, 0, 0.8, -5.35



; FEVF - FERROVIA ELETTRICA VALLE DI FIEMME
; by Roberto Benini - robertobenini@libero.it
; (C) 06/12/2005
; in caso di utilizzo citare fonte




; - - - - - struttura portante 10 76 m
;putrella doppio T longitudinale dx
CreateMeshBuilder; verticale
Cube,0.01,0.10,4.85
SetColor,57,57,66,;75,74,84,;41,41,49
translate, 0.67, 0.670, 0

CreateMeshBuilder;longitudinale sx
Cube,0.01,0.10,4.85
SetColor,57,57,66,;75,74,84,;41,41,49
translate, -0.67, 0.670, 0
CreateMeshBuilder;trasversale anteriore
Cube,0.03,0.175,.65
SetColor,57,57,66,;75,74,84,;41,41,49
Rotate,0,1,0,90
translate, 0, 0.65, 4.80
CreateMeshBuilder;trasversale posteriore
Cube,0.03,0.175,.65
SetColor,57,57,66,;75,74,84,;41,41,49
Rotate,0,1,0,90
translate, 0, 0.65, -4.80

; ganci
CreateMeshBuilder ; anteriore 
AddVertex, 0  , 0.70 ,-0.15
AddVertex, 0  , 0.70, 0.15
AddVertex, 0  , 0.10 ,0.15
AddVertex, 0  , 0.10 ,-0.15
AddFace2,0,1,2,3
GenerateNormals
LoadTexture, gancio.bmp
SetTextureCoordinates,0,0,0
SetTextureCoordinates,1,1,0
SetTextureCoordinates,2,1,1
SetTextureCoordinates,3,0,1
SetDecalTransparentColor,0,0,0
Translate,0,0.00,4.97

CreateMeshBuilder ; posteriore 
AddVertex, 0  , 0.70 ,-0.15
AddVertex, 0  , 0.70, 0.15
AddVertex, 0  , 0.10 ,0.15
AddVertex, 0  , 0.10 ,-0.15
AddFace2,0,1,2,3
GenerateNormals
LoadTexture, gancio.bmp
SetTextureCoordinates,0,0,0
SetTextureCoordinates,1,1,0
SetTextureCoordinates,2,1,1
SetTextureCoordinates,3,0,1
SetDecalTransparentColor,0,0,0
Rotate,0,1,0,180
Translate,0,0.00,-4.97


; - - - - - -  meccanismi sottopianale
CreateMeshBuilder; cassa dx
Cube,0.50,0.15,0.55
SetColor,41,41,49
translate, 0.64, 0.45, 0

CreateMeshBuilder; cassa sx
Cube,0.50,0.15,0.55
SetColor,41,41,49
translate, -0.64, 0.45, 0




; - - - - - - struttura laterale dx
CreateMeshBuilder; anteriore
Cube,0.02,0.02,1.27
SetColor,41,41,49
translate, -1.15, 0.08, 2.5
Rotate,1,0,0,-10
CreateMeshBuilder; centrale
Cube,0.02,0.02,1.25
SetColor,41,41,49
translate, -1.15, 0.30, 0
CreateMeshBuilder; posteriore
Cube,0.02,0.02,1.25
SetColor,41,41,49
translate, -1.15, 0.08, -2.5
Rotate,1,0,0,10
CreateMeshBuilder; verticale
Cube,0.02,0.25,.02
SetColor,41,41,49
translate, -1.15, 0.57, 1.27
CreateMeshBuilder; verticale
Cube,0.02,0.25,.02
SetColor,41,41,49
translate, -1.15, 0.57, -1.25


; - - - - - - struttura laterale sx
CreateMeshBuilder; anteriore
Cube,0.02,0.02,1.27
SetColor,41,41,49
translate, 1.15, 0.08, 2.5
Rotate,1,0,0,-10
CreateMeshBuilder; centrale
Cube,0.02,0.02,1.25
SetColor,41,41,49
translate, 1.15, 0.30, 0
CreateMeshBuilder; posteriore
Cube,0.02,0.02,1.25
SetColor,41,41,49
translate, 1.15, 0.08, -2.5
Rotate,1,0,0,10
CreateMeshBuilder; verticale
Cube,0.02,0.25,.02
SetColor,41,41,49
translate, 1.15, 0.57, 1.27
CreateMeshBuilder; verticale
Cube,0.02,0.25,.02
SetColor,41,41,49
translate, 1.15, 0.57, -1.25



; FEVF - FERROVIA ELETTRICA VALLE DI FIEMME
; by Roberto Benini - robertobenini@libero.it
; (C) 06/12/2005
; in caso di utilizzo citare fonte

; - - - - - -  MANICOTTO ANTERIORE 


CreateMeshBuilder ; tubo verticale
cylinder,8, 0.03, 0.03 ,1 
SetColor,40,40,40
translate, 0.5, 1.37,4.88

; 5 PEZZI DA 20x6 cm
CreateMeshBuilder ; 1 
cylinder,8, 0.03, 0.03 ,0.20 
SetColor,40,40,40
rotate,1,0,0,30
translate, 0.485, 1.08,4.93

CreateMeshBuilder ; 2 
cylinder,8, 0.03, 0.03 ,0.20 
SetColor,40,40,40
rotate,1,0,0,22.5
translate, 0.485, 1.255,5.02

CreateMeshBuilder ; 3 
cylinder,8, 0.03, 0.03 ,0.20 
SetColor,40,40,40
translate, 0.485, 1.43,5.055

CreateMeshBuilder ; 4 
cylinder,8, 0.03, 0.03 ,0.20 
SetColor,40,40,40
rotate,1,0,0,-22.5
translate, 0.485, 1.605,5.02

CreateMeshBuilder ; 5 
cylinder,8, 0.03, 0.03 ,0.20 
SetColor,40,40,40
rotate,1,0,0,-30
translate, 0.485, 1.775,4.93

; - - - - - -  MANICOTTO posteriore 


CreateMeshBuilder ; tubo verticale
cylinder,8, 0.03, 0.03 ,1 
SetColor,40,40,40
translate, 0.5, 1.37,4.88
rotate,0,1,0,180

; 5 PEZZI DA 20x6 cm
CreateMeshBuilder ; 1 
cylinder,8, 0.03, 0.03 ,0.20 
SetColor,40,40,40
rotate,1,0,0,30
translate, 0.485, 1.08,4.93
rotate,0,1,0,180

CreateMeshBuilder ; 2 
cylinder,8, 0.03, 0.03 ,0.20 
SetColor,40,40,40
rotate,1,0,0,22.5
translate, 0.485, 1.255,5.02
rotate,0,1,0,180

CreateMeshBuilder ; 3 
cylinder,8, 0.03, 0.03 ,0.20 
SetColor,40,40,40

translate, 0.485, 1.43,5.055
rotate,0,1,0,180

CreateMeshBuilder ; 4 
cylinder,8, 0.03, 0.03 ,0.20 
SetColor,40,40,40
rotate,1,0,0,-22.5
translate, 0.485, 1.605,5.02
rotate,0,1,0,180

CreateMeshBuilder ; 5 
cylinder,8, 0.03, 0.03 ,0.20 
SetColor,40,40,40
rotate,1,0,0,-30
translate, 0.485, 1.775,4.93
rotate,0,1,0,180


CreateMeshBuilder ; Telaio sotto cabina
Cube,0.71, 0.16, 0.4
SetColor,15,15,15
translate,0,0.75, 3.9
Translate,0,0,0.60

CreateMeshBuilder
Cube,0.78, 0.02, 0.4
SetColor,27,27,27
translate,0,0.90, 3.89
Translate,0,0,0.60

CreateMeshBuilder
Cube,0.80, 0.02, 0.4
SetColor,27,27,27
translate,0,0.60, 3.89
Translate,0,0,0.60

CreateMeshBuilder ; Mancorrente
Cube,0.81, 0.015, 0.015
SetColor,15,15,15
translate,0,2.0, 4.255
Translate,0,0,0.60
CreateMeshBuilder
Cube,0.015, 0.7, 0.015
SetColor,15,15,15
translate,-0.80,1.30, 4.255
Translate,0,0,0.60
CreateMeshBuilder
Cube,0.015, 0.7, 0.015
SetColor,15,15,15
translate, 0.80,1.30, 4.255
Translate,0,0,0.60












CreateMeshBuilder ; Scatola rinvio freno e 
Cube,0.28, 0.25, 0.12
SetColor,40,40,45
translate,0.20,2.40,4.43
Translate,0,0,0.60

CreateMeshBuilder ; Luci posizione 
AddVertex, 0, 1.5, 4.95
AddVertex, .25, 1.5 , 4.95
AddVertex, .25, 1.25, 4.95
AddVertex, 0, 1.25, 4.95
AddFace,3,2,1,0
GenerateNormals
LoadTexture,rosso.png
SetTextureCoordinates,0,0
SetTextureCoordinates,1,1,0
SetTextureCoordinates,2,1,1
SetTextureCoordinates,3,0,1
SetEmissiveColor,150,40,80
Translate,-.35,0,0

CreateMeshBuilder; Fronte garitta
AddVertex, -0.65  , 0.85, 4.301
AddVertex, -0.65  , 3.4 , 4.301
AddVertex,  0.65  , 3.4 , 4.301
AddVertex,  0.65  , 0.85, 4.301
AddFace2,0,1,2,3
GenerateNormals
LoadTexture,testata.bmp
SetTextureCoordinates,0,0.8,1
SetTextureCoordinates,1,0.8,0
SetTextureCoordinates,2,0.2,0
SetTextureCoordinates,3,0.2,1
SetDecalTransparentColor,0,0,255
Translate,0,0,0.60

CreateMeshBuilder;Tetto della garitta
Cube,0.40, 0.03, 0.50
SetColor,127,127,127
Rotate,0,0,1,6
translate,-0.395, 3.393,3.9
Translate,0,0,0.60

CreateMeshBuilder
Cube,0.40, 0.03, 0.50
SetColor,127,127,127
Rotate,0,0,1,-6
translate,0.395, 3.393,3.9
Translate,0,0,0.60

RotateAll,0,1,0,180





