Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_GenericBoxEntity.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/Shapes", description: "Procedural box", color: "255 0 0 255", style: "box", dynamicBox: true)]
2class SCR_GenericBoxEntityClass: GenericEntityClass
3{
4};
5
9class SCR_GenericBoxEntity : GenericEntity
10{
11 [Attribute("1 1 1", desc: "Size of the box", category: "Generic Box")]
12 private vector m_vSize;
13
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;
16
17 void Generate(vector size, ResourceName material)
18 {
19 private float vX = size[0] / 2;
20 private float vY = size[1] / 2;
21 private float vZ = size[2] / 2;
22
23 /*
24 7 - 6
25 /| /|
26 4 - 5
27 / /
28 3 - 2
29 | |
30 0 - 1
31 */
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);
40
41 vector verts[] =
42 {
43 vert2, vert3, vert0, vert1, //--- Bottom: 0, 1, 2, 3
44 vert7, vert6, vert5, vert4, //--- Top: 4, 5, 6, 7
45 vert4, vert5, vert1, vert0, //--- Front: 8, 9, 10, 11
46 vert6, vert7, vert3, vert2, //--- Back: 12, 13, 14, 15
47 vert7, vert4, vert0, vert3, //--- Left: 16, 17, 18, 19
48 vert5, vert6, vert2, vert1, //--- Right: 20, 21, 22, 23
49 };
50
51 int indices[] =
52 {
53 0, 1, 2, 2, 3, 0, //--- Bottom
54 4, 5, 6, 6, 7, 4, //--- Top
55 8, 9, 10, 10, 11, 8, //--- Front
56 12, 13, 14, 14, 15, 12, //--- Back
57 16, 17, 18, 18, 19, 16, //--- Left
58 20, 21, 22, 22, 23, 20, //--- Right
59 };
60 float uvs[] =
61 {
62 0,0, 1,0, 1,1, 0,1,
63 0,0, 1,0, 1,1, 0,1,
64 0,0, 1,0, 1,1, 0,1,
65 0,0, 1,0, 1,1, 0,1,
66 0,0, 1,0, 1,1, 0,1,
67 0,0, 1,0, 1,1, 0,1
68 };
69
70 int numVertices[] = {24};
71 int numIndices[] = {36};
72 string materials[1] = {material};
73
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,"");
79 }
80
81 void SCR_GenericBoxEntity(IEntitySource src, IEntity parent)
82 {
83 Generate(m_vSize, m_Material);
84 }
85
86#ifdef WORKBENCH
87 override void _WB_GetBoundBox(inout vector min, inout vector max, IEntitySource src)
88 {
89 min = -m_vSize / 2;
90 max = m_vSize / 2;
91 }
92#endif
93};
int size
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
void Generate()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
event void _WB_GetBoundBox(inout vector min, inout vector max, IEntitySource src)
Editor needs to know a bound box of entity (For ray-casting, visualizers etc.). You can return any cu...
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
MeshObject.
Definition MeshObject.c:34
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
SCR_FieldOfViewSettings Attribute
proto native vector Vector(float x, float y, float z)