Skip navigation

File Link(.exe)


Click Me

Objective


This assignment requires me to draw a rectangle with indices. Also it wants me to replace the hard-coded shader loading with materials that based on Lua.

Colored Rectangle


rectangle

This is what my rectangle looks like, thank for my artist friend helped me to pick the colors again.

Capture1 Capture2

The difference between this and last assignment is I used indices to draw the triangles. Basically the index indicate the position in the vertex buffer. With the index we don’t have to put each vertices of each triangles into the buffer, which will save a lot of memory when we have a huge number of triangles to draw.

Materials 


Instead of loading shader files in hard coding, the assignment wants me to add materials to load it dynamically. When the game is loading the shader files, it will firstly go to ask Lua engine to load a material file, and the material file contains the information about what vertex shader and pixel shader should be loaded. This is what my material file looks like.

Material

Besides the paths of the shaders, it has other information to describe the material, such as name and color. I put a parent property for the material because I want a new material can be built based on the other material that we already have.  If the child material doesn’t declare a required property, it will automatically use the parent version as default.

I will add more options to the materials. The texture should be a texture array for supporting multiple textures, more properties need to be added to describe features such as reflection and opacity.

time estimation


Reading and searching — 1 h
Setting up solution / Coding / Debugging — 2.5 h
Bug Fixing — 0.5 h
Writing blog — 1 h
Total — 5 h

Leave a Reply