Commits

Jason McKesson committed d2156f7

glscene: Transforms now have a position of the transform node.

Comments (0)

Files changed (3)

glscene/glscene_format.doxy

 end
 ~~~~
 
-Even though the scale is an identity scale, it will still cause it to be composed.
+Even though the scale is an identity scale, putting the orientation afterwards will still cause it to be composed.
 
 **/
 

glscene/source/Parse.cpp

 			}
 		}
 
-		ParsedTransform ParseTransform()
+		ParsedTransformDef ParseTransform()
 		{
 			PosStackPusher push(*this);
+			ParsedTransformDef ret;
+			ret.pos = GetPositionForCurrToken();
+
 			size_t tokId = m_rng.front().id();
 			EatOneToken();
 
 			//Start decomposed.
-			ParsedTransform ret = ParsedDecomposedTransform();
+			ret.trans = ParsedDecomposedTransform();
 
 			while(IsCurrTokenOneOf(g_transformTokens))
 			{
 				switch(tok.id())
 				{
 				case TOK_TRANSLATE:
-					ApplyTranslation(ret, ParseVec3(tok, tokId));
+					ApplyTranslation(ret.trans, ParseVec3(tok, tokId));
 					break;
 				case TOK_SCALE:
-					ApplyScale(ret, ParseVec3(tok, tokId));
+					ApplyScale(ret.trans, ParseVec3(tok, tokId));
 					break;
 				case TOK_ORIENTATION:
-					ApplyOrientation(ret, ParseQuat(tok, tokId));
+					ApplyOrientation(ret.trans, ParseQuat(tok, tokId));
 					break;
 				case TOK_ANGLE_AXIS:
 					{
 						float angle = ParseSingleFloat(tok, tokId);
 						glm::vec3 axis = ParseVec3(tok, tokId);
-						ApplyOrientation(ret, glm::angleAxis(angle, axis));
+						ApplyOrientation(ret.trans, glm::angleAxis(angle, axis));
 					}
 					break;
 				case TOK_MATRIX:
-					ApplyMatrix(ret, ParseMat4(tok, tokId));
+					ApplyMatrix(ret.trans, ParseMat4(tok, tokId));
 					break;
 				}
 			}

glscene/source/ParsedData.h

 
 	typedef boost::variant<glm::mat4, ParsedDecomposedTransform> ParsedTransform;
 
+	struct ParsedTransformDef
+	{
+		FilePosition pos;
+		ParsedTransform trans;
+	};
+
 	inline void ApplyTranslation(ParsedTransform &tm, const glm::vec3 &translation)
 	{
 		if(tm.which() == 1)
 		LayerSet layers;
 		std::vector<ParsedNodeDef*> childNodes;
 		ParsedNodeDef *pParent;
-		ParsedTransform nodeTM;
-		ParsedTransform objectTM;
+		ParsedTransformDef nodeTM;
+		ParsedTransformDef objectTM;
 
 		ParsedNodeDef& operator=(const ParsedNodeDef &other)
 		{