Jump to content

- - - - -

Another great way to reduce my insantiy with interfaces...

Abstract Classes Interface Classes Inheritence Classes Game Engine Design Game Design Game Engine SDK
4: Adsense

Upon revising the engine's SDK - I finally understood how powerful creating interfaces can truely be! Say inside the level editor the grid outline outputs color - the skybox outputs texture data - meshes output a material shader and billboards output with a geometry shader.

This is where the beauty comes in play.
//-- ShaderSystem.h

//-- Base
struct Shader {

virtual bool CompileShader(ID3D11Device *device, const wchar_t* filename) = 0; 

ID3D11VertexShader *vertexShader;
ID3D11PixelShader *pixelShader;
ID3D11GeometryShader *geometryShader;
ID3D11ComputeShader *computeShader;
ID3D11DomainShader *domainShader:
ID3D11HullShader *hullShader;
ID3D11InputLayout *inputLayout;


//-- ColorShader.h
#include "ShaderSystem.h"

struct ColorShader : public Shader {

bool CompileShader(ID3D11Device *device, const wchar_t *filename) {
//-- Compile Shader.
return true;

and so on with other shaders that I have to work on that may have different elements in the inputlayout e.g. instance data and alike.

I'm still going through a lot of code to see how I can make a lot more readible and less confusing. My original code for the engine was very very confusing and there was a lot of stuff I had to learn before I got to where I am today. This forum actually helped me through a lot of the messy hiccups - amongst reading up new materials.

I'm getting there than I had the year I signed up on here. I don't remember when I singed up here but it was a couple years ago I believe. So I can apply this knowledge to my in-house game engine even more.

Note: GameDev.net moderates comments.