Example #1
0
	GLuint Positions(std::vector<T>& dest) const
	{
		dest.resize(20*3*3);

		const GLdouble* p = _positions();
		const GLushort* i = _indices();

		for(GLuint f=0; f!=20; ++f)
		{
			for(GLuint v=0; v!=3; ++v)
			{
				for(GLuint c=0; c!=3; ++c)
				{
					dest[f*9+v*3+c] = p[i[f*3+v]*3+c];
				}
			}
		}
		return 3;
	}
Example #2
0
	GLuint Normals(std::vector<T>& dest) const
	{
		dest.resize(20*3*3);

		const GLdouble* p = _positions();
		const GLushort* i = _indices();

		for(GLuint f=0; f!=20; ++f)
		{
			Vector<T, 3> v0(p+i[f*3+0]*3, 3);
			Vector<T, 3> v1(p+i[f*3+1]*3, 3);
			Vector<T, 3> v2(p+i[f*3+2]*3, 3);
			Vector<T, 3> fn(Normalized(Cross(v1-v0, v2-v0)));

			for(GLuint v=0; v!=3; ++v)
			{
				for(GLuint c=0; c!=3; ++c)
				{
					dest[f*9+v*3+c] = fn[c];
				}
			}
		}
		return 3;
	}
Example #3
0
	GLuint Positions(std::vector<T>& dest) const
	{
		const GLdouble* p = _positions();
		dest.assign(p, p+12*3);
		return 3;
	}
Example #4
0
	GLuint Positions(std::vector<T>& dest) const
	{
		auto v = _positions();
		dest.assign(v.begin(), v.end());
		return 3;
	}
Example #5
0
	GLuint Positions(std::vector<GLfloat>& dest) const
	{
		dest = _positions();
		return 3;
	}