Results 1 to 2 of 2

Thread: What's the meaning of source_array in deindexer()?

  1. #1
    Senior Member Frequent Contributor ehsan2004's Avatar
    Join Date
    Jun 2004
    Location
    Iran
    Posts
    645

    What's the meaning of source_array in deindexer()?

    Hi there. What's the meaning of source_array in deindexer()?Is it the actual data of the positions, normals and texcoords? Here's the code:
    Code :
    std::map<domSource*,domSource*> source_map;
    		domSource_Array & source_array = mesh->getSource_array();
    		domUint source_count = source_array.getCount();
    		for(size_t i=0; i<source_count; i++)
    		{	//make a map of old source and new duplicat source
    			domSource* source = (domSource*) (domElement*) source_array[i];
    			domSourceRef newsource = (domSource*) (domElement*) source->clone();
    			assert(newsource);
    			ResetSource(newsource, vertexindex);
    			mesh->placeElement(newsource);
    			source_map[source] = newsource;
    		}
    What does the function ResetSource() do?Here's its definition:
    Code :
    void ResetSource(domSource * newsource, domUint new_vertex_size)
    {
    	newsource->getTechnique_common()->getAccessor()->setCount(new_vertex_size);
    	domUint stride = newsource->getTechnique_common()->getAccessor()->getStride();
     
    	domFloat_arrayRef newfloat_array = newsource->getFloat_array();
    	if (newfloat_array)
    	{
    		newfloat_array->setCount(new_vertex_size * stride);
    		newfloat_array->getValue().setCount((size_t)(new_vertex_size * stride));
    	}
     
    	domInt_arrayRef newint_array = newsource->getInt_array();
    	if (newint_array)
    	{
    		newint_array->setCount(new_vertex_size * stride);
    		newint_array->getValue().setCount((size_t)(new_vertex_size * stride));
    	}
     
    	domName_arrayRef newname_array = newsource->getName_array();
    	if (newname_array)
    	{
    		newname_array->setCount(new_vertex_size * stride);
    		newname_array->getValue().setCount((size_t)(new_vertex_size * stride));
    	}
     
    	domIDREF_arrayRef newidref_array = newsource->getIDREF_array();
    	if (newidref_array)
    	{
    		newidref_array->setCount(new_vertex_size * stride);
    		newidref_array->getValue().setCount((size_t)(new_vertex_size * stride));
    	}
     
    	domBool_arrayRef newbool_array = newsource->getBool_array();
    	if (newbool_array)
    	{
    		newbool_array->setCount(new_vertex_size * stride);
    		newbool_array->getValue().setCount((size_t)(new_vertex_size * stride));
    	}
    }
    -Ehsan-

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    Hi there. What's the meaning of source_array in deindexer()?Is it the actual data of the positions, normals and texcoords?
    Yes, the <source> elements contain the actual arrays of data. A mesh can have any number of <source>s, and these will be stored as an array in domMesh. That's what source_array is.
    What does the function ResetSource() do?
    A <source> element contains an array of data, but there are many different types of arrays it could contain. It might be an array of integers, or an array of floats, or an array of IDs. There are different uses for each of these in Collada. This function sets the length of the daeArray object, as well as the "count" attribute on the array (unfortunately the DOM client needs to maintain the "count" attribute manually) to the specified value, regardless of what the array type is. I would have worked around the type system to shorten this code and make it simpler, but this code should work fine.

    If you want to understand how the deindexer works you might find it useful to step through the code in a debugger.

Similar Threads

  1. meaning of CL_DEVICE_PREFERRED_VECTOR_WIDTH_*
    By Hi_Buddy in forum OpenCL
    Replies: 1
    Last Post: 06-28-2015, 11:01 AM
  2. Replies: 1
    Last Post: 04-14-2012, 03:34 PM
  3. Fix for bug in refinery deindexer conditioner
    By thayer_andrews in forum COLLADA
    Replies: 0
    Last Post: 01-19-2007, 01:27 PM
  4. Bug in DeIndexer sample
    By Nitro in forum COLLADA
    Replies: 2
    Last Post: 04-10-2006, 05:08 PM
  5. What's the meaning "A" out of "RGBA"
    By mast in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-20-2001, 08:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean