programs in folder learnOpenGL2_pFinal

After following all the parts of the LearnOpenGL.com site a new final part is added with a rewrite of some of the code. Most of the code in this final project is MIT-licened (the code in previous files are licenened by Joey de Vries).

some changes and new classes

VertexObjects.ts

The VertexObjects class now has a buffers array. The Cube, Quad and Sphere classes are now written with the vertices as buffers[0] and the indices as buffers[1].

Drawable.ts

A DrawObject has all the information needed to draw itself. It is a combination of vertex data and material data. A DrawMesh has a number of DrawObjects. A DrawModel has a number of DrawMeshes and is used for sharing buffers and textures between the DrawMeshes.

GlDrawable.ts

In this file we have the GlManager object. It is used to create the OpenGL objects corresponding to draw objects, for instance it has the code to create a GlDrawObject from a DrawObject in the method createGlDrawObject(drawObject: DrawObject): GlDrawObject.

The generation of GL-textures and GL-buffers is always done with routines in this file.

Material.ts

contains the classes Texture, Material, TexturedMaterial, Pbr0Material and CubeMapMaterial.

Gltf

GltfModel and GltfMaterial have been rewritten so that only when a model is loaded we need to import

After the import we only need to reference classes from Drawable.ts and Material.ts.

GlManager

In the subdirectory /gl the OpenGL functions are called. GlManager is responsible to create and draw a GlDrawModel and a GlCubeMap. It also has a reference to a Shaders object. The Shaders object is used to create all kinds of shaders for the corresponding materials. For instance Shaders.getShader("pbr0") gets a Pbr0Shader object (if it is not already in the shaders collection it will create one).

ImageLoader

loads images. Used for the images of a cubemap.

Gltf

We now first load the nodes in a scene and then link the meshes of the model to these nodes. This seems to be the right path: first load things and then link them. We want to do the same with the materials: load them first and in a nest step link the primitives to the materials. Or for rigid animations first load the nodes, then the animations and then link the animations to the nodes. By now the code in the Gltf files are already a mess, so a complete rewrite is in place.

the programs in this Final part.

load_gltf_waterbottle.ts

A rewrite of a program in Part6, chapter ChGltf

load_environment.ts

Creates a textured cubemap for use as an environment. For the theory see Part4, chapter 27 and also Part6.

load_combi.ts

a combination of a model and an environment.


date: 24 juli 2020. version: 0.95.
code found at: github.com/d3q3/LearnOpenGl
©Drikus Kleefsman