/
mesh.gen.go
329 lines (267 loc) · 10.4 KB
/
mesh.gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
package godot
import (
"github.com/shadowapex/godot-go/gdnative"
)
/*------------------------------------------------------------------------------
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. Any updates should be done in
// "class.go.tmpl" so they can be included in the generated
// code.
//----------------------------------------------------------------------------*/
// MeshArrayFormat is an enum for ArrayFormat values.
type MeshArrayFormat int
const (
MeshArrayCompressBase MeshArrayFormat = 9
MeshArrayCompressBones MeshArrayFormat = 32768
MeshArrayCompressColor MeshArrayFormat = 4096
MeshArrayCompressDefault MeshArrayFormat = 97792
MeshArrayCompressIndex MeshArrayFormat = 131072
MeshArrayCompressNormal MeshArrayFormat = 1024
MeshArrayCompressTangent MeshArrayFormat = 2048
MeshArrayCompressTexUv MeshArrayFormat = 8192
MeshArrayCompressTexUv2 MeshArrayFormat = 16384
MeshArrayCompressVertex MeshArrayFormat = 512
MeshArrayCompressWeights MeshArrayFormat = 65536
MeshArrayFlagUse16BitBones MeshArrayFormat = 524288
MeshArrayFlagUse2DVertices MeshArrayFormat = 262144
MeshArrayFormatBones MeshArrayFormat = 64
MeshArrayFormatColor MeshArrayFormat = 8
MeshArrayFormatIndex MeshArrayFormat = 256
MeshArrayFormatNormal MeshArrayFormat = 2
MeshArrayFormatTangent MeshArrayFormat = 4
MeshArrayFormatTexUv MeshArrayFormat = 16
MeshArrayFormatTexUv2 MeshArrayFormat = 32
MeshArrayFormatVertex MeshArrayFormat = 1
MeshArrayFormatWeights MeshArrayFormat = 128
)
// MeshArrayType is an enum for ArrayType values.
type MeshArrayType int
const (
MeshArrayBones MeshArrayType = 6
MeshArrayColor MeshArrayType = 3
MeshArrayIndex MeshArrayType = 8
MeshArrayMax MeshArrayType = 9
MeshArrayNormal MeshArrayType = 1
MeshArrayTangent MeshArrayType = 2
MeshArrayTexUv MeshArrayType = 4
MeshArrayTexUv2 MeshArrayType = 5
MeshArrayVertex MeshArrayType = 0
MeshArrayWeights MeshArrayType = 7
)
// MeshBlendShapeMode is an enum for BlendShapeMode values.
type MeshBlendShapeMode int
const (
MeshBlendShapeModeNormalized MeshBlendShapeMode = 0
MeshBlendShapeModeRelative MeshBlendShapeMode = 1
)
// MeshPrimitiveType is an enum for PrimitiveType values.
type MeshPrimitiveType int
const (
MeshPrimitiveLines MeshPrimitiveType = 1
MeshPrimitiveLineLoop MeshPrimitiveType = 3
MeshPrimitiveLineStrip MeshPrimitiveType = 2
MeshPrimitivePoints MeshPrimitiveType = 0
MeshPrimitiveTriangles MeshPrimitiveType = 4
MeshPrimitiveTriangleFan MeshPrimitiveType = 6
MeshPrimitiveTriangleStrip MeshPrimitiveType = 5
)
//func NewMeshFromPointer(ptr gdnative.Pointer) Mesh {
func newMeshFromPointer(ptr gdnative.Pointer) Mesh {
owner := gdnative.NewObjectFromPointer(ptr)
obj := Mesh{}
obj.SetBaseObject(owner)
return obj
}
/*
Mesh is a type of [Resource] that contains vertex-array based geometry, divided in [i]surfaces[/i]. Each surface contains a completely separate array and a material used to draw it. Design wise, a mesh with multiple surfaces is preferred to a single surface, because objects created in 3D editing software commonly contain multiple materials.
*/
type Mesh struct {
Resource
owner gdnative.Object
}
func (o *Mesh) BaseClass() string {
return "Mesh"
}
/*
Calculate a [ConvexPolygonShape] from the mesh.
Args: [], Returns: Shape
*/
func (o *Mesh) CreateConvexShape() ShapeImplementer {
//log.Println("Calling Mesh.CreateConvexShape()")
// Build out the method's arguments
ptrArguments := make([]gdnative.Pointer, 0, 0)
// Get the method bind
methodBind := gdnative.NewMethodBind("Mesh", "create_convex_shape")
// Call the parent method.
// Shape
retPtr := gdnative.NewEmptyObject()
gdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)
// If we have a return type, convert it from a pointer into its actual object.
ret := newShapeFromPointer(retPtr)
// Check to see if we already have an instance of this object in our Go instance registry.
if instance, ok := InstanceRegistry.Get(ret.GetBaseObject().ID()); ok {
return instance.(ShapeImplementer)
}
// Check to see what kind of class this is and create it. This is generally used with
// GetNode().
className := ret.GetClass()
if className != "Shape" {
actualRet := getActualClass(className, ret.GetBaseObject())
return actualRet.(ShapeImplementer)
}
return &ret
}
/*
Calculate an outline mesh at a defined offset (margin) from the original mesh. Note: Typically returns the vertices in reverse order (e.g. clockwise to anti-clockwise).
Args: [{ false margin float}], Returns: Mesh
*/
func (o *Mesh) CreateOutline(margin gdnative.Real) MeshImplementer {
//log.Println("Calling Mesh.CreateOutline()")
// Build out the method's arguments
ptrArguments := make([]gdnative.Pointer, 1, 1)
ptrArguments[0] = gdnative.NewPointerFromReal(margin)
// Get the method bind
methodBind := gdnative.NewMethodBind("Mesh", "create_outline")
// Call the parent method.
// Mesh
retPtr := gdnative.NewEmptyObject()
gdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)
// If we have a return type, convert it from a pointer into its actual object.
ret := newMeshFromPointer(retPtr)
// Check to see if we already have an instance of this object in our Go instance registry.
if instance, ok := InstanceRegistry.Get(ret.GetBaseObject().ID()); ok {
return instance.(MeshImplementer)
}
// Check to see what kind of class this is and create it. This is generally used with
// GetNode().
className := ret.GetClass()
if className != "Mesh" {
actualRet := getActualClass(className, ret.GetBaseObject())
return actualRet.(MeshImplementer)
}
return &ret
}
/*
Calculate a [ConcavePolygonShape] from the mesh.
Args: [], Returns: Shape
*/
func (o *Mesh) CreateTrimeshShape() ShapeImplementer {
//log.Println("Calling Mesh.CreateTrimeshShape()")
// Build out the method's arguments
ptrArguments := make([]gdnative.Pointer, 0, 0)
// Get the method bind
methodBind := gdnative.NewMethodBind("Mesh", "create_trimesh_shape")
// Call the parent method.
// Shape
retPtr := gdnative.NewEmptyObject()
gdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)
// If we have a return type, convert it from a pointer into its actual object.
ret := newShapeFromPointer(retPtr)
// Check to see if we already have an instance of this object in our Go instance registry.
if instance, ok := InstanceRegistry.Get(ret.GetBaseObject().ID()); ok {
return instance.(ShapeImplementer)
}
// Check to see what kind of class this is and create it. This is generally used with
// GetNode().
className := ret.GetClass()
if className != "Shape" {
actualRet := getActualClass(className, ret.GetBaseObject())
return actualRet.(ShapeImplementer)
}
return &ret
}
/*
Generate a [TriangleMesh] from the mesh.
Args: [], Returns: TriangleMesh
*/
func (o *Mesh) GenerateTriangleMesh() TriangleMeshImplementer {
//log.Println("Calling Mesh.GenerateTriangleMesh()")
// Build out the method's arguments
ptrArguments := make([]gdnative.Pointer, 0, 0)
// Get the method bind
methodBind := gdnative.NewMethodBind("Mesh", "generate_triangle_mesh")
// Call the parent method.
// TriangleMesh
retPtr := gdnative.NewEmptyObject()
gdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)
// If we have a return type, convert it from a pointer into its actual object.
ret := newTriangleMeshFromPointer(retPtr)
// Check to see if we already have an instance of this object in our Go instance registry.
if instance, ok := InstanceRegistry.Get(ret.GetBaseObject().ID()); ok {
return instance.(TriangleMeshImplementer)
}
// Check to see what kind of class this is and create it. This is generally used with
// GetNode().
className := ret.GetClass()
if className != "TriangleMesh" {
actualRet := getActualClass(className, ret.GetBaseObject())
return actualRet.(TriangleMeshImplementer)
}
return &ret
}
/*
Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle.
Args: [], Returns: PoolVector3Array
*/
func (o *Mesh) GetFaces() gdnative.PoolVector3Array {
//log.Println("Calling Mesh.GetFaces()")
// Build out the method's arguments
ptrArguments := make([]gdnative.Pointer, 0, 0)
// Get the method bind
methodBind := gdnative.NewMethodBind("Mesh", "get_faces")
// Call the parent method.
// PoolVector3Array
retPtr := gdnative.NewEmptyPoolVector3Array()
gdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)
// If we have a return type, convert it from a pointer into its actual object.
ret := gdnative.NewPoolVector3ArrayFromPointer(retPtr)
return ret
}
/*
Undocumented
Args: [], Returns: Vector2
*/
func (o *Mesh) GetLightmapSizeHint() gdnative.Vector2 {
//log.Println("Calling Mesh.GetLightmapSizeHint()")
// Build out the method's arguments
ptrArguments := make([]gdnative.Pointer, 0, 0)
// Get the method bind
methodBind := gdnative.NewMethodBind("Mesh", "get_lightmap_size_hint")
// Call the parent method.
// Vector2
retPtr := gdnative.NewEmptyVector2()
gdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)
// If we have a return type, convert it from a pointer into its actual object.
ret := gdnative.NewVector2FromPointer(retPtr)
return ret
}
/*
Undocumented
Args: [{ false size Vector2}], Returns: void
*/
func (o *Mesh) SetLightmapSizeHint(size gdnative.Vector2) {
//log.Println("Calling Mesh.SetLightmapSizeHint()")
// Build out the method's arguments
ptrArguments := make([]gdnative.Pointer, 1, 1)
ptrArguments[0] = gdnative.NewPointerFromVector2(size)
// Get the method bind
methodBind := gdnative.NewMethodBind("Mesh", "set_lightmap_size_hint")
// Call the parent method.
// void
retPtr := gdnative.NewEmptyVoid()
gdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)
}
// MeshImplementer is an interface that implements the methods
// of the Mesh class.
type MeshImplementer interface {
ResourceImplementer
CreateConvexShape() ShapeImplementer
CreateOutline(margin gdnative.Real) MeshImplementer
CreateTrimeshShape() ShapeImplementer
GenerateTriangleMesh() TriangleMeshImplementer
GetFaces() gdnative.PoolVector3Array
GetLightmapSizeHint() gdnative.Vector2
SetLightmapSizeHint(size gdnative.Vector2)
}