void CloudsVisualSystem3DModelLoader::loadModel( string fileName )
{
//	perspCam.reset();
	cout << "*** LOADING MODEL " << fileName << endl;
    //xxx
    string filePath = GetCloudsMediaPath() + "assets/3DModelLoader/models_binary/" + fileName;

	//string filePath = getVisualSystemDataPath(true) + "models_binary/" + fileName;
//	string filePath = getVisualSystemDataPath(false) + fileName;
	
	//ofStringReplace(filePath,"models/", "models_binary/");
	//ofStringReplace(filePath,".obj", ".obm");

	if(!ofFile(filePath).exists()){
		ofLogError("CloudsVisualSystem3DModelLoader::loadModel") << filePath << " Doesn't exist";
	}
	else{
		cout << "Found path " << filePath << " to exist" << endl;
	}
	ofxBinaryMesh::load(filePath, modelMesh);
//	ofxObjLoader::load(filePath, modelMesh, true );
//	ofxObjLoader::load_oldway(filePath, modelMesh, true );
	cout << "*** FULL PATH " << filePath << " FOUND " << modelMesh.getNumVertices() << " verts " <<  endl;

	calcBoundingBox();

	float mScl = maxDim / max( maxBound.x - minBound.x, max(maxBound.y-minBound.y, maxBound.z - minBound.z ));
	modelScl.set( mScl, mScl, mScl );

	updateModelTransform();
	
	setupMultipleCameras( modelTransform.getPosition() );
}
示例#2
0
Transform::Transform(const glm::vec3& position, const glm::quat& rotation, const glm::vec3& scale)
{
	m_parent = nullptr;

	m_position = position;
	m_rotation = glm::normalize(rotation);
	m_scale = scale;

	updateModelTransform();
	updateRealValues();

	m_oldPosition = m_position;
	m_oldRotation = m_rotation;
	m_oldScale = m_scale;
}
示例#3
0
void Transform::update()
{
	bool changed = hasChanged();

	if (changed) 
	{
		updateModelTransform();

		m_oldPosition = m_position;
		m_oldRotation = m_rotation;
		m_oldScale = m_scale;
	}

	if (m_needChildrenUpdate = changed || (getParent() != nullptr && getParent()->isChildrenUpdateNeeded()))
		updateRealValues();
}
// selfDraw draws in 3D using the default ofEasyCamera
// you can change the camera by returning getCameraRef()
void CloudsVisualSystem3DModelLoader::selfDraw()
{
	//???: update... for some reason the selfUpdate is being called in stand alone.
//	bLeftCamIsActive = bFrontCamIsActive = bPlanCamIsActive = bPerspCamIsActive = false;
    glDisable(GL_CULL_FACE);
	if( cursorIsOverGUI() )
	{
		leftCam.disableMouseInput();
		planCam.disableMouseInput();
		frontCam.disableMouseInput();
		perspCam.disableMouseInput();
	}
	else
	{
		if( bLeftCamIsActive && !leftCam.getMouseInputEnabled())	leftCam.enableMouseInput();
		if( bFrontCamIsActive && !frontCam.getMouseInputEnabled())	frontCam.enableMouseInput();
		if( bPlanCamIsActive && !planCam.getMouseInputEnabled())	planCam.enableMouseInput();
		if( bPerspCamIsActive && !perspCam.getMouseInputEnabled())	perspCam.enableMouseInput();
	}
	
	
	updateModelTransform();
	
	aimMultipleViews( modelTransform.getPosition() );
	
	//draw from single view
	if( bFourView )
	{
        //MA: changed ofGetWidth() to GetCanvasWidth() and ofGetHeight() to GetCanvasHeight()
		int hw = getCanvasWidth()/2;
		int hh = getCanvasHeight()/2;
		
		drawSceneLeft( ofRectangle(0,0,hw,hh) );
		
		drawSceneFront( ofRectangle(hw,0,hw,hh) );
		
		drawScenePlan( ofRectangle(0,hh,hw,hh) );
		
		drawScenePerspective( ofRectangle(hw,hh,hw,hh) );
		
	}
	else if(currentSingleCam == &perspCam)
	{
		drawScenePerspective( ofGetCurrentViewport() );
	}
	else if(currentSingleCam == &leftCam)
	{
		drawSceneLeft();
	}
	else if(currentSingleCam == &frontCam)
	{
		drawSceneFront();
	}
	else if(currentSingleCam == &planCam)
	{
		drawScenePlan();
	}
	else if(currentSingleCam == &pathCamera)
	{
		if(bUseDuration) pathCamera.update();
		else	pathCamera.update( pathCameraPosition );
		drawSceneCamera( &pathCamera );
	}
}