Thanks but I need entirely different thing.
I have some numeric data which belongs to the vertices of a set of triangles (imagine something you paint on top of vertices in Blender).
Code: Select all
struct vertexData {
Ogre::Vector3 position;
Ogre::Vector3 uv;
float v1, v2, v3, v3,
v4, v5, v6, v7;
};
std::vector<vertexData> data; // loaded from file, about 55K things
std::vector<int> indices; // triangles out of above things, loaded from same file.
I need to extrapolate the data and cache them so I can easily get the value. For that I want to use UV value as 2D triangle vertex and
consider the values as colors.
Code: Select all
int i;
Ogre::Image image(PF_R8G8B8, 512, 512);
image.setTo(Ogre::ColourValue(0, 0, 0, 1));
for (i = 0; i < indices.size(); i += 3)
{
vertexData p1 = data[indices[i]];
vertexData p2 = data[indices[i + 1]];
vertexData p3 = data[indices[i + 2]];
drawVertexColor2DTriangle(image, p1.uv * 512, p2.uv * 512, p3.uv * 512,
Ogre::ColorValue(p1.v1, p1.v2, p1.v3),
Ogre::ColorValue(p2.v1, p2.v2, p2.v3),
Ogre::ColorValue(p3.v1, p3.v2, p3.v3));
}
And then I will be able to get the value for any UV without it having to be exactly value from data, which would be much faster,
The approach is similar to deformation maps and height maps in shaders.
So what I need is to find this drawVertexColor2DTriangle() function or implement it. Any ideas?
I remember doing something like that in past but I forgot too much and I was hoping there is some library or already made function which I can use for this thing...