Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.






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

Posted by SIC Games, 17 July 2014 · 335 views

Abstract Classes Interface Classes Inheritence Classes Game Engine Design Game Design Game Engine SDK
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.




November 2014 »

S M T W T F S
      1
2345678
9101112131415
16171819202122
23 242526272829
30      
PARTNERS