-
Notifications
You must be signed in to change notification settings - Fork 2
/
typegen.go
265 lines (188 loc) · 15.3 KB
/
typegen.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
// Code generated by "core generate -add-types"; DO NOT EDIT.
package eve
import (
"cogentcore.org/core/math32"
"cogentcore.org/core/tree"
"cogentcore.org/core/types"
)
var _ = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.BBox", IDName: "b-box", Doc: "BBox contains bounding box and other gross object properties", Fields: []types.Field{{Name: "BBox", Doc: "bounding box in world coords (Axis-Aligned Bounding Box = AABB)"}, {Name: "VelBBox", Doc: "velocity-projected bounding box in world coords: extend BBox to include future position of moving bodies -- collision must be made on this basis"}, {Name: "BSphere", Doc: "bounding sphere in local coords"}, {Name: "Area", Doc: "area"}, {Name: "Volume", Doc: "volume"}}})
var _ = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.Body", IDName: "body", Doc: "Body is the common interface for all body types"})
// BodyBaseType is the [types.Type] for [BodyBase]
var BodyBaseType = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.BodyBase", IDName: "body-base", Doc: "BodyBase is the base type for all specific Body types", Embeds: []types.Field{{Name: "NodeBase"}}, Fields: []types.Field{{Name: "Rigid", Doc: "rigid body properties, including mass, bounce, friction etc"}, {Name: "Vis", Doc: "visualization name -- looks up an entry in the scene library that provides the visual representation of this body"}, {Name: "Color", Doc: "default color of body for basic InitLibrary configuration"}}, Instance: &BodyBase{}})
// NewBodyBase adds a new [BodyBase] with the given name to the given parent:
// BodyBase is the base type for all specific Body types
func NewBodyBase(parent tree.Node, name ...string) *BodyBase {
return parent.NewChild(BodyBaseType, name...).(*BodyBase)
}
// NodeType returns the [*types.Type] of [BodyBase]
func (t *BodyBase) NodeType() *types.Type { return BodyBaseType }
// New returns a new [*BodyBase] value
func (t *BodyBase) New() tree.Node { return &BodyBase{} }
// SetRigid sets the [BodyBase.Rigid]:
// rigid body properties, including mass, bounce, friction etc
func (t *BodyBase) SetRigid(v Rigid) *BodyBase { t.Rigid = v; return t }
// SetVis sets the [BodyBase.Vis]:
// visualization name -- looks up an entry in the scene library that provides the visual representation of this body
func (t *BodyBase) SetVis(v string) *BodyBase { t.Vis = v; return t }
// SetColor sets the [BodyBase.Color]:
// default color of body for basic InitLibrary configuration
func (t *BodyBase) SetColor(v string) *BodyBase { t.Color = v; return t }
// SetInitial sets the [BodyBase.Initial]
func (t *BodyBase) SetInitial(v Phys) *BodyBase { t.Initial = v; return t }
// SetRel sets the [BodyBase.Rel]
func (t *BodyBase) SetRel(v Phys) *BodyBase { t.Rel = v; return t }
// BoxType is the [types.Type] for [Box]
var BoxType = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.Box", IDName: "box", Doc: "Box is a box body shape", Embeds: []types.Field{{Name: "BodyBase"}}, Fields: []types.Field{{Name: "Size", Doc: "size of box in each dimension (units arbitrary, as long as they are all consistent -- meters is typical)"}}, Instance: &Box{}})
// NewBox adds a new [Box] with the given name to the given parent:
// Box is a box body shape
func NewBox(parent tree.Node, name ...string) *Box {
return parent.NewChild(BoxType, name...).(*Box)
}
// NodeType returns the [*types.Type] of [Box]
func (t *Box) NodeType() *types.Type { return BoxType }
// New returns a new [*Box] value
func (t *Box) New() tree.Node { return &Box{} }
// SetSize sets the [Box.Size]:
// size of box in each dimension (units arbitrary, as long as they are all consistent -- meters is typical)
func (t *Box) SetSize(v math32.Vector3) *Box { t.Size = v; return t }
// SetInitial sets the [Box.Initial]
func (t *Box) SetInitial(v Phys) *Box { t.Initial = v; return t }
// SetRel sets the [Box.Rel]
func (t *Box) SetRel(v Phys) *Box { t.Rel = v; return t }
// SetRigid sets the [Box.Rigid]
func (t *Box) SetRigid(v Rigid) *Box { t.Rigid = v; return t }
// SetVis sets the [Box.Vis]
func (t *Box) SetVis(v string) *Box { t.Vis = v; return t }
// SetColor sets the [Box.Color]
func (t *Box) SetColor(v string) *Box { t.Color = v; return t }
// CapsuleType is the [types.Type] for [Capsule]
var CapsuleType = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.Capsule", IDName: "capsule", Doc: "Capsule is a generalized cylinder body shape, with hemispheres at each end,\nwith separate radii for top and bottom.", Embeds: []types.Field{{Name: "BodyBase"}}, Fields: []types.Field{{Name: "Height", Doc: "height of the cylinder portion of the capsule"}, {Name: "TopRad", Doc: "radius of the top hemisphere"}, {Name: "BotRad", Doc: "radius of the bottom hemisphere"}}, Instance: &Capsule{}})
// NewCapsule adds a new [Capsule] with the given name to the given parent:
// Capsule is a generalized cylinder body shape, with hemispheres at each end,
// with separate radii for top and bottom.
func NewCapsule(parent tree.Node, name ...string) *Capsule {
return parent.NewChild(CapsuleType, name...).(*Capsule)
}
// NodeType returns the [*types.Type] of [Capsule]
func (t *Capsule) NodeType() *types.Type { return CapsuleType }
// New returns a new [*Capsule] value
func (t *Capsule) New() tree.Node { return &Capsule{} }
// SetHeight sets the [Capsule.Height]:
// height of the cylinder portion of the capsule
func (t *Capsule) SetHeight(v float32) *Capsule { t.Height = v; return t }
// SetTopRad sets the [Capsule.TopRad]:
// radius of the top hemisphere
func (t *Capsule) SetTopRad(v float32) *Capsule { t.TopRad = v; return t }
// SetBotRad sets the [Capsule.BotRad]:
// radius of the bottom hemisphere
func (t *Capsule) SetBotRad(v float32) *Capsule { t.BotRad = v; return t }
// SetInitial sets the [Capsule.Initial]
func (t *Capsule) SetInitial(v Phys) *Capsule { t.Initial = v; return t }
// SetRel sets the [Capsule.Rel]
func (t *Capsule) SetRel(v Phys) *Capsule { t.Rel = v; return t }
// SetRigid sets the [Capsule.Rigid]
func (t *Capsule) SetRigid(v Rigid) *Capsule { t.Rigid = v; return t }
// SetVis sets the [Capsule.Vis]
func (t *Capsule) SetVis(v string) *Capsule { t.Vis = v; return t }
// SetColor sets the [Capsule.Color]
func (t *Capsule) SetColor(v string) *Capsule { t.Color = v; return t }
var _ = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.Contact", IDName: "contact", Doc: "Contact is one pairwise point of contact between two bodies.\nContacts are represented in spherical terms relative to the\nspherical BBox of A and B.", Fields: []types.Field{{Name: "A", Doc: "one body"}, {Name: "B", Doc: "the other body"}, {Name: "NormB", Doc: "normal pointing from center of B to center of A"}, {Name: "PtB", Doc: "point on spherical shell of B where A is contacting"}, {Name: "Dist", Doc: "distance from PtB along NormB to contact point on spherical shell of A"}}})
var _ = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.Contacts", IDName: "contacts", Doc: "Contacts is a slice list of contacts"})
// CylinderType is the [types.Type] for [Cylinder]
var CylinderType = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.Cylinder", IDName: "cylinder", Doc: "Cylinder is a generalized cylinder body shape, with separate radii for top and bottom.\nA cone has a zero radius at one end.", Embeds: []types.Field{{Name: "BodyBase"}}, Fields: []types.Field{{Name: "Height", Doc: "height of the cylinder"}, {Name: "TopRad", Doc: "radius of the top -- set to 0 for a cone"}, {Name: "BotRad", Doc: "radius of the bottom"}}, Instance: &Cylinder{}})
// NewCylinder adds a new [Cylinder] with the given name to the given parent:
// Cylinder is a generalized cylinder body shape, with separate radii for top and bottom.
// A cone has a zero radius at one end.
func NewCylinder(parent tree.Node, name ...string) *Cylinder {
return parent.NewChild(CylinderType, name...).(*Cylinder)
}
// NodeType returns the [*types.Type] of [Cylinder]
func (t *Cylinder) NodeType() *types.Type { return CylinderType }
// New returns a new [*Cylinder] value
func (t *Cylinder) New() tree.Node { return &Cylinder{} }
// SetHeight sets the [Cylinder.Height]:
// height of the cylinder
func (t *Cylinder) SetHeight(v float32) *Cylinder { t.Height = v; return t }
// SetTopRad sets the [Cylinder.TopRad]:
// radius of the top -- set to 0 for a cone
func (t *Cylinder) SetTopRad(v float32) *Cylinder { t.TopRad = v; return t }
// SetBotRad sets the [Cylinder.BotRad]:
// radius of the bottom
func (t *Cylinder) SetBotRad(v float32) *Cylinder { t.BotRad = v; return t }
// SetInitial sets the [Cylinder.Initial]
func (t *Cylinder) SetInitial(v Phys) *Cylinder { t.Initial = v; return t }
// SetRel sets the [Cylinder.Rel]
func (t *Cylinder) SetRel(v Phys) *Cylinder { t.Rel = v; return t }
// SetRigid sets the [Cylinder.Rigid]
func (t *Cylinder) SetRigid(v Rigid) *Cylinder { t.Rigid = v; return t }
// SetVis sets the [Cylinder.Vis]
func (t *Cylinder) SetVis(v string) *Cylinder { t.Vis = v; return t }
// SetColor sets the [Cylinder.Color]
func (t *Cylinder) SetColor(v string) *Cylinder { t.Color = v; return t }
// GroupType is the [types.Type] for [Group]
var GroupType = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.Group", IDName: "group", Doc: "Group is a container of bodies, joints, or other groups\nit should be used strategically to partition the space\nand its BBox is used to optimize tree-based collision detection.\nUse a group for the top-level World node as well.", Embeds: []types.Field{{Name: "NodeBase"}}, Instance: &Group{}})
// NewGroup adds a new [Group] with the given name to the given parent:
// Group is a container of bodies, joints, or other groups
// it should be used strategically to partition the space
// and its BBox is used to optimize tree-based collision detection.
// Use a group for the top-level World node as well.
func NewGroup(parent tree.Node, name ...string) *Group {
return parent.NewChild(GroupType, name...).(*Group)
}
// NodeType returns the [*types.Type] of [Group]
func (t *Group) NodeType() *types.Type { return GroupType }
// New returns a new [*Group] value
func (t *Group) New() tree.Node { return &Group{} }
// SetInitial sets the [Group.Initial]
func (t *Group) SetInitial(v Phys) *Group { t.Initial = v; return t }
// SetRel sets the [Group.Rel]
func (t *Group) SetRel(v Phys) *Group { t.Rel = v; return t }
var _ = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.BodyPoint", IDName: "body-point", Doc: "BodyPoint contains a Body and a Point on that body", Fields: []types.Field{{Name: "Body"}, {Name: "Point"}}})
var _ = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.Node", IDName: "node", Doc: "Node is the common interface for all eve nodes"})
// NodeBaseType is the [types.Type] for [NodeBase]
var NodeBaseType = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.NodeBase", IDName: "node-base", Doc: "NodeBase is the basic eve node, which has position, rotation, velocity\nand computed bounding boxes, etc.\nThere are only three different kinds of Nodes: Group, Body, and Joint", Embeds: []types.Field{{Name: "NodeBase"}}, Fields: []types.Field{{Name: "Initial", Doc: "initial position, orientation, velocity in *local* coordinates (relative to parent)"}, {Name: "Rel", Doc: "current relative (local) position, orientation, velocity -- only change these values, as abs values are computed therefrom"}, {Name: "Abs", Doc: "current absolute (world) position, orientation, velocity"}, {Name: "BBox", Doc: "bounding box in world coordinates (aggregated for groups)"}}, Instance: &NodeBase{}})
// NewNodeBase adds a new [NodeBase] with the given name to the given parent:
// NodeBase is the basic eve node, which has position, rotation, velocity
// and computed bounding boxes, etc.
// There are only three different kinds of Nodes: Group, Body, and Joint
func NewNodeBase(parent tree.Node, name ...string) *NodeBase {
return parent.NewChild(NodeBaseType, name...).(*NodeBase)
}
// NodeType returns the [*types.Type] of [NodeBase]
func (t *NodeBase) NodeType() *types.Type { return NodeBaseType }
// New returns a new [*NodeBase] value
func (t *NodeBase) New() tree.Node { return &NodeBase{} }
// SetInitial sets the [NodeBase.Initial]:
// initial position, orientation, velocity in *local* coordinates (relative to parent)
func (t *NodeBase) SetInitial(v Phys) *NodeBase { t.Initial = v; return t }
// SetRel sets the [NodeBase.Rel]:
// current relative (local) position, orientation, velocity -- only change these values, as abs values are computed therefrom
func (t *NodeBase) SetRel(v Phys) *NodeBase { t.Rel = v; return t }
var _ = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.NodeTypes", IDName: "node-types", Doc: "NodeTypes is a list of node types"})
var _ = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.NodeFlags", IDName: "node-flags", Doc: "NodeFlags define eve node bitflags -- uses ki Flags field (64 bit capacity)"})
var _ = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.Phys", IDName: "phys", Doc: "Phys contains the basic physical properties including position, orientation, velocity.\nThese are only the values that can be either relative or absolute -- other physical\nstate values such as Mass should go in Rigid.", Fields: []types.Field{{Name: "Pos", Doc: "position of center of mass of object"}, {Name: "Quat", Doc: "rotation specified as a Quat"}, {Name: "LinVel", Doc: "linear velocity"}, {Name: "AngVel", Doc: "angular velocity"}}})
var _ = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.Rigid", IDName: "rigid", Doc: "Rigid contains the full specification of a given object's basic physics\nproperties including position, orientation, velocity. These", Fields: []types.Field{{Name: "InvMass", Doc: "1/mass -- 0 for no mass"}, {Name: "Bounce", Doc: "COR or coefficient of restitution -- how elastic is the collision i.e., final velocity / initial velocity"}, {Name: "Friction", Doc: "friction coefficient -- how much friction is generated by transverse motion"}, {Name: "Force", Doc: "record of computed force vector from last iteration"}, {Name: "RotInertia", Doc: "Last calculated rotational inertia matrix in local coords"}}})
// SphereType is the [types.Type] for [Sphere]
var SphereType = types.AddType(&types.Type{Name: "github.com/emer/eve/v2/eve.Sphere", IDName: "sphere", Doc: "Sphere is a spherical body shape.", Embeds: []types.Field{{Name: "BodyBase"}}, Fields: []types.Field{{Name: "Radius", Doc: "radius"}}, Instance: &Sphere{}})
// NewSphere adds a new [Sphere] with the given name to the given parent:
// Sphere is a spherical body shape.
func NewSphere(parent tree.Node, name ...string) *Sphere {
return parent.NewChild(SphereType, name...).(*Sphere)
}
// NodeType returns the [*types.Type] of [Sphere]
func (t *Sphere) NodeType() *types.Type { return SphereType }
// New returns a new [*Sphere] value
func (t *Sphere) New() tree.Node { return &Sphere{} }
// SetRadius sets the [Sphere.Radius]:
// radius
func (t *Sphere) SetRadius(v float32) *Sphere { t.Radius = v; return t }
// SetInitial sets the [Sphere.Initial]
func (t *Sphere) SetInitial(v Phys) *Sphere { t.Initial = v; return t }
// SetRel sets the [Sphere.Rel]
func (t *Sphere) SetRel(v Phys) *Sphere { t.Rel = v; return t }
// SetRigid sets the [Sphere.Rigid]
func (t *Sphere) SetRigid(v Rigid) *Sphere { t.Rigid = v; return t }
// SetVis sets the [Sphere.Vis]
func (t *Sphere) SetVis(v string) *Sphere { t.Vis = v; return t }
// SetColor sets the [Sphere.Color]
func (t *Sphere) SetColor(v string) *Sphere { t.Color = v; return t }