Exemple #1
0
void Node::constructFromFile(std::istream &file) {
	char type;
	uint32_t count;
	ReadNodeHeader(file, type, count);

	constructChildrenFromFile(file, count);
}
void SceneImporter<real>::ReadVisualNodeHeader( std::istream& stream, VisualNode<real>* ioNode )
{
	ReadNodeHeader( stream, ioNode ); ReadNextExactToken( stream, "," );
	std::string materialName = ReadNextToken( stream ); ReadNextExactToken( stream, "," );
	bool isVisible = ReadBoolean( stream );

	ioNode->SetMaterial( GetMaterial( materialName ) );
	ioNode->SetVisible( isVisible );
}
Node<real>* SceneImporter<real>::ReadNode( std::istream& stream, const std::string& name )
{
	Node<real>* node = new Node<real>();
	node->SetName( name );

	ReadNodeHeader( stream, node );

	return node;
}
Exemple #4
0
void Node::constructChildrenFromFile(std::istream &file, uint32_t count) {
	Node *result = new Node();
	for (uint32_t i = 0; i < count; i++)
	{
		char type;
		uint32_t childCount;
		ReadNodeHeader(file, type, childCount);

		if(type == 0) {
			addChild(*Node::constructPartFromFile(file, childCount));
		} else if(type == 1) {
			addChild(*IntLeaf::constructPartFromFile(file, childCount));
		} else {
			break;
		}
	}
}
Exemple #5
0
DataLeaf::DataLeaf(std::istream &file) : BaseLeaf(BaseNode::DATA_LEAF)
{
	//Retrieve type and length
    char type;
    uint32_t length;
    ReadNodeHeader(file, type, length);

    if(type != 0x01) {
		//TODO
		// Trying to build a dataleaf from a node, throw exception?
		throw 1;
    }
   
	//Read and store the data;
    for (uint32_t i = 0; i < length; i++)
    {
		char buffer;
		file.read(&buffer, 1);
		data.push_back(buffer);
    }
}
void SceneImporter<real>::ReadCameraNodeHeader( std::istream& stream, CameraNode<real>* ioNode )
{
	ReadNodeHeader( stream, ioNode );
}
void SceneImporter<real>::ReadLightNodeHeader( std::istream& stream, LightNode<real>* ioNode )
{
	ReadNodeHeader( stream, ioNode );
}