-
Notifications
You must be signed in to change notification settings - Fork 0
/
vertex_weight.go
55 lines (47 loc) · 1.13 KB
/
vertex_weight.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
package common
import "github.com/gorustyt/go-assimp/common/pb_msg"
type AiVertexWeight struct {
//! Index of the vertex which is influenced by the bone.
VertexId uint32
//! The strength of the influence in the range (0...1).
//! The influence from all bones at one vertex amounts to 1.
Weight float32
}
func (ai *AiVertexWeight) FromPbMsg(p *pb_msg.AiVertexWeight) *AiVertexWeight {
if p == nil {
return nil
}
ai.VertexId = p.VertexId
ai.Weight = p.Weight
return ai
}
func (ai *AiVertexWeight) Clone() *AiVertexWeight {
if ai == nil {
return nil
}
tmp := *ai
return &tmp
}
func (ai *AiVertexWeight) ToPbMsg() *pb_msg.AiVertexWeight {
if ai == nil {
return nil
}
return &pb_msg.AiVertexWeight{
VertexId: ai.VertexId,
Weight: ai.Weight,
}
}
func (ai *AiVertexWeight) BoundMin(b *AiVertexWeight) *AiVertexWeight {
v := &AiVertexWeight{
VertexId: Min(ai.VertexId, b.VertexId),
Weight: Min(ai.Weight, b.Weight),
}
return v
}
func (ai *AiVertexWeight) BoundMax(a, b *AiVertexWeight) *AiVertexWeight {
v := &AiVertexWeight{
VertexId: Max(ai.VertexId, b.VertexId),
Weight: Max(ai.Weight, b.Weight),
}
return v
}