Well the thread title is obvious. Why can't I save a vector4 in a texturecoord or even position of a manual object. This is really a senseless limitation. All vertex attributes are originally float4's so why is the limit float3.
I wanted to use 4 values and store it in one neat texturecoord untill I realised it only supported up to vector3. So that's why I ask you to please add vector4 support because it doesn't make any sense atm. You're forcing people like me to use two texturecoords for no reason really.
Edit: Actually the same could go for the colourValue type. Why does it automatically saturate the values. I understand that colors are between 0-1 but it doesn't mean I'm going to use that attribute to define a colour. Atleast let it accept a vector4 as well.
Why can't I save a vector4 in texturecoord?
-
broli
- Halfling
- Posts: 48
- Joined: Fri Mar 31, 2006 5:08 pm
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
Simple - ManualObject is meant as a simple interface so the most common options are provided. You can do whatever the hell you like if you use vertex buffers directly and that's by far the more powerful option. Yes, I can add 4D UV support to ManualObject but it made perfect sense to omit it at the time - most people don't even use 3D UVs.
Same answer re colour values - default representation is 32-bit RGBA. If you want more power to control the precise data types going into the buffer then you shouldn't be using ManualObject anyway - the vertex decl / vertex buffer API is what you want. Although, bear in mind that colour interpolators on most GPUs are lower precision than texture coord interpolators so be careful about what you do with them.
To be honest it's impossible to please everyone here - ManualObject was created because people found that the vertex buffer / declaration API was complex. Inherently therefore it has to have some simplifications in order to make it easier to use - you can't have it both ways. If you find the ManualObject simplification too simple for you, don't use it. There's plenty of power in the underlying APIs and we're certainly not 'forcing' you to do anything - ManualObject is just trying to address the simpler audience.
Same answer re colour values - default representation is 32-bit RGBA. If you want more power to control the precise data types going into the buffer then you shouldn't be using ManualObject anyway - the vertex decl / vertex buffer API is what you want. Although, bear in mind that colour interpolators on most GPUs are lower precision than texture coord interpolators so be careful about what you do with them.
To be honest it's impossible to please everyone here - ManualObject was created because people found that the vertex buffer / declaration API was complex. Inherently therefore it has to have some simplifications in order to make it easier to use - you can't have it both ways. If you find the ManualObject simplification too simple for you, don't use it. There's plenty of power in the underlying APIs and we're certainly not 'forcing' you to do anything - ManualObject is just trying to address the simpler audience.
-
broli
- Halfling
- Posts: 48
- Joined: Fri Mar 31, 2006 5:08 pm
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
Well, that's obviously your personal perspective but bear in mind you're the first person to even raise this, and a ton of people are using ManualObject. It really isn't supposed to be all things to all men, it's a helper for those who don't want to use the full underlying API.
To be honest adding Vector4 support for UVs isn't that big a deal but your original post's tone was so presumptuous ("I need this therefore you must be dumb for not providing it"), it didn't exactly motivate me to rush out and change my (busy) schedule for your benefit. Plus, I had a crappy weekend so I was cranky so I probably overreacted. But, there's a certain way of asking for things you know, especially when you're getting everything for free.
To be honest adding Vector4 support for UVs isn't that big a deal but your original post's tone was so presumptuous ("I need this therefore you must be dumb for not providing it"), it didn't exactly motivate me to rush out and change my (busy) schedule for your benefit. Plus, I had a crappy weekend so I was cranky so I probably overreacted. But, there's a certain way of asking for things you know, especially when you're getting everything for free.
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
Code: Select all
Index: OgreMain/include/OgreManualObject.h
===================================================================
RCS file: /cvsroot/ogre/ogrenew/OgreMain/include/OgreManualObject.h,v
retrieving revision 1.13
diff -u -r1.13 OgreManualObject.h
--- OgreMain/include/OgreManualObject.h 4 May 2007 13:28:04 -0000 1.13
+++ OgreMain/include/OgreManualObject.h 3 Sep 2007 14:25:24 -0000
@@ -201,9 +201,13 @@
/// @copydoc ManualObject::textureCoord(Real)
virtual void textureCoord(Real u, Real v, Real w);
/// @copydoc ManualObject::textureCoord(Real)
+ virtual void textureCoord(Real x, Real y, Real z, Real w);
+ /// @copydoc ManualObject::textureCoord(Real)
virtual void textureCoord(const Vector2& uv);
/// @copydoc ManualObject::textureCoord(Real)
virtual void textureCoord(const Vector3& uvw);
+ /// @copydoc ManualObject::textureCoord(Real)
+ virtual void textureCoord(const Vector4& xyzw);
/** Add a vertex colour to a vertex.
*/
@@ -434,7 +438,7 @@
{
Vector3 position;
Vector3 normal;
- Vector3 texCoord[OGRE_MAX_TEXTURE_COORD_SETS];
+ Vector4 texCoord[OGRE_MAX_TEXTURE_COORD_SETS];
ushort texCoordDims[OGRE_MAX_TEXTURE_COORD_SETS];
ColourValue colour;
};
Index: OgreMain/src/OgreManualObject.cpp
===================================================================
RCS file: /cvsroot/ogre/ogrenew/OgreMain/src/OgreManualObject.cpp,v
retrieving revision 1.27
diff -u -r1.27 OgreManualObject.cpp
--- OgreMain/src/OgreManualObject.cpp 4 May 2007 13:28:05 -0000 1.27
+++ OgreMain/src/OgreManualObject.cpp 3 Sep 2007 14:25:24 -0000
@@ -355,6 +355,30 @@
++mTexCoordIndex;
}
//-----------------------------------------------------------------------------
+ void ManualObject::textureCoord(Real x, Real y, Real z, Real w)
+ {
+ if (!mCurrentSection)
+ {
+ OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
+ "You must call begin() before this method",
+ "ManualObject::textureCoord");
+ }
+ if (mFirstVertex && !mCurrentUpdating)
+ {
+ // defining declaration
+ mCurrentSection->getRenderOperation()->vertexData->vertexDeclaration
+ ->addElement(0, mDeclSize, VET_FLOAT4, VES_TEXTURE_COORDINATES, mTexCoordIndex);
+ mDeclSize += VertexElement::getTypeSize(VET_FLOAT4);
+ }
+ mTempVertex.texCoordDims[mTexCoordIndex] = 4;
+ mTempVertex.texCoord[mTexCoordIndex].x = x;
+ mTempVertex.texCoord[mTexCoordIndex].y = y;
+ mTempVertex.texCoord[mTexCoordIndex].z = z;
+ mTempVertex.texCoord[mTexCoordIndex].w = w;
+
+ ++mTexCoordIndex;
+ }
+ //-----------------------------------------------------------------------------
void ManualObject::textureCoord(const Vector2& uv)
{
textureCoord(uv.x, uv.y);
@@ -364,6 +388,11 @@
{
textureCoord(uvw.x, uvw.y, uvw.z);
}
+ //---------------------------------------------------------------------
+ void ManualObject::textureCoord(const Vector4& xyzw)
+ {
+ textureCoord(xyzw.x, xyzw.y, xyzw.z, xyzw.w);
+ }
//-----------------------------------------------------------------------------
void ManualObject::colour(const ColourValue& col)
{
