make sure the unique id is set correctly

Change-Id: I1b846e79c2fdd718b7c67f39cb67ca2916520cb3
This commit is contained in:
Markus Mohrhard
2014-04-10 00:02:51 +02:00
committed by Markus Mohrhard
parent 2e1177a1b6
commit ceec6e1ac9
3 changed files with 43 additions and 4 deletions

View File

@@ -38,6 +38,7 @@ void Bar3DChart::create3DShapes()
maShapes.clear();
maShapes.push_back(new opengl3D::Camera());
sal_Int32 nSeriesIndex = 0;
sal_uInt32 nId = 1;
for(std::vector<VDataSeries*>::const_iterator itr = maDataSeries.begin(),
itrEnd = maDataSeries.end(); itr != itrEnd; ++itr)
{
@@ -53,7 +54,7 @@ void Bar3DChart::create3DShapes()
glm::scale(aBarPosition, nBarSizeX, nBarSizeY, nVal);
glm::translate(aBarPosition, nXPos, nYPos, nVal/2);
maShapes.push_back(new opengl3D::Bar(aBarPosition));
maShapes.push_back(new opengl3D::Bar(aBarPosition, nId++));
}
++nSeriesIndex;

View File

@@ -21,16 +21,20 @@ namespace opengl3D {
class Renderable3DObject
{
public:
Renderable3DObject(sal_uInt32 nId);
virtual ~Renderable3DObject() {};
virtual void render() {}
virtual void render();
protected:
sal_uInt32 mnUniqueId;
};
class Bar : public Renderable3DObject
{
public:
Bar( const glm::mat4& rPosition );
Bar( const glm::mat4& rPosition, sal_uInt32 nId );
private:
glm::mat4 maPos;
Color maColor; // RGBA fill color
@@ -38,6 +42,9 @@ private:
class Line : public Renderable3DObject
{
public:
Line( sal_uInt32 nId );
private:
glm::vec3 maPosBegin;
glm::vec3 maPosEnd;
@@ -46,6 +53,8 @@ private:
class Text : public Renderable3DObject
{
public:
Text( sal_uInt32 nId );
private:
BitmapEx maText;
glm::vec3 maTopLeft;
@@ -55,6 +64,8 @@ private:
class Rectangle : public Renderable3DObject
{
public:
Rectangle( sal_uInt32 nId );
private:
glm::vec3 maTopLeft;
glm::vec3 maTopRight;

View File

@@ -13,12 +13,39 @@ namespace chart {
namespace opengl3D {
Bar::Bar(const glm::mat4& rPosition):
Renderable3DObject::Renderable3DObject(sal_uInt32 nId):
mnUniqueId(nId)
{
}
void Renderable3DObject::render()
{
(void) mnUniqueId;
}
Bar::Bar(const glm::mat4& rPosition, sal_uInt32 nId):
Renderable3DObject(nId),
maPos(rPosition)
{
}
Line::Line(sal_uInt32 nId):
Renderable3DObject(nId)
{
}
Text::Text(sal_uInt32 nId):
Renderable3DObject(nId)
{
}
Rectangle::Rectangle(sal_uInt32 nId):
Renderable3DObject(nId)
{
}
Camera::Camera():
Renderable3DObject(0),
maPos(10,10,-10),
maDirection(glm::vec3(0,0,0)-maPos)
{