2f6c5ee319
Almost there. Just an odd linker error so far.
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <charcoal/Batch.h>
|
|
#include <charcoal/Renderable.h>
|
|
#include <charcoal/Poseable2D.h>
|
|
|
|
#include "PoseableBatch.h"
|
|
|
|
namespace charcoal
|
|
{
|
|
namespace builtin
|
|
{
|
|
// This has to be made completely seperately in order to avoid the vtable that gets added if Poseable is abstracted between
|
|
// 2D and 3D
|
|
template <typename VertexType, typename IndexType, typename RenderableT = RenderableT<VertexType, IndexType> >
|
|
class Poseable2DBatch : public PoseableBatch<VertexType, IndexType, RenderableT>
|
|
{
|
|
public:
|
|
using PoseableBatch<VertexType, IndexType, RenderableT>::PoseableBatch;
|
|
|
|
Poseable2D& get_pose(int index)
|
|
{
|
|
Poseable& pose = PoseableBatch<VertexType, IndexType, RenderableT>::get_pose(index);
|
|
Poseable* p_pose = &pose;
|
|
Poseable2D* p_pose_2d = reinterpret_cast<Poseable2D*>(p_pose); // Can do this since both are just mat4 wrappers
|
|
return *p_pose_2d;
|
|
}
|
|
const Poseable2D& get_pose(int index) const
|
|
{
|
|
Poseable& pose = PoseableBatch<VertexType, IndexType, RenderableT>::get_pose(index);
|
|
Poseable* p_pose = &pose;
|
|
Poseable2D* p_pose_2d = reinterpret_cast<Poseable2D*>(p_pose); // Can do this since both are just mat4 wrappers
|
|
return *p_pose_2d;
|
|
}
|
|
};
|
|
}
|
|
} |