Exemplo n.º 1
0
void openglwindow::getfilen(const char* fname)
{

	Niflib::NiObjectRef niparentobject;
		niparentobject=Niflib::ReadNifTree(fname);
		Niflib::NiNodeRef niparentnode;
        niparentnode=Niflib::DynamicCast<Niflib::NiNode>(niparentobject);
		vector<Niflib::NiAVObjectRef> niavparent=niparentnode->GetChildren();
		const aiMesh* m;
		for(int i=0 ; i< niavparent.size();i++)
		{
			if (niavparent[i]->GetType().GetTypeName()=="NiTriShape")
            {
				shape=Niflib::DynamicCast<Niflib::NiTriShape>(niavparent[i]);
				ndata= Niflib::DynamicCast<Niflib::NiTriBasedGeomData>(shape->GetData());
				gl::GLWriter wr;
				
		    }
		}
}
Exemplo n.º 2
0
void loadNiNode(Niflib::NiAVObjectRef node, RefMap& refmap) {
	//make a new node
	Node *result = refmap.getNode(node);

	//load data
	result->setName(node->GetName());
	result->setPosition(NifToGlmVec3(node->GetLocalTranslation()));
	result->setRotation(NifToGlmQuat(node->GetLocalRotation().AsQuaternion()));
	result->setScale(glm::vec3(node->GetLocalScale(),node->GetLocalScale(),node->GetLocalScale()));

	for (Niflib::NiExtraDataRef& extradata: node->GetExtraData()) {
		if (extradata->GetType().IsSameType(Niflib::NiStringExtraData::TYPE)) {
			Niflib::NiStringExtraDataRef strdata = Niflib::DynamicCast<Niflib::NiStringExtraData>(
														extradata);
			if (strdata->GetData() == "NCO") {
				refmap.hasCollision = false;
			}
		}
	}

	if (node->GetType().IsSameType(Niflib::NiTriShape::TYPE)) {
		Niflib::NiTriShapeRef temp = Niflib::DynamicCast<Niflib::NiTriShape>(node);
		Niflib::NiTriShapeDataRef tempdata = Niflib::DynamicCast<Niflib::NiTriShapeData>(temp->GetData());
		loadNiTriShapeData(temp, tempdata, refmap);
	}
	else if (node->GetType().IsSameType(Niflib::RootCollisionNode::TYPE)) {
		refmap.collisionnode = Niflib::DynamicCast<Niflib::RootCollisionNode>(node);
	}

	result->isVisible = node->GetVisibility();

	//attach this node to its parent
	Niflib::NiNodeRef parent = node->GetParent();
	if (parent) {
		Node *parnode = refmap.getNode(parent);
		parnode->addChild(result);
	}

	refmap.currentModel->addNamedNode(node->GetName(), result);
}