1// Package graphene was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package graphene
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gobject/types"
12)
13
14// A triangle.
15type Triangle struct {
16 _ structs.HostLayout
17
18 A uintptr
19
20 B uintptr
21
22 C uintptr
23}
24
25var xTriangleGLibType func() types.GType
26
27func TriangleGLibType() types.GType {
28 return xTriangleGLibType()
29}
30
31func (x *Triangle) GoPointer() uintptr {
32 return uintptr(unsafe.Pointer(x))
33}
34
35var xTriangleAlloc func() *Triangle
36
37// Allocates a new #graphene_triangle_t.
38//
39// The contents of the returned structure are undefined.
40func TriangleAlloc() *Triangle {
41
42 cret := xTriangleAlloc()
43 return cret
44}
45
46var xTriangleContainsPoint func(uintptr, *Point3D) bool
47
48// Checks whether the given triangle @t contains the point @p.
49func (x *Triangle) ContainsPoint(PVar *Point3D) bool {
50
51 cret := xTriangleContainsPoint(x.GoPointer(), PVar)
52 return cret
53}
54
55var xTriangleEqual func(uintptr, *Triangle) bool
56
57// Checks whether the two given #graphene_triangle_t are equal.
58func (x *Triangle) Equal(BVar *Triangle) bool {
59
60 cret := xTriangleEqual(x.GoPointer(), BVar)
61 return cret
62}
63
64var xTriangleFree func(uintptr)
65
66// Frees the resources allocated by graphene_triangle_alloc().
67func (x *Triangle) Free() {
68
69 xTriangleFree(x.GoPointer())
70
71}
72
73var xTriangleGetArea func(uintptr) float32
74
75// Computes the area of the given #graphene_triangle_t.
76func (x *Triangle) GetArea() float32 {
77
78 cret := xTriangleGetArea(x.GoPointer())
79 return cret
80}
81
82var xTriangleGetBarycoords func(uintptr, *Point3D, *Vec2) bool
83
84// Computes the [barycentric coordinates](http://en.wikipedia.org/wiki/Barycentric_coordinate_system)
85// of the given point @p.
86//
87// The point @p must lie on the same plane as the triangle @t; if the
88// point is not coplanar, the result of this function is undefined.
89//
90// If we place the origin in the coordinates of the triangle's A point,
91// the barycentric coordinates are `u`, which is on the AC vector; and `v`
92// which is on the AB vector:
93//
94// 
95//
96// The returned #graphene_vec2_t contains the following values, in order:
97//
98// - `res.x = u`
99// - `res.y = v`
100func (x *Triangle) GetBarycoords(PVar *Point3D, ResVar *Vec2) bool {
101
102 cret := xTriangleGetBarycoords(x.GoPointer(), PVar, ResVar)
103 return cret
104}
105
106var xTriangleGetBoundingBox func(uintptr, *Box)
107
108// Computes the bounding box of the given #graphene_triangle_t.
109func (x *Triangle) GetBoundingBox(ResVar *Box) {
110
111 xTriangleGetBoundingBox(x.GoPointer(), ResVar)
112
113}
114
115var xTriangleGetMidpoint func(uintptr, *Point3D)
116
117// Computes the coordinates of the midpoint of the given #graphene_triangle_t.
118//
119// The midpoint G is the [centroid](https://en.wikipedia.org/wiki/Centroid#Triangle_centroid)
120// of the triangle, i.e. the intersection of its medians.
121func (x *Triangle) GetMidpoint(ResVar *Point3D) {
122
123 xTriangleGetMidpoint(x.GoPointer(), ResVar)
124
125}
126
127var xTriangleGetNormal func(uintptr, *Vec3)
128
129// Computes the normal vector of the given #graphene_triangle_t.
130func (x *Triangle) GetNormal(ResVar *Vec3) {
131
132 xTriangleGetNormal(x.GoPointer(), ResVar)
133
134}
135
136var xTriangleGetPlane func(uintptr, *Plane)
137
138// Computes the plane based on the vertices of the given #graphene_triangle_t.
139func (x *Triangle) GetPlane(ResVar *Plane) {
140
141 xTriangleGetPlane(x.GoPointer(), ResVar)
142
143}
144
145var xTriangleGetPoints func(uintptr, *Point3D, *Point3D, *Point3D)
146
147// Retrieves the three vertices of the given #graphene_triangle_t and returns
148// their coordinates as #graphene_point3d_t.
149func (x *Triangle) GetPoints(AVar *Point3D, BVar *Point3D, CVar *Point3D) {
150
151 xTriangleGetPoints(x.GoPointer(), AVar, BVar, CVar)
152
153}
154
155var xTriangleGetUv func(uintptr, *Point3D, *Vec2, *Vec2, *Vec2, *Vec2) bool
156
157// Computes the UV coordinates of the given point @p.
158//
159// The point @p must lie on the same plane as the triangle @t; if the point
160// is not coplanar, the result of this function is undefined. If @p is %NULL,
161// the point will be set in (0, 0, 0).
162//
163// The UV coordinates will be placed in the @res vector:
164//
165// - `res.x = u`
166// - `res.y = v`
167//
168// See also: graphene_triangle_get_barycoords()
169func (x *Triangle) GetUv(PVar *Point3D, UvAVar *Vec2, UvBVar *Vec2, UvCVar *Vec2, ResVar *Vec2) bool {
170
171 cret := xTriangleGetUv(x.GoPointer(), PVar, UvAVar, UvBVar, UvCVar, ResVar)
172 return cret
173}
174
175var xTriangleGetVertices func(uintptr, *Vec3, *Vec3, *Vec3)
176
177// Retrieves the three vertices of the given #graphene_triangle_t.
178func (x *Triangle) GetVertices(AVar *Vec3, BVar *Vec3, CVar *Vec3) {
179
180 xTriangleGetVertices(x.GoPointer(), AVar, BVar, CVar)
181
182}
183
184var xTriangleInitFromFloat func(uintptr, *[3]float32, *[3]float32, *[3]float32) *Triangle
185
186// Initializes a #graphene_triangle_t using the three given arrays
187// of floating point values, each representing the coordinates of
188// a point in 3D space.
189func (x *Triangle) InitFromFloat(AVar [3]float32, BVar [3]float32, CVar [3]float32) *Triangle {
190
191 cret := xTriangleInitFromFloat(x.GoPointer(), &AVar, &BVar, &CVar)
192 return cret
193}
194
195var xTriangleInitFromPoint3d func(uintptr, *Point3D, *Point3D, *Point3D) *Triangle
196
197// Initializes a #graphene_triangle_t using the three given 3D points.
198func (x *Triangle) InitFromPoint3d(AVar *Point3D, BVar *Point3D, CVar *Point3D) *Triangle {
199
200 cret := xTriangleInitFromPoint3d(x.GoPointer(), AVar, BVar, CVar)
201 return cret
202}
203
204var xTriangleInitFromVec3 func(uintptr, *Vec3, *Vec3, *Vec3) *Triangle
205
206// Initializes a #graphene_triangle_t using the three given vectors.
207func (x *Triangle) InitFromVec3(AVar *Vec3, BVar *Vec3, CVar *Vec3) *Triangle {
208
209 cret := xTriangleInitFromVec3(x.GoPointer(), AVar, BVar, CVar)
210 return cret
211}
212
213func init() {
214 core.SetPackageName("GRAPHENE", "graphene-gobject-1.0")
215 core.SetSharedLibraries("GRAPHENE", []string{"libgraphene-1.0.so.0"})
216 var libs []uintptr
217 for _, libPath := range core.GetPaths("GRAPHENE") {
218 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
219 if err != nil {
220 panic(err)
221 }
222 libs = append(libs, lib)
223 }
224
225 core.PuregoSafeRegister(&xTriangleGLibType, libs, "graphene_triangle_get_type")
226
227 core.PuregoSafeRegister(&xTriangleAlloc, libs, "graphene_triangle_alloc")
228
229 core.PuregoSafeRegister(&xTriangleContainsPoint, libs, "graphene_triangle_contains_point")
230 core.PuregoSafeRegister(&xTriangleEqual, libs, "graphene_triangle_equal")
231 core.PuregoSafeRegister(&xTriangleFree, libs, "graphene_triangle_free")
232 core.PuregoSafeRegister(&xTriangleGetArea, libs, "graphene_triangle_get_area")
233 core.PuregoSafeRegister(&xTriangleGetBarycoords, libs, "graphene_triangle_get_barycoords")
234 core.PuregoSafeRegister(&xTriangleGetBoundingBox, libs, "graphene_triangle_get_bounding_box")
235 core.PuregoSafeRegister(&xTriangleGetMidpoint, libs, "graphene_triangle_get_midpoint")
236 core.PuregoSafeRegister(&xTriangleGetNormal, libs, "graphene_triangle_get_normal")
237 core.PuregoSafeRegister(&xTriangleGetPlane, libs, "graphene_triangle_get_plane")
238 core.PuregoSafeRegister(&xTriangleGetPoints, libs, "graphene_triangle_get_points")
239 core.PuregoSafeRegister(&xTriangleGetUv, libs, "graphene_triangle_get_uv")
240 core.PuregoSafeRegister(&xTriangleGetVertices, libs, "graphene_triangle_get_vertices")
241 core.PuregoSafeRegister(&xTriangleInitFromFloat, libs, "graphene_triangle_init_from_float")
242 core.PuregoSafeRegister(&xTriangleInitFromPoint3d, libs, "graphene_triangle_init_from_point3d")
243 core.PuregoSafeRegister(&xTriangleInitFromVec3, libs, "graphene_triangle_init_from_vec3")
244
245}