gamnit :: Cuboid :: defaultinit
gamnit $ Cuboid :: texture_coords
Coordinates on the texture, 2 floats per vertexgamnit $ Cuboid :: texture_coords=
Coordinates on the texture, 2 floats per vertexcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
gamnit :: Mesh :: defaultinit
gamnit :: Cuboid :: defaultinit
core :: Object :: defaultinit
gamnit :: Mesh :: dimensions
Dimensions of the bounding box containing all verticesgamnit :: Mesh :: dimensions=
Dimensions of the bounding box containing all verticesGLDrawMode
used to display this mesh, defaults to gl_TRIANGLES
gamnit :: Mesh :: indices_c=
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).gamnit :: Mesh :: texture_coords
Coordinates on the texture, 2 floats per vertexgamnit :: Mesh :: texture_coords=
Coordinates on the texture, 2 floats per vertex
# Cuboid, or rectangular prism, with 6 faces and right angles
#
# Can be created from a `Boxed3d` using `to_mesh`.
class Cuboid
super Mesh
# Width, on the X axis
var width: Float
# Height, on the Y axis
var height: Float
# Depth, on the Z axis
var depth: Float
redef var vertices is lazy do
var a = [-0.5*width, -0.5*height, -0.5*depth]
var b = [ 0.5*width, -0.5*height, -0.5*depth]
var c = [-0.5*width, 0.5*height, -0.5*depth]
var d = [ 0.5*width, 0.5*height, -0.5*depth]
var e = [-0.5*width, -0.5*height, 0.5*depth]
var f = [ 0.5*width, -0.5*height, 0.5*depth]
var g = [-0.5*width, 0.5*height, 0.5*depth]
var h = [ 0.5*width, 0.5*height, 0.5*depth]
var vertices = new Array[Float]
for v in [a, c, d, a, d, b, # front
f, h, g, f, g, e, # back
b, d, h, b, h, f, # right
e, g, c, e, c, a, # left
e, a, b, e, b, f, # bottom
c, g, h, c, h, d # top
] do vertices.add_all v
return vertices
end
redef var normals is lazy do
var normals = new Array[Float]
var faces_normals = [
[0.0, 0.0, -1.0],
[0.0, 0.0, 1.0],
[ 1.0, 0.0, 0.0],
[-1.0, 0.0, 0.0],
[0.0, -1.0, 0.0],
[0.0, 1.0, 0.0]]
for f in faces_normals do for i in 6.times do normals.add_all f
return normals
end
redef var texture_coords: Array[Float] is lazy do
var a = [0.0, 1.0]
var b = [1.0, 1.0]
var c = [0.0, 0.0]
var d = [1.0, 0.0]
var texture_coords = new Array[Float]
var face = [a, c, d, a, d, b]
for i in 6.times do for v in face do texture_coords.add_all v
return texture_coords
end
redef var center = new Point3d[Float](0.0, 0.0, 0.0) is lazy
end
lib/gamnit/depth/more_meshes.nit:82,1--145,3