forked from g3n/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shape.go
37 lines (29 loc) · 932 Bytes
/
shape.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
// Copyright 2016 The G3N Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package shape
import "github.com/g3n/engine/math32"
// IShape is the interface for all collision shapes.
// Shapes in this package satisfy this interface and also geometry.Geometry.
type IShape interface {
BoundingBox() math32.Box3
BoundingSphere() math32.Sphere
Area() float32
Volume() float32
RotationalInertia(mass float32) math32.Matrix3
ProjectOntoAxis(localAxis *math32.Vector3) (float32, float32)
}
// Shape is a collision shape.
// It can be an analytical geometry such as a sphere, plane, etc.. or it can be defined by a polygonal Geometry.
type Shape struct {
// TODO
//material
// Collision filtering
colFilterGroup int
colFilterMask int
}
func (s *Shape) initialize() {
// Collision filtering
s.colFilterGroup = 1
s.colFilterMask = -1
}