gamnit $ Plane :: texture_coords
Coordinates on the texture, 2 floats per vertexgamnit $ Plane :: texture_coords=
Coordinates on the texture, 2 floats per vertexcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
gamnit :: Plane :: defaultinit
core :: Object :: defaultinit
gamnit :: Mesh :: 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
# Simple flat mesh, sits on the axes X and Z, normal on Y
class Plane
super Mesh
# TODO allow for complex rotation, either at creation or in Actor
# Modifier to `texture_coords` to repeat the texture on the X axis
#
# At 1.0, the texture is stretched to cover the whole plane.
# If greater than 1.0, the texture is repeated.
#
# This value must be set before using `texture_coords` or drawing this plane.
var repeat_x = 1.0 is writable
# Modifier to `texture_coords` to repeat the texture on the Y axis
#
# At 1.0, the texture is stretched to cover the whole plane.
# If greater than 1.0, the texture is repeated.
#
# This value must be set before using `texture_coords` or drawing this plane.
var repeat_y = 1.0 is writable
redef var vertices is lazy do
var a = [-0.5, 0.0, -0.5]
var b = [ 0.5, 0.0, -0.5]
var c = [-0.5, 0.0, 0.5]
var d = [ 0.5, 0.0, 0.5]
var vertices = new Array[Float]
for v in [c, d, a, b] do vertices.add_all v
return vertices
end
redef var normals: Array[Float] is lazy do
var normals = new Array[Float]
for i in 4.times do normals.add_all([0.0, 1.0, 0.0])
return normals
end
redef var texture_coords: Array[Float] is lazy do
var offset_left = 0.0
var offset_top = 0.0
var offset_right = 1.0*repeat_x
var offset_bottom = 1.0*repeat_y
var a = [offset_left, offset_bottom]
var b = [offset_right, offset_bottom]
var c = [offset_left, offset_top]
var d = [offset_right, offset_top]
var texture_coords = new Array[Float]
for v in [c, d, a, b] do texture_coords.add_all v
return texture_coords
end
redef var center = new Point3d[Float](0.0, 0.0, 0.0) is lazy
init do indices.add_all([0, 1, 2, 2, 1, 3])
# TODO use gl_TRIANGLE_FAN instead
end
lib/gamnit/depth/more_meshes.nit:22,1--80,3