class Prism::Model
- Prism::Model
- Reference
- Object
Overview
Represents a 3d model that has been loaded into opengl.
Defined in:
prism/model/loader.crprism/model/model.cr
Constructors
-
.new(vao_id : LibGL::UInt, vbos : Array(LibGL::UInt), vertex_count : Int32, num_attrib_arrays : Int32)
Creates a new model The vao_id is the vertex array object id.
Class Method Summary
-
.load(vertices : Array(Float32), texture_coords : Array(Float32), normals : Array(Float32), indicies : Array(Int32)) : Prism::Model
Loads some raw data into open gl and returns a model object that can be used for drawing.
-
.load(file_name : String) : Prism::Model
Loads an OBJ file into opengl and returns a model object that can be used for drawing.
- .load(data : ModelData) : Prism::Model
-
.load_2f(vertices : Array(Float32))
Loads some 2d vertices into a model.
-
.load_3f(vertices : Array(Float32))
Loads some 3d vertices into a model.
Instance Method Summary
- #bind
-
#draw
Convenience method to draw the model.
-
#finalize
Deletes the vertex array and buffers durring garbage collection.
- #unbind
- #vao_id : UInt32
- #vertex_count : Int32
Constructor Detail
Creates a new model The vao_id is the vertex array object id. the vbos are just an array of vertex buffers that should be deleted when the object is garbage collected. The vertex_count is how many verticies are in the model. the num_attrib_arrays indicates how many vertex attribute arrays need to be used.
Class Method Detail
Loads some raw data into open gl and returns a model object that can be used for drawing. This is designed to load 3d vertices
Loads an OBJ file into opengl and returns a model object that can be used for drawing.
Loads some 2d vertices into a model. This is useful for creating models for the GUI