local manta_scale = 1.2
local manta_radius = 20*manta_scale
local manta_pixels = {.1,50*manta_scale,200*manta_scale,0}
define_model('manta_flap_r', {
info = {
bounding_radius = manta_radius,
},
static = function()
local v0 = v(0,-4.5,0)
local v1 = v(-1.5,9,-.2)
texture('textures/manta/manta.png',v(-.683,-.522,0),v(.0111,0,0),v(0,-.0111,0))
zbias(3,v(0,0,0),v(0,0,1))
cuboid(v0,v1)
zbias(0)
end
})
define_model('manta_flap_l', {
info = {
bounding_radius = manta_radius,
},
static = function()
local v0 = v(0,-4.5,0)
local v1 = v(1.5,9,-.2)
texture('textures/manta/manta.png',v(-.65,-.522,0),v(.0111,0,0),v(0,-.0111,0))
zbias(3,v(0,0,0),v(0,0,1))
set_insideout(true)
cuboid(v0,v1)
set_insideout(false)
zbias(0)
end
})
define_model('manta_gear_front', {
info = {
lod_pixels = manta_pixels,
bounding_radius = manta_radius,
materials={'steel'},
},
static = function()
set_material('steel', .25,.28,.3,1, 1,1.3,1.5,30)
end,
dynamic = function(lod)
local v1 = v(-1.5,0,3.75)
local v2 = v(1.5,0,3.75)
local divs = lod*2
if lod > 2 then
rot_gear('manta_flap_l',v1,v(0,1,0),v(0,0,1),1,90,v(0,0,1),0,.33)
rot_gear('manta_flap_r',v2,v(0,1,0),v(0,0,1),1,90,v(0,0,-1),0,.33)
end
if get_animation_position('WHEEL_STATE') ~= 0 then
if lod > 2 then
local trans = 0.5*3.1416*(math.clamp(get_animation_position('WHEEL_STATE'),.33,1)-.33)*1/(1 - 0.33)
use_material('steel')
texture('lmrmodels/textures/010.png',v(-.5,-.35,0),v(1,0,0),v(0,-.17,0))
lathe(divs,v(.7,2.2,5),v(.7,1.2-5*math.sin(trans),5*math.cos(trans)),v(1,0,0),{0,.3, .25,.3, .25,.25, .5,.25, .5,.2, .75,.2, .75,.15, 1,.15})
end
rot_gear('gear1_fwheel',v(0,1.2,0),v(1,0,0),v(0,1,0),1,90,v(-1,0,0),.33,1)
if lod > 2 then
call_model('gear1_recess_front',v(0,0,0),v(1,0,0),v(0,1,0),1)
end
end
end
})
define_model('manta_flap_rear_rr', {
info = {
bounding_radius = manta_radius,
},
static = function()
local v0 = v(0,-1,0)
local v1 = v(0,1,0)
local v2 = v(-6,2.8,0)
local v3 = v(-6.5,2.8,0)
local v4 = v(-6.5,-2.8,0)
local v5 = v(-6,-2.8,0)
local v6 = v(0,0,-.2)
local v7 = v(0,0,0)
texture('textures/manta/manta.png',v(-.8615,-.212,0),v(.0095,0,0),v(0,-.01,0))
zbias(3,v(0,0,0),v(0,0,1))
extrusion(v6,v7,v(0,1,0),1, v0,v1,v2,v3,v4,v5)
zbias(0)
end
})
define_model('manta_flap_rear_rl', {
info = {
bounding_radius = manta_radius,
},
static = function()
local v0 = v(0,-2.8,0)
local v1 = v(2.5,5.6,-.2)
texture('textures/manta/manta.png',v(-.7685,-.212,0),v(.012,0,0),v(0,-.01,0))
set_insideout(true)
zbias(3,v(0,0,0),v(0,0,1))
cuboid(v0,v1)
zbias(0)
set_insideout(false)
end
})
define_model('manta_flap_rear_ll', {
info = {
bounding_radius = manta_radius,
},
static = function()
local v0 = v(0,-1,0)
local v1 = v(0,1,0)
local v2 = v(6,2.8,0)
local v3 = v(6.5,2.8,0)
local v4 = v(6.5,-2.8,0)
local v5 = v(6,-2.8,0)
local v6 = v(0,0,-.2)
local v7 = v(0,0,0)
texture('textures/manta/manta.png',v(-.4705,-.212,0),v(-.0095,0,0),v(0,.01,0))
zbias(3,v(0,0,0),v(0,0,1))
extrusion(v6,v7,v(0,-1,0),1, v5,v4,v3,v2,v1,v0)
zbias(0)
end
})
define_model('manta_flap_rear_lr', {
info = {
bounding_radius = manta_radius,
},
static = function()
local v0 = v(0,-2.8,0)
local v1 = v(2.5,5.6,-.2)
texture('textures/manta/manta.png',v(-.563,-.212,0),v(-.012,0,0),v(0,.01,0))
set_insideout(true)
zbias(3,v(0,0,0),v(0,0,1))
cuboid(v0,v1)
zbias(0)
set_insideout(false)
end
})
define_model('manta_gear_right', {
info = {
lod_pixels = manta_pixels,
bounding_radius = manta_radius,
materials={'steel'},
},
static = function()
set_material('steel', .25,.28,.3,1, 1,1.3,1.5,30)
end,
dynamic = function(lod)
local v0 = v(1,0,0)
local v1 = v(-8,0,0)
local v2 = v(.3,.6,0)
local divs = 2*lod
if lod > 2 then
rot_gear('manta_flap_rear_rr',v0,v(0,1,0),v(0,0,1),1,90,v(0,0,-1),.33,1)
rot_gear('manta_flap_rear_rl',v1,v(0,1,0),v(0,0,1),1,90,v(0,0,1),0,.33)
end
if get_animation_position('WHEEL_STATE') ~= 0 then
if lod > 2 then
local trans = 0.5*3.1416*(math.clamp(get_animation_position('WHEEL_STATE'),.33,1)-.33)*1/(1 - 0.33)
use_material('steel')
texture('lmrmodels/textures/010.png',v(-.5,0,0),v(0,.12,0),v(0,0,-5))
lathe(divs,v(-4.5,2.0,0),v(0.25-4.75*math.cos(trans),0.4-4.5*math.sin(trans),0),v(0,0,1),{0,.3, .25,.3, .25,.25, .5,.25, .5,.2, .75,.2, .75,.15, 1,.15})
end
rot_gear('gear2_wheel',v2,v(0,1,0),v(0,0,-1),1,90,v(0,0,-1),.33,1)
if lod > 2 then
call_model('gear2_recess',v(0,0,0),v(1,0,0),v(0,0,1),1)
end
end
end
})
define_model('manta_gear_left', {
info = {
lod_pixels = manta_pixels,
bounding_radius = manta_radius,
materials={'steel'},
},
static = function()
set_material('steel', .25,.28,.3,1, 1,1.3,1.5,30)
end,
dynamic = function(lod)
local v0 = v(1,0,0)
local v1 = v(-8,0,0)
local v2 = v(.3,.6,0)
local divs = 2*lod
if lod > 2 then
rot_gear('manta_flap_rear_ll',v0,v(0,1,0),v(0,0,1),1,90,v(0,0,-1),.33,1)
rot_gear('manta_flap_rear_lr',v1,v(0,1,0),v(0,0,1),1,90,v(0,0,1),0,.33)
end
if get_animation_position('WHEEL_STATE') ~= 0 then
if lod > 2 then
local trans = 0.5*3.1416*(math.clamp(get_animation_position('WHEEL_STATE'),.33,1)-.33)*1/(1 - 0.33)
use_material('steel')
texture('lmrmodels/textures/010.png',v(-.5,0,0),v(0,.12,0),v(0,0,-5))
lathe(divs,v(-4.5,2.0,0),v(0.25-4.75*math.cos(trans),0.4-4.5*math.sin(trans),0),v(0,0,1),{0,.3, .25,.3, .25,.25, .5,.25, .5,.2, .75,.2, .75,.15, 1,.15})
end
rot_gear('gear2_wheel',v2,v(0,1,0),v(0,0,-1),1,90,v(0,0,-1),.33,1)
if lod > 2 then
call_model('gear2_recess',v(0,0,0),v(1,0,0),v(0,0,1),1)
end
end
end
})
define_model('manta_gun', {
info = {
lod_pixels = manta_pixels,
bounding_radius = manta_radius,
materials = {'black','rand'},
},
static = function(lod)
local divs = 4*lod
set_material('black', .15,.15,.2,1, .8,.9,1,30)
use_material('rand')
texture('textures/manta/manta.png',v(-.333,-.7,0),v(.037,0,0),v(0,0,-1))
lathe(divs,v(0,0,-1.2),v(0,0,1),v(0,1,0),{ 0,.25, .1,.35, 1,.35 })
use_material('black')
texture('textures/087.png',v(-.5,-.5,0),v(2,0,0),v(0,-2,0))
zbias(1,v(0,0,0),v(0,0,1.))
circle(divs,v(0,0,-1.2),v(0,0,-1),v(0,1,0),.2)
zbias(0)
end,
dynamic = function()
set_material('rand', get_arg_material(0))
if get_equipment('LASER',1) then
call_model('gun1_front',v(0,0,-1.2),v(1,0,0),v(0,1,0),1/manta_scale)
end
end
})
define_model('manta', {
info = {
scale = manta_scale,
lod_pixels = manta_pixels,
bounding_radius = manta_radius,
materials = {'steel','wins','null','metal','text','rand','matt','glow','layer'},
tags = {'ship'},
},
static = function(lod)
local v0 = v(0,0,-12)
local v1 = v(2,0,-11)
local v2 = v(2,0,-4)
local v3 = v(9,0,-2)
local v4 = v(0,2,-10)
local v5 = v(3,2,-4)
local v6 = v(6,.5,-1)
local v7 = v(9,.5,-1)
local v8 = v(0,2,-4)
local v9 = v(3,2,-1)
local v10 = v(6,1,-.5)
local v11 = v(9,.5,-.5)
local v12 = v(0,2,0)
local v13 = v(3,1.5,0)
local v14 = v(6,1,0)
local v15 = v(9,.5,0)
local v16 = v(0,3,6)
local v17 = v(3,0,3)
local v18 = v(6,0,2)
local v19 = v(9,0,2)
local v20 = v(0,2,4)
local v21 = v(3,1,2)
local v22 = v(6,1,1.5)
local v23 = v(9,.5,1.5)
local v24 = v(0,2,2)
local v25 = v(3,1,1.5)
local v26 = v(6,.5,1)
local v27 = v(9,.5,1)
local divs = 4*lod
local divs2 = 6*lod
set_material('steel', .55,.65,.7,1, 1,1.2,1.5,30)
set_material('metal', .3,.35,.4,1, .8,.9,1,30)
set_material('null', 0,0,0,0)
set_material('text', 1,1,1,.5, .3,.3,.3,10)
set_material('matt', .2,.25,.3,1, .3,.3,.3,10)
set_material('glow', 0,0,0,1, 1,1,1,100, 1,1.2,1.5)
set_material('layer', .55,.65,.7,.99, 1,1.2,1.5,30)
use_material('metal')
call_model('manta_gear_right',v(5,0,.5),v(1,0,0),v(0,1,0),.28)
use_material('metal')
call_model('manta_gear_left',v(-5,0,.5),v(-1,0,0),v(0,1,0),.28)
use_material('metal')
call_model('manta_gear_front',v(0,0,-9),v(1,0,0),v(0,1,0),.3)
if lod == 1 then
xref_cubic_bezier_quad(3,3, v0,v4,v8,v12,
v1,v5,v9,v13,
v2,v6,v10,v14,
v3,v7,v11,v15)
xref_cubic_bezier_quad(3,3, v16,v17,v18,v19,
v20,v21,v22,v23,
v24,v25,v26,v27,
v12,v13,v14,v15)
xref_cubic_bezier_quad(3,1, v16,v16+v(0,-3,0),v16+v(0,-3,0),v16+v(0,-3,0),
v17,v17,v17,v17,
v18,v18,v18,v18,
v19,v19,v19,v19)
xref_flat(3, v(0,-1,0),{v12+v(0,-2,0)},{v0},{v1,v2,v3},{v15+v(0,-.5,0)})
xref_flat(3, v(0,-1,0),{v12+v(0,-2,0)},{v15+v(0,-.5,0)},{v19},{v18,v17,v16+v(0,-3,0)})
xref_cylinder(4,v(9.4,.25,-4),v(9.4,.25,4),v(0,1,0),.5)
else
--cockpit
if lod > 2 then
use_material('steel')
texture('textures/155.png',v(-.5,-.7,0),v(1.2,0,0),v(0,2.75,0))
texture_glow('textures/155glow.png')
extrusion(v(0,0,.5),v(0,0,.35),v(0,1,-.5),1,v(-.55,1.6,0),v(.55,1.6,0),v(.4,1.95,0),v(-.4,1.95,0))
texture_glow(nil)
use_material('matt')
texture('textures/121.png',v(-.5,-.7,0),v(0,0,1),v(0,-.8,0))
cuboid(v(-.75,1.8,-1),v(1.5,-.8,2))
use_material('steel')
set_insideout(true)
ring(divs2,v(0,1.6,0),v(0,2.05,0),v(0,0,1),.6)
set_insideout(false)
if lod > 3 then
call_model('pilot1',v(0,1.7,-.2),v(1,0,0),v(0,1,0),1/manta_scale)
end
--inlets
use_material('steel')
texture('textures/manta/manta.png',v(-.667,-.2305,0),v(.037,0,0),v(0,0,1))
cuboid(v(-1,0,2),v(2,.2,-3))
set_insideout(true)
lathe(divs,v(3,0,-3),v(3,.2,-3),v(0,0,1),{ 0,.6, 1,.6, 1,0 })
lathe(divs,v(-3,0,-3),v(-3,.2,-3),v(0,0,1),{ 0,.6, 1,.6, 1,0 })
set_insideout(false)
--cutouts
texture(nil)
use_material('null')
zbias(1,v(0,0,0),v(0,1,0))
circle(divs2,v(0,2.05,0),v(0,1,0),v(0,0,1),.6)
zbias(1,v(0,0,0),v(0,-1,0))
quad(v(1,0,2),v(-1,0,2),v(-1,0,-1),v(1,0,-1))
xref_circle(divs,v(3,0,-3),v(0,-1,0),v(0,0,1),.6)
zbias(0)
--mountings
use_material('steel')
texture('textures/manta/manta.png',v(-.34,-.769,0),v(.035,0,0),v(0,0,-1))
set_insideout(true)
lathe(divs,v(3,1.6,0),v(3,1.65,0),v(0,0,1),{ 0,0, 0,.5, 1,.5 })
texture('textures/manta/manta.png',v(-.327,-.769,0),v(.035,0,0),v(0,0,-1))
lathe(divs,v(-3,1.6,0),v(-3,1.65,0),v(0,0,1),{ 0,0, 0,.5, 1,.5 })
set_insideout(false)
use_material('rand')
texture('textures/manta/manta.png',v(-.333,-.769,0),v(.037,0,0),v(0,0,-1))
lathe(divs,v(3,1.3,0),v(3,1.65,0),v(0,0,1),{ 0,.8, 1,.6, 1,.5 })
lathe(divs,v(-3,1.3,0),v(-3,1.65,0),v(0,0,1),{ 0,.8, 1,.6, 1,.5 })
end
use_material('rand')
texture('textures/manta/manta.png',v(-.333,-.769,0),v(.037,0,0),v(0,0,-1))
xref_cubic_bezier_quad(divs,divs, v0,v4,v8,v12,
v1,v5,v9,v13,
v2,v6,v10,v14,
v3,v7,v11,v15)
xref_cubic_bezier_quad(divs,divs, v16,v17,v18,v19,
v20,v21,v22,v23,
v24,v25,v26,v27,
v12,v13,v14,v15)
lathe(divs2,v(0,1.8,0),v(0,2.05,0),v(0,0,1),{ 0,.9, 1,.7, 1,.6 })
use_material('metal')
texture('textures/manta/manta.png',v(-.667,-.231,0),v(.037,0,0),v(0,0,1))
xref_flat(divs, v(0,-1,0),{v12+v(0,-2,0)},{v0},{v1,v2,v3},{v15+v(0,-.5,0)})
xref_flat(divs, v(0,-1,0),{v12+v(0,-2,0)},{v15+v(0,-.5,0)},{v19},{v18,v17,v16+v(0,-3,0)})
texture('textures/manta/manta.png',v(-.007,-.341,0),v(0,.04,0),v(.037,0,0))--.037
xref_cubic_bezier_quad(divs,1, v16,v16+v(0,-3,0),v16+v(0,-3,0),v16+v(0,-3,0),
v17,v17,v17,v17,
v18,v18,v18,v18,
v19,v19,v19,v19)
use_material('steel')
texture('textures/manta/manta.png',v(-.63,-.232,0),v(-.057,0,0),v(0,0,-1))
lathe(divs,v(-9.4,.25,-4),v(-9.4,.25,4),v(0,1,0), { 0,.4, 0,.5, .08,.5, .08,.45, .1,.45, .1,.5, .9,.5, .9,.45, .92,.45, .92,.5, 1,.5, 1,.4 })
use_material('metal')
set_insideout(true)
ring(divs,v(-9.4,.25,-4),v(-9.4,.25,-3.5),v(0,1,0),.4)
ring(divs,v(-9.4,.25,4),v(-9.4,.25,3.5),v(0,1,0),.4)
set_insideout(false)
use_material('steel')
texture('textures/manta/manta.png',v(-.63,-.232,0),v(.057,0,0),v(0,0,-1))
lathe(divs,v(9.4,.25,-4),v(9.4,.25,4),v(0,1,0), { 0,.4, 0,.5, .08,.5, .08,.45, .1,.45, .1,.5, .9,.5, .9,.45, .92,.45, .92,.5, 1,.5, 1,.4 })
use_material('metal')
set_insideout(true)
ring(divs,v(9.4,.25,-4),v(9.4,.25,-3.5),v(0,1,0),.4)
ring(divs,v(9.4,.25,4),v(9.4,.25,3.5),v(0,1,0),.4)
set_insideout(false)
texture('textures/004.png',v(-.5,-.2,0),v(1.171,0,0),v(0,1.171,0))
xref_circle(divs,v(9.4,.25,-3.5),v(0,0,-1),v(0,1,0),.4)
xref_circle(divs,v(9.4,.25,3.5),v(0,0,1),v(0,1,0),.4)
texture('textures/013.png',v(-.5,-.6,0),v(0,0,-1),v(-1.5,0,0) )
xref_ring(divs,v(1.2,.95,4.5),v(1.2,.95,5.5),v(0,1,0),.3)
call_model('posl_green',v(9.9,.25,.2),v(1,0,0),v(0,1,0),1.5)
call_model('posl_white1',v(9.9,.25,-.2),v(1,0,0),v(0,1,0),1.5)
call_model('posl_red',v(-9.9,.25,.2),v(1,0,0),v(0,1,0),1.5)
call_model('posl_white2',v(-9.9,.25,-.2),v(1,0,0),v(0,1,0),1.5)
call_model('headlight',v(0,0,-10),v(1,0,0),v(0,1,0),1.5)
--window
use_material('layer')
texture('textures/122.png',v(-.26,-.11,0),v(0,0,-.5),v(0,-2,0))
set_insideout(true)
sphere_slice(divs2,divs/2,0,.5*3.1416,matrix.translate(v(0,2.05,0))*matrix.scale(v(.64,.49,.64)))
set_insideout(false)
use_material('wins')
texture(nil)
sphere_slice(divs2,divs/2,0,.5*3.1416,matrix.translate(v(0,2.05,0))*matrix.scale(v(.65,.5,.65)))
use_material('layer')
texture('textures/122.png',v(-.26,-.11,0),v(0,0,-.5),v(0,-2,0))
zbias(1,v(0,0,0),v(0,1,0))
sphere_slice(divs2,divs/2,0,.5*3.1416,matrix.translate(v(0,2.05,0))*matrix.scale(v(.65,.5,.65)))
zbias(0)
texture(nil)
local MT = v(1.2,.95,6.5)
local MT2 = v(9.4,.25,4)
local RT = v(9.4,.25,-4)
local TFT = v(9.4,1.15,-3)
local TRT = v(9.4,1.15,3)
local BFT = v(9.4,-.65,-3)
local BRT = v(9.4,-.65,3)
local RFT = v(10.25,.25,-3)
local RRT = v(10.25,.25,3)
call_model('nozzle_l',MT,v(1,0,0),v(0,0,1),.6)
call_model('nozzle_l',mirx(MT),v(1,0,0),v(0,0,1),.6)
if lod > 2 then
call_model('nozzle_s',TFT,v(1,0,0),v(0,1,0),.2)
call_model('nozzle_s',mirx(TFT),v(1,0,0),v(0,1,0),.2)
call_model('nozzle_s',TRT,v(1,0,0),v(0,1,0),.2)
call_model('nozzle_s',mirx(TRT),v(1,0,0),v(0,1,0),.2)
call_model('nozzle_s',BFT,v(1,0,0),v(0,-1,0),.2)
call_model('nozzle_s',mirx(BFT),v(1,0,0),v(0,-1,0),.2)
call_model('nozzle_s',BRT,v(1,0,0),v(0,-1,0),.2)
call_model('nozzle_s',mirx(BRT),v(1,0,0),v(0,-1,0),.2)
call_model('nozzle_s',RFT,v(0,1,0),v(1,0,0),.2)
call_model('nozzle_s',mirx(RFT),v(0,1,0),v(-1,0,0),.2)
call_model('nozzle_s',RRT,v(0,1,0),v(1,0,0),.2)
call_model('nozzle_s',mirx(RRT),v(0,1,0),v(-1,0,0),.2)
call_model('squad_sign',v(5.05,0,-1.95),v(-1,0,0),v(0,-1,0),.6)
end
xref_thruster(MT,v(0,0,1),20,true)
xref_thruster(MT2,v(0,0,1),10)
xref_thruster(RT,v(0,0,-1),10)
xref_thruster(TFT,v(0,1,0),5)
xref_thruster(TRT,v(0,1,0),5)
xref_thruster(BFT,v(0,-1,0),5)
xref_thruster(BRT,v(0,-1,0),5)
thruster(RFT,v(1,0,0),5)
thruster(mirx(RFT),v(-1,0,0),5)
thruster(RRT,v(1,0,0),5)
thruster(mirx(RRT),v(-1,0,0),5)
end
end,
dynamic = function (lod)
if lod > 1 then
set_material('rand', get_arg_material(0))
if lod > 2 then
local missiles = {v(8,-.6,0),v(-8,-.6,0),v(7,-.6,0),v(-7,-.6,0)}
for i = 1,4 do
missile(i,missiles[i],v(-1,0,0),v(0,-1,0),manta_scale,1)
end
local reg = get_label()
use_material('text')
texture('lmrmodels/textures/text.png',v(.5,-.5,0),v(1,0,0),v(0,0,-1))
zbias(1,v(0,0,0),v(0,1,0))
text(reg,v(6,1.005,0),v(0,1,.1),v(1,-.17,0),.8,{center = true})
zbias(1,v(0,0,0),v(0,-1,0))
text(reg,v(-5.05,0,-1.95),v(0,-1,0),v(-1,0,0),.6,{center = true})
local shipname = legalname()
local textscale = autoscale_text(1,8,shipname)
zbias(1,v(0,0,0),v(0,1,0))
text(shipname,v(-6,1.005,0),v(0,1,.1),v(1,.17,0),textscale,{center = true})
zbias(0)
texture(nil)
--equipment
if get_equipment('LASER',1) then
if get_equipment('LASER',1) == 'PULSECANNON_DUAL_1MW' then
call_model('manta_gun',v(2,.5,-7.5),v(1,0,0),v(0,1,0),1)
call_model('manta_gun',v(-2,.5,-7.5),v(1,0,0),v(0,1,0),1)
else
call_model('manta_gun',v(0,.5,-10.5),v(1,0,0),v(0,1,0),1)
end
end
if get_equipment('HYPERCLOUD') then
call_model('analyzer',v(3,1.5,0),v(1,0,0),v(0,1,0),.8/manta_scale)
end
if get_equipment('RADARMAPPER') then
call_model('antenna',v(7,.2,-2.7),v(1,0,0),v(0,1,0),.8/manta_scale)
end
if get_equipment('SCANNER') then
call_model('scanner',v(-3,1.5,0),v(1,0,0),v(0,1,0),.5/manta_scale)
end
if get_equipment('ECM') then
call_model('ecm',v(0,.5,-4),v(-1,0,0),v(0,-1,0),.8/manta_scale)
end
set_material('wins', .1,.1,.15,.5, 1,1,1.5,100)
else
set_material('wins', .1,.1,.15,1, 1,1,1.5,100)
end
end
end
})