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 ray emitted from an origin in a given direction.
15//
16// The contents of the `graphene_ray_t` structure are private, and should not
17// be modified directly.
18type Ray struct {
19 _ structs.HostLayout
20
21 Origin uintptr
22
23 Direction uintptr
24}
25
26var xRayGLibType func() types.GType
27
28func RayGLibType() types.GType {
29 return xRayGLibType()
30}
31
32func (x *Ray) GoPointer() uintptr {
33 return uintptr(unsafe.Pointer(x))
34}
35
36var xRayAlloc func() *Ray
37
38// Allocates a new #graphene_ray_t structure.
39//
40// The contents of the returned structure are undefined.
41func RayAlloc() *Ray {
42
43 cret := xRayAlloc()
44 return cret
45}
46
47var xRayEqual func(uintptr, *Ray) bool
48
49// Checks whether the two given #graphene_ray_t are equal.
50func (x *Ray) Equal(BVar *Ray) bool {
51
52 cret := xRayEqual(x.GoPointer(), BVar)
53 return cret
54}
55
56var xRayFree func(uintptr)
57
58// Frees the resources allocated by graphene_ray_alloc().
59func (x *Ray) Free() {
60
61 xRayFree(x.GoPointer())
62
63}
64
65var xRayGetClosestPointToPoint func(uintptr, *Point3D, *Point3D)
66
67// Computes the point on the given #graphene_ray_t that is closest to the
68// given point @p.
69func (x *Ray) GetClosestPointToPoint(PVar *Point3D, ResVar *Point3D) {
70
71 xRayGetClosestPointToPoint(x.GoPointer(), PVar, ResVar)
72
73}
74
75var xRayGetDirection func(uintptr, *Vec3)
76
77// Retrieves the direction of the given #graphene_ray_t.
78func (x *Ray) GetDirection(DirectionVar *Vec3) {
79
80 xRayGetDirection(x.GoPointer(), DirectionVar)
81
82}
83
84var xRayGetDistanceToPlane func(uintptr, *Plane) float32
85
86// Computes the distance of the origin of the given #graphene_ray_t from the
87// given plane.
88//
89// If the ray does not intersect the plane, this function returns `INFINITY`.
90func (x *Ray) GetDistanceToPlane(PVar *Plane) float32 {
91
92 cret := xRayGetDistanceToPlane(x.GoPointer(), PVar)
93 return cret
94}
95
96var xRayGetDistanceToPoint func(uintptr, *Point3D) float32
97
98// Computes the distance of the closest approach between the
99// given #graphene_ray_t @r and the point @p.
100//
101// The closest approach to a ray from a point is the distance
102// between the point and the projection of the point on the
103// ray itself.
104func (x *Ray) GetDistanceToPoint(PVar *Point3D) float32 {
105
106 cret := xRayGetDistanceToPoint(x.GoPointer(), PVar)
107 return cret
108}
109
110var xRayGetOrigin func(uintptr, *Point3D)
111
112// Retrieves the origin of the given #graphene_ray_t.
113func (x *Ray) GetOrigin(OriginVar *Point3D) {
114
115 xRayGetOrigin(x.GoPointer(), OriginVar)
116
117}
118
119var xRayGetPositionAt func(uintptr, float32, *Point3D)
120
121// Retrieves the coordinates of a point at the distance @t along the
122// given #graphene_ray_t.
123func (x *Ray) GetPositionAt(TVar float32, PositionVar *Point3D) {
124
125 xRayGetPositionAt(x.GoPointer(), TVar, PositionVar)
126
127}
128
129var xRayInit func(uintptr, *Point3D, *Vec3) *Ray
130
131// Initializes the given #graphene_ray_t using the given @origin
132// and @direction values.
133func (x *Ray) Init(OriginVar *Point3D, DirectionVar *Vec3) *Ray {
134
135 cret := xRayInit(x.GoPointer(), OriginVar, DirectionVar)
136 return cret
137}
138
139var xRayInitFromRay func(uintptr, *Ray) *Ray
140
141// Initializes the given #graphene_ray_t using the origin and direction
142// values of another #graphene_ray_t.
143func (x *Ray) InitFromRay(SrcVar *Ray) *Ray {
144
145 cret := xRayInitFromRay(x.GoPointer(), SrcVar)
146 return cret
147}
148
149var xRayInitFromVec3 func(uintptr, *Vec3, *Vec3) *Ray
150
151// Initializes the given #graphene_ray_t using the given vectors.
152func (x *Ray) InitFromVec3(OriginVar *Vec3, DirectionVar *Vec3) *Ray {
153
154 cret := xRayInitFromVec3(x.GoPointer(), OriginVar, DirectionVar)
155 return cret
156}
157
158var xRayIntersectBox func(uintptr, *Box, *float32) RayIntersectionKind
159
160// Intersects the given #graphene_ray_t @r with the given
161// #graphene_box_t @b.
162func (x *Ray) IntersectBox(BVar *Box, TOutVar *float32) RayIntersectionKind {
163
164 cret := xRayIntersectBox(x.GoPointer(), BVar, TOutVar)
165 return cret
166}
167
168var xRayIntersectSphere func(uintptr, *Sphere, *float32) RayIntersectionKind
169
170// Intersects the given #graphene_ray_t @r with the given
171// #graphene_sphere_t @s.
172func (x *Ray) IntersectSphere(SVar *Sphere, TOutVar *float32) RayIntersectionKind {
173
174 cret := xRayIntersectSphere(x.GoPointer(), SVar, TOutVar)
175 return cret
176}
177
178var xRayIntersectTriangle func(uintptr, *Triangle, *float32) RayIntersectionKind
179
180// Intersects the given #graphene_ray_t @r with the given
181// #graphene_triangle_t @t.
182func (x *Ray) IntersectTriangle(TVar *Triangle, TOutVar *float32) RayIntersectionKind {
183
184 cret := xRayIntersectTriangle(x.GoPointer(), TVar, TOutVar)
185 return cret
186}
187
188var xRayIntersectsBox func(uintptr, *Box) bool
189
190// Checks whether the given #graphene_ray_t @r intersects the
191// given #graphene_box_t @b.
192//
193// See also: graphene_ray_intersect_box()
194func (x *Ray) IntersectsBox(BVar *Box) bool {
195
196 cret := xRayIntersectsBox(x.GoPointer(), BVar)
197 return cret
198}
199
200var xRayIntersectsSphere func(uintptr, *Sphere) bool
201
202// Checks if the given #graphene_ray_t @r intersects the
203// given #graphene_sphere_t @s.
204//
205// See also: graphene_ray_intersect_sphere()
206func (x *Ray) IntersectsSphere(SVar *Sphere) bool {
207
208 cret := xRayIntersectsSphere(x.GoPointer(), SVar)
209 return cret
210}
211
212var xRayIntersectsTriangle func(uintptr, *Triangle) bool
213
214// Checks whether the given #graphene_ray_t @r intersects the
215// given #graphene_triangle_t @b.
216//
217// See also: graphene_ray_intersect_triangle()
218func (x *Ray) IntersectsTriangle(TVar *Triangle) bool {
219
220 cret := xRayIntersectsTriangle(x.GoPointer(), TVar)
221 return cret
222}
223
224// The type of intersection.
225type RayIntersectionKind int
226
227const (
228
229 // No intersection
230 RayIntersectionKindNoneValue RayIntersectionKind = 0
231 // The ray is entering the intersected
232 // object
233 RayIntersectionKindEnterValue RayIntersectionKind = 1
234 // The ray is leaving the intersected
235 // object
236 RayIntersectionKindLeaveValue RayIntersectionKind = 2
237)
238
239func init() {
240 core.SetPackageName("GRAPHENE", "graphene-gobject-1.0")
241 core.SetSharedLibraries("GRAPHENE", []string{"libgraphene-1.0.so.0"})
242 var libs []uintptr
243 for _, libPath := range core.GetPaths("GRAPHENE") {
244 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
245 if err != nil {
246 panic(err)
247 }
248 libs = append(libs, lib)
249 }
250
251 core.PuregoSafeRegister(&xRayGLibType, libs, "graphene_ray_get_type")
252
253 core.PuregoSafeRegister(&xRayAlloc, libs, "graphene_ray_alloc")
254
255 core.PuregoSafeRegister(&xRayEqual, libs, "graphene_ray_equal")
256 core.PuregoSafeRegister(&xRayFree, libs, "graphene_ray_free")
257 core.PuregoSafeRegister(&xRayGetClosestPointToPoint, libs, "graphene_ray_get_closest_point_to_point")
258 core.PuregoSafeRegister(&xRayGetDirection, libs, "graphene_ray_get_direction")
259 core.PuregoSafeRegister(&xRayGetDistanceToPlane, libs, "graphene_ray_get_distance_to_plane")
260 core.PuregoSafeRegister(&xRayGetDistanceToPoint, libs, "graphene_ray_get_distance_to_point")
261 core.PuregoSafeRegister(&xRayGetOrigin, libs, "graphene_ray_get_origin")
262 core.PuregoSafeRegister(&xRayGetPositionAt, libs, "graphene_ray_get_position_at")
263 core.PuregoSafeRegister(&xRayInit, libs, "graphene_ray_init")
264 core.PuregoSafeRegister(&xRayInitFromRay, libs, "graphene_ray_init_from_ray")
265 core.PuregoSafeRegister(&xRayInitFromVec3, libs, "graphene_ray_init_from_vec3")
266 core.PuregoSafeRegister(&xRayIntersectBox, libs, "graphene_ray_intersect_box")
267 core.PuregoSafeRegister(&xRayIntersectSphere, libs, "graphene_ray_intersect_sphere")
268 core.PuregoSafeRegister(&xRayIntersectTriangle, libs, "graphene_ray_intersect_triangle")
269 core.PuregoSafeRegister(&xRayIntersectsBox, libs, "graphene_ray_intersects_box")
270 core.PuregoSafeRegister(&xRayIntersectsSphere, libs, "graphene_ray_intersects_sphere")
271 core.PuregoSafeRegister(&xRayIntersectsTriangle, libs, "graphene_ray_intersects_triangle")
272
273}