Advertisement
snake5

SGR Engine editor entity specifications

Oct 18th, 2014
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. EDITOR_ENTITY
  2. ({
  3.     name = "env_global",
  4.     label = "Global environment",
  5.     params =
  6.     [
  7.         { name = "fog_color", label = "Fog color", type = "vec3", default = vec3(0.5,0.5,0.5) },
  8.         { name = "fog_density", label = "Fog density", type = "float", default = 0.01 },
  9.         { name = "fog_height_density", label = "Fog height density", type = "float", default = 0 },
  10.         { name = "fog_start_height", label = "Fog start height", type = "float", default = 0 },
  11.         { name = "fog_height_factor", label = "Fog height factor", type = "float", default = 0 },
  12.         { name = "ambient_light_color", label = "Ambient light color", type = "vec3", default = vec3(0.1,0.1,0.1) },
  13.     ],
  14.     item_list = function( data )
  15.     {
  16.         fc = data.fog_color;
  17.         alc = @data.ambient_light_color;
  18.         return [{ type = "env",
  19.             fog_color = vec3(fc.x,fc.y,fc.z),
  20.             fog_density = data.fog_density,
  21.             fog_height_density = data.fog_height_density,
  22.             fog_start_height = data.fog_start_height,
  23.             fog_height_factor = data.fog_height_factor,
  24.             ambient_light_color = vec3(alc.x,alc.y,alc.z),
  25.         }];
  26.     },
  27. });
  28.  
  29. EDITOR_ENTITY
  30. ({
  31.     name = "static_mesh",
  32.     label = "Static mesh",
  33.     params =
  34.     [
  35.         { name = "position", type = "position" },
  36.         { name = "mesh", type = "path.file.mesh" },
  37.     ],
  38.     item_list = function( data )
  39.     {
  40.         dp = data.position;
  41.         return [{ type = "mesh", src = data.mesh, position = vec3(dp.x,dp.y,dp.z) }];
  42.     },
  43. });
  44.  
  45. EDITOR_ENTITY
  46. ({
  47.     name = "point_light",
  48.     label = "Point light",
  49.     params =
  50.     [
  51.         { name = "position", type = "position" },
  52.         { name = "color", type = "vec3", default = vec3(1,1,1) },
  53.         { name = "range", type = "float", default = 100.0 },
  54.         { name = "power", type = "float", default = 1.0 },
  55.         { name = "enabled", type = "bool", default = true },
  56.     ],
  57.     render_wire = function( ctx, data )
  58.     {
  59.     },
  60.     item_list = function( data )
  61.     {
  62.         dp = data.position;
  63.         dc = data.color;
  64.         return [{ type = "point_light", position = vec3(dp.x,dp.y,dp.z), color = vec3(dc.x,dc.y,dc.z), range = data.range, power = data.power, enabled = data.enabled }];
  65.     },
  66. });
  67.  
  68. EDITOR_ENTITY
  69. ({
  70.     name = "portal",
  71.     label = "Portal",
  72.     params =
  73.     [
  74.         { name = "x", type = "position.x" },
  75.         { name = "y", type = "position.y" },
  76.         { name = "z", type = "position.z" },
  77.         { name = "d", label = "Diameter", type = "float", default = 2.88 },
  78.         { name = "h", label = "Height", type = "float", default = 18.432 },
  79.     ],
  80.     render_wire = function( ctx, data )
  81.     {
  82.         ctx.DrawCapsule( data.x, data.y, data.z - data.h * 0.5, data.x, data.y, data.z + data.h * 0.5, data.d * 0.5 );
  83.         ctx.DrawLine( data.x, data.y, data.z - data.h * 0.5, data.x, data.y, data.z + data.h * 0.5 );
  84.     },
  85.     item_list = function( data )
  86.     {
  87.         r = data.d / 2;
  88.         return
  89.         [
  90.             { type = "mesh", src = "portal", position = vec3(data.x,data.y,data.z-data.h*0.5), scale = vec3(r,r,1) },
  91.             { type = "mesh", src = "portal", position = vec3(data.x,data.y,data.z+data.h*0.5), scale = vec3(r,r,1) },
  92.         ];
  93.     },
  94. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement