Sign in to follow this  
gchris6810

loading a data array from a COLLADA document

Recommended Posts

gchris6810    207

Hi,

 

I am trying to write my own COLLADA loader and I have run into trouble when trying to load in arrays of float data. The XML parser I am using is rapidXML and the node object 'value' attribute only returns a string with the data inside the node. How would you efficiently read in an array of 'float' or 'double' values from the document? Would there be any character conversion required? And if so how would you go about converting the values in the fastest way possible?

 

Any replies are appreciated. 

Share this post


Link to post
Share on other sites
LJ_1102    1233

So lets guess some here,

i guess you're using C++ and your xml library is returning an std::string for a nodes value attribute.

 

So first you would like to split your string by a delimiter into single number strings.

Then you would want to iterate over the vector of std::strings and use atof on the c strings (.c_str()) to get the double values.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this