Looks fancy Chuck, for now, I'm going to leave my shader as a one trick pony and only use instanced drawing.
I think, using only 2d for now, most of my stuff is going to be instanced geometry, or a couple very small differences. Right now, I'm going to focus on getting this thing to work dynamically and take input, I want to be able to move the instanced squares around using input.
That, along with generally scrubbing my code and adding in error handling and things of that nature.
I also need to figure out how my Renderable_Object class will come into play now that there is only one copy of the vertices on hand at a given time due to instancing...
Right now I have a class renderable object that is storing vertex information, as well as other various bits of info, such as position, velocity, min and max values, etc.. Now with instancing, I only need 1 copy of vertex data and many copies of position and velocity data. I had this setup previously in opengl and have since lost it. Oh well, onward I go!
class Renderable_Object
{
public:
Renderable_Object(float minX, float minY, float maxX, float maxY)
{
d_min.x = minX;
d_min.y = minY;
d_max.x = maxX;
d_max.y = maxY;
/*
position.x = posX;
position.y = posY;
velocity.x = 0;
velocity.y = 0;
isVisible = visible;
isPhysical = physical;
*/
Vertex OurVertices[] =
{
{ D3DXVECTOR2(maxX, maxY), D3DXCOLOR(1.0f, 0.0f, 0.0f, 1.0f) },
{ D3DXVECTOR2(maxX, minY), D3DXCOLOR(0.0f, 1.0f, 0.0f, 1.0f) },
{ D3DXVECTOR2(minX, minY), D3DXCOLOR(0.0f, 0.0f, 1.0f, 1.0f) },
{ D3DXVECTOR2(minX, minY), D3DXCOLOR(1.0f, 0.0f, 0.0f, 1.0f) },
{ D3DXVECTOR2(minX, maxY), D3DXCOLOR(0.0f, 1.0f, 0.0f, 1.0f) },
{ D3DXVECTOR2(maxX, maxY), D3DXCOLOR(0.0f, 0.0f, 1.0f, 1.0f) }
};
for (int i = 0; i < 6; i++)
{
Vertices.push_back(OurVertices[i]);
}
}
D3DXVECTOR2 & getVelocity()
{
return velocity;
}
void setVelocity(float x, float y)
{
velocity.x = x; velocity.y = y;
}
D3DXVECTOR2 & getLocation()
{
return position;
}
D3DXVECTOR2 & getMinimum()
{
return d_min;
}
D3DXVECTOR2 & getMaximum()
{
return d_max;
}
std::vector<Vertex> & getVertices()
{
return Vertices;
}
private:
D3DXVECTOR2 position;
D3DXVECTOR2 velocity;
D3DXVECTOR2 d_min;
D3DXVECTOR2 d_max;
std::vector<Vertex> Vertices;
bool isPhysical; // can you touch it?
bool isVisible; // render this object?
bool AABB; // compatible with AABB collision detection
};