1 [
EntityEditorProps(
category:
"GameScripted/Shapes", description:
"Procedural box", color:
"255 0 0 255", style:
"box", dynamicBox:
true)]
12 private vector m_vSize;
14 [
Attribute(
desc:
"Material mapped on outside and inside of the mesh. Inside mapping is mirrored.", uiwidget: UIWidgets.ResourcePickerThumbnail,
params:
"emat",
category:
"Generic Box")]
15 private ResourceName m_Material;
17 void Generate(vector size, ResourceName material)
19 private float vX = size[0] / 2;
20 private float vY = size[1] / 2;
21 private float vZ = size[2] / 2;
32 vector vert0 = Vector(-vX, -vY, -vZ);
33 vector vert1 = Vector( vX, -vY, -vZ);
34 vector vert2 = Vector( vX, -vY, vZ);
35 vector vert3 = Vector(-vX, -vY, vZ);
36 vector vert4 = Vector(-vX, vY, -vZ);
37 vector vert5 = Vector( vX, vY, -vZ);
38 vector vert6 = Vector( vX, vY, vZ);
39 vector vert7 = Vector(-vX, vY, vZ);
43 vert2, vert3, vert0, vert1,
44 vert7, vert6, vert5, vert4,
45 vert4, vert5, vert1, vert0,
46 vert6, vert7, vert3, vert2,
47 vert7, vert4, vert0, vert3,
48 vert5, vert6, vert2, vert1,
56 12, 13, 14, 14, 15, 12,
57 16, 17, 18, 18, 19, 16,
58 20, 21, 22, 22, 23, 20,
70 int numVertices[] = {24};
71 int numIndices[] = {36};
72 string materials[1] = {material};
74 Resource res = MeshObject.Create(1, numVertices, numIndices, materials, 0);
75 MeshObject meshObject = res.GetResource().ToMeshObject();
76 meshObject.UpdateVerts(0, verts, uvs);
77 meshObject.UpdateIndices(0, indices);
78 if (meshObject) SetObject(meshObject,
"");
87 override void _WB_GetBoundBox(inout vector min, inout vector max, IEntitySource src)