//添加元素
void FilterParameter::addQDomElement(FilterParameterSet &par, QDomElement &np)
{
		QString name=np.attribute("name");
		QString type=np.attribute("type");

		qDebug("    Reading Param with name %s : %s",qPrintable(name),qPrintable(type));

		if(type=="Bool")    { par.addBool(name,np.attribute("value")!=QString("false")); return; }
		if(type=="Int")     { par.addInt(name,np.attribute("value").toInt()); return; }
		if(type=="Float")   { par.addFloat(name,np.attribute("value").toDouble()); return; }
		if(type=="String")  { par.addString(name,np.attribute("value")); return; }
		if(type=="AbsPerc") { par.addAbsPerc(name,np.attribute("value").toFloat(),np.attribute("min").toFloat(),np.attribute("max").toFloat()); return; }
		if(type=="Color")		{ par.addColor(name,QColor::QColor(np.attribute("rgb").toUInt())); return; }
		if(type=="Matrix44")
		{
		  Matrix44f mm;
			for(int i=0;i<16;++i)
					mm.V()[i]=np.attribute(QString("val")+QString::number(i)).toDouble();
			par.addMatrix44(name,mm);    
			return;                    
		}
		if(type=="Enum")
		{
			QStringList list = QStringList::QStringList();
			for(QDomElement ns = np.firstChildElement("EnumString"); !ns.isNull(); ns = ns.nextSiblingElement("EnumString")){
				list<<ns.attribute("value");
			}
			par.addEnum(name,np.attribute("value").toInt(),list);
			return;
		}
		
		if(type == MeshPointerName())  { par.addMesh(name, np.attribute(ValueName()).toInt()); return; }
		if(type == FloatListName())
		{
			QList<float> values;
			for(QDomElement listItem = np.firstChildElement(ItemName());
					!listItem.isNull();
					listItem = listItem.nextSiblingElement(ItemName()))
			{
					values.append(listItem.attribute(ValueName()).toFloat()); 
				}
			par.addFloatList(name,values);
			return;
		}
			
		if(type == DynamicFloatName())  { par.addDynamicFloat(name, np.attribute(ValueName()).toFloat(), np.attribute(MinName()).toFloat(), np.attribute(MaxName()).toFloat(), np.attribute(MaskName()).toInt()); return; }
		if(type == OpenFileNameName())  { par.addOpenFileName(name, np.attribute(ValueName())); return; }
		if(type == SaveFileNameName())  { par.addSaveFileName(name, np.attribute(ValueName())); return; }
		if(type=="Point3f") 
		{
			Point3f val;
			val[0]=np.attribute("x").toFloat();
			val[1]=np.attribute("y").toFloat();
			val[2]=np.attribute("z").toFloat();
			par.addPoint3f(name, val);  
			return; 
		}

		assert(0); // we are trying to parse an unknown xml element
}
void BubbleChamberApp::drawIntoRoomFbo()
{
	mRoomFbo.bindFramebuffer();
	gl::clear( ColorA( 0.0f, 0.0f, 0.0f, 0.0f ), true );
	
	gl::setMatricesWindow( mRoomFbo.getSize(), false );
	gl::setViewport( mRoomFbo.getBounds() );
	gl::disableAlphaBlending();
	gl::enable( GL_TEXTURE_2D );
	glEnable( GL_CULL_FACE );
	glCullFace( GL_BACK );
	Matrix44f m;
	m.setToIdentity();
	m.scale( mRoom.getDims() );

	mRoomShader.bind();
	mRoomShader.uniform( "mvpMatrix", mActiveCam.mMvpMatrix );
	mRoomShader.uniform( "mMatrix", m );
	mRoomShader.uniform( "eyePos", mActiveCam.mCam.getEyePoint() );
	mRoomShader.uniform( "roomDims", mRoom.getDims() );
	mRoomShader.uniform( "power", mRoom.getPower() );
	mRoomShader.uniform( "lightPower", mRoom.getLightPower() );
	mRoomShader.uniform( "timePer", mRoom.getTimePer() * 1.5f + 0.5f );
	mRoom.draw();
	mRoomShader.unbind();
	
	mRoomFbo.unbindFramebuffer();
	glDisable( GL_CULL_FACE );
}
Пример #3
0
void ShadedSphereApp::drawIntoRoomFbo()
{
	mRoomFbo.bindFramebuffer();
	gl::clear( ColorA( 0.0f, 0.0f, 0.0f, 0.0f ), true );
	
	gl::setMatricesWindow( mRoomFbo.getSize(), false );
	gl::setViewport( mRoomFbo.getBounds() );
	gl::disableAlphaBlending();
	gl::enable( GL_TEXTURE_2D );
	glEnable( GL_CULL_FACE );
	glCullFace( GL_BACK );
	Matrix44f m;
	m.setToIdentity();
	m.scale( mRoom.getDims() );
	
	//	mLightsTex.bind( 0 );
	mRoomShader.bind();
	mRoomShader.uniform( "mvpMatrix", mSpringCam.mMvpMatrix );
	mRoomShader.uniform( "mMatrix", m );
	mRoomShader.uniform( "eyePos", mSpringCam.getEye() );
	mRoomShader.uniform( "roomDims", mRoom.getDims() );
	mRoomShader.uniform( "mainPower", mRoom.getPower() );
	mRoomShader.uniform( "lightPower", mRoom.getLightPower() );
	mRoom.draw();
	mRoomShader.unbind();
	
	mRoomFbo.unbindFramebuffer();
	glDisable( GL_CULL_FACE );
}
Пример #4
0
/* transforms clip-space coordinates to object-space coordinates,
	where z is within range [0.0 - 1.0] from near-plane to far-plane */
Vec3f Node::unproject(float x, float y, float z) const
{
    // get viewport and projection matrix
    Area viewport = gl::getViewport();
    Matrix44f projection = gl::getProjection();

    // find the inverse modelview-projection-matrix
    Matrix44f mvp = projection * mWorldTransform;
    mvp.invert(0.0f);

    // map x and y from window coordinates
    Vec4f in(x, float(viewport.getHeight()) - y - 1.0f, z, 1.0f);
    in.x = (in.x - viewport.getX1()) / float( viewport.getWidth() );
    in.y = (in.y - viewport.getY1()) / float( viewport.getHeight() );

    // map to range [-1..1]
    in.x = 2.0f * in.x - 1.0f;
    in.y = 2.0f * in.y - 1.0f;
    in.z = 2.0f * in.z - 1.0f;

    //
    Vec4f out = mvp * in;
    if(out.w != 0.0f) out.w = 1.0f / out.w;

    Vec3f result;
    result.x = out.x * out.w;
    result.y = out.y * out.w;
    result.z = out.z * out.w;

    return result;
}
Пример #5
0
//----------------------------------------------------------------------------------------------------------------------  
ci::Vec3f View::unproject(const ci::Vec3f& point)
{
	// Find the inverse Modelview-Projection-Matrix
	Matrix44f mInvMVP = ci::gl::getProjection() * ci::gl::getModelView();
	mInvMVP.invert();
  
	// Transform to normalized coordinates in the range [-1, 1]
	Vec4f pointNormal;
  ci::Area viewport = ci::gl::getViewport();
	pointNormal.x = (point.x - viewport.getX1()) / viewport.getWidth() * 2.0f - 1.0f;
	pointNormal.y = (point.y - viewport.getY1()) / viewport.getHeight() * 2.0f;
	pointNormal.z = 2.0f * point.z - 1.0f;
	pointNormal.w = 1.0f;
  
	// Find the object's coordinates
	Vec4f pointCoord = mInvMVP * pointNormal;
	if (pointCoord.w != 0.0f)
  {
		pointCoord.w = 1.0f / pointCoord.w;
  }
  
	// Return coordinate
	return Vec3f(pointCoord.x * pointCoord.w, 
               pointCoord.y * pointCoord.w, 
               pointCoord.z * pointCoord.w);
  
}
Пример #6
0
AxisAlignedBox3f TriMesh::calcBoundingBox( const Matrix44f &transform ) const
{
	if( mVertices.empty() )
		return AxisAlignedBox3f( Vec3f::zero(), Vec3f::zero() );

	Vec3f min( transform.transformPointAffine( mVertices[0] ) );
	Vec3f max( min );
	for( size_t i = 0; i < mVertices.size(); ++i ) {
		Vec3f v = transform.transformPointAffine( mVertices[i] );

		if( v.x < min.x )
			min.x = v.x;
		else if( v.x > max.x )
			max.x = v.x;
		if( v.y < min.y )
			min.y = v.y;
		else if( v.y > max.y )
			max.y = v.y;
		if( v.z < min.z )
			min.z = v.z;
		else if( v.z > max.z )
			max.z = v.z;
	}

	return AxisAlignedBox3f( min, max );
}
Пример #7
0
void BloomingNeonApp::update()
{
	mTransform.setToIdentity();
	mTransform.rotate( Vec3f::xAxis(), sinf( (float) getElapsedSeconds() * 3.0f ) * 0.08f );
	mTransform.rotate( Vec3f::yAxis(), (float) getElapsedSeconds() * 0.1f );
	mTransform.rotate( Vec3f::zAxis(), sinf( (float) getElapsedSeconds() * 4.3f ) * 0.09f );
}
void Decompressor::viewFrame() {
  skinningProg.bind();
  skinningProg.uniform("worldProxyJoints", frames.first[currentFrame], MaxProxyJoints);
  skinningProg.uniform("worldProxyJointsT", frames.second[currentFrame], MaxProxyJoints);
  skinningProg.unbind();
  
#ifdef GPUDEBUG
  std::vector<Vec3f> debugPosBuffer;
  for (int i=0; i<debugPoints.size(); i++) {
    if (currentFrame == 0) {
      debugPosBuffer.push_back(debugPoints[i]);
    } else {
      Vec3f pos = debugPoints[i] * (1-debugpjws[i][0]-debugpjws[i][1]-debugpjws[i][2]-debugpjws[i][3]);
      for (int j=0; j<4; j++) {
        Matrix33f& pjm = frames.first[currentFrame][(int)(debugpjis[i][j])];
        Vec3f& pjv = frames.second[currentFrame][(int)(debugpjis[i][j])];
        Matrix44f mat;
        mat.setColumn(0, Vec4f(pjm.at(0, 0), pjm.at(1, 0), pjm.at(2, 0), 0));
        mat.setColumn(1, Vec4f(pjm.at(0, 1), pjm.at(1, 1), pjm.at(2, 1), 0));
        mat.setColumn(2, Vec4f(pjm.at(0, 2), pjm.at(1, 2), pjm.at(2, 2), 0));
        mat.setColumn(3, Vec4f(pjv.x, pjv.y, pjv.z, 0));
        
        Vec3f temp = mat.transformVec(debugPoints[i]);
        pos += temp * debugpjws[i][j];
      }
      
      debugPosBuffer.push_back(pos);
    }
  }
  debugMesh->bufferPositions(debugPosBuffer);
#endif
}
Пример #9
0
void UiLayer::update()
{
    Vec2f interfaceSize = getRoot()->getInterfaceSize();
    // check for orientation change
    if( interfaceSize != mInterfaceSize ){
        updateLayout( interfaceSize );
    }

    if ( !mHasPanelBeenDragged ) {
        // if we're not dragging, animate to current state
        if( mIsPanelOpen ){
            mPanelY += (mPanelOpenY - mPanelY) * 0.25f;
        }
        else {
            mPanelY += (mPanelClosedY - mPanelY) * 0.25f;
        }
    }
    
    mChooserY += (mChooserDestY - mChooserY) * 0.25f;
    mSettingsY += (mSettingsDestY - mSettingsY) * 0.25f;
    
    mPlaylistChooser->setTransform( Matrix44f::createTranslation( Vec3f(0, mChooserY, 0) ) );
    mAlphaChooser->setTransform( Matrix44f::createTranslation( Vec3f(0, mChooserY, 0) ) );
    mSettingsPanel->setTransform( Matrix44f::createTranslation( Vec3f(0, mSettingsY, 0) ) );        

    // don't use mPanelOpenY or current height as a constraint here, 
    // use maximum value because we want things to ease closed
    const float maxPanelY = mInterfaceSize.y - getMaxPanelHeight();
    mPanelY = constrain( mPanelY, maxPanelY, mPanelClosedY );
    
    Matrix44f transform;
    transform.translate( Vec3f( 0, ceil( mPanelY ), 0 ) );
    setTransform( transform );
}
Пример #10
0
	void Camera::Translate(Vector3f aVector)
	{
		Matrix44f translationMatrix;
		translationMatrix.SetPosition(aVector);

		myTransformation = translationMatrix * myTransformation;
	}
Пример #11
0
/** Get a reversed transformation matrix to be used for cameras
 * @param matrix place to place matrix in
 */
void Position::getCameraTransformationMatrix(Matrix44f& matrix)
{			
	// z is reversed
	Vector3f z(-forward.getX(), -forward.getY(), -forward.getZ());

	// get x vector
	Vector3f x;
	x.crossProduct(up, z);

	// matrix is transposed (rows instead of columns)
	#define MAGIC3D_A(row,col)  matrix.data[col*4+row]
		MAGIC3D_A(0, 0) = x.data[0];
		MAGIC3D_A(0, 1) = x.data[1];
		MAGIC3D_A(0, 2) = x.data[2];
		MAGIC3D_A(0, 3) = 0.0;
		MAGIC3D_A(1, 0) = up.data[0];
		MAGIC3D_A(1, 1) = up.data[1];
		MAGIC3D_A(1, 2) = up.data[2];
		MAGIC3D_A(1, 3) = 0.0;
		MAGIC3D_A(2, 0) = z.data[0];
		MAGIC3D_A(2, 1) = z.data[1];
		MAGIC3D_A(2, 2) = z.data[2];
		MAGIC3D_A(2, 3) = 0.0;
		MAGIC3D_A(3, 0) = 0.0;
		MAGIC3D_A(3, 1) = 0.0;
		MAGIC3D_A(3, 2) = 0.0;
		MAGIC3D_A(3, 3) = 1.0;
	#undef MAGIC3D_A
		
	// apply reversed translation
	Matrix44f trans;
	trans.createTranslationMatrix(-location.getX(), -location.getY(), -location.getZ());
	matrix.multiply(trans);
}
Пример #12
0
void PointCloud::Translate(Vector3f aPosition)
{
	Matrix44f translationMatrix;
	translationMatrix.SetPosition(aPosition);


	myOffset = translationMatrix;
}
Пример #13
0
// Render
void SkeletonApp::draw()
{

	// Clear window
	gl::setViewport( getWindowBounds() );
	gl::clear( Colorf::gray( 0.1f ) );

	// We're capturing
	if ( mKinect->isCapturing() ) {

		// Set up 3D view
		gl::setMatrices( mCamera );

		// Iterate through skeletons
		uint32_t i = 0;
		for ( vector<Skeleton>::const_iterator skeletonIt = mSkeletons.cbegin(); skeletonIt != mSkeletons.cend(); ++skeletonIt, i++ ) {

			// Set color
			Colorf color = mKinect->getUserColor( i );

			// Iterate through joints
			for ( Skeleton::const_iterator boneIt = skeletonIt->cbegin(); boneIt != skeletonIt->cend(); ++boneIt ) {

				// Set user color
				gl::color( color );

				// Get position and rotation
				const Bone& bone	= boneIt->second;
				Vec3f position		= bone.getPosition();
				Matrix44f transform	= bone.getAbsoluteRotationMatrix();
				Vec3f direction		= transform.transformPoint( position ).normalized();
				direction			*= 0.05f;
				position.z			*= -1.0f;

				// Draw bone
				glLineWidth( 2.0f );
				JointName startJoint = bone.getStartJoint();
				if ( skeletonIt->find( startJoint ) != skeletonIt->end() ) {
					Vec3f destination	= skeletonIt->find( startJoint )->second.getPosition();
					destination.z		*= -1.0f;
					gl::drawLine( position, destination );
				}

				// Draw joint
				gl::drawSphere( position, 0.025f, 16 );

				// Draw joint orientation
				glLineWidth( 0.5f );
				gl::color( ColorAf::white() );
				gl::drawVector( position, position + direction, 0.05f, 0.01f );

			}

		}

	}

}
Пример #14
0
void Frustum::ExtractFromOGLState() {
  Matrix44f modelview;
  Matrix44f projection;

  glGetFloatv(GL_MODELVIEW_MATRIX, modelview.get_ptr());
  glGetFloatv(GL_PROJECTION_MATRIX, projection.get_ptr());

  Extract(projection * modelview);
}
// T(c) S R T(t) T(-c) => S R T(S^(-1) R^(-1)(c) + t - c)
Matrix44f Trackball::Matrix() const {
    Matrix44f r;
    track.rot.ToMatrix(r);
    Matrix44f sr    = Matrix44f().SetScale(track.sca, track.sca, track.sca) * r;
    Matrix44f s_inv = Matrix44f().SetScale(1/track.sca, 1/track.sca, 1/track.sca);
    Matrix44f t     = Matrix44f().SetTranslate(s_inv*r.transpose()*center + track.tra - center);

    return Matrix44f(sr*t);
}
Пример #16
0
void DecorateBackgroundPlugin::decorateDoc(QAction *a, MeshDocument &m, RichParameterSet * parset,GLArea *gla, QPainter *, GLLogStream &)
{
  static QString lastname("unitialized");
	switch(ID(a))
	{
	  case DP_SHOW_CUBEMAPPED_ENV :
		{
      if(!cm.IsValid() || (lastname != cubemapFileName ) )
      {
        qDebug( "Current CubeMapPath Dir: %s ",qPrintable(cubemapFileName));
        glewInit();
        bool ret = cm.Load(qPrintable(cubemapFileName));
        lastname=cubemapFileName;
        if(! ret ) return;
        //QMessageBox::warning(gla,"Cubemapped background decoration","Warning unable to load cube map images: " + cubemapFileName );
        cm.radius=10;
      }
			if(!cm.IsValid()) return;

      Matrix44f tr;
			glGetv(GL_MODELVIEW_MATRIX,tr);			
			// Remove the translation from the current matrix by simply padding the last column of the matrix
      tr.SetColumn(3,Point4f(0,0,0,1.0));
			//Remove the scaling from the the current matrix by adding an inverse scaling matrix
			float scale = 1.0/pow(tr.Determinant(),1.0f/3.0f);
			Matrix44f Scale; 
			Scale.SetDiagonal(scale);
			tr=tr*Scale;

			glMatrixMode(GL_PROJECTION);
			glPushMatrix();
			glMatrixMode(GL_MODELVIEW);
			glPushMatrix();
				cm.DrawEnvCube(tr);
			glPopMatrix();
			glMatrixMode(GL_PROJECTION);
			glPopMatrix();
			glMatrixMode(GL_MODELVIEW);
    } break;
  case DP_SHOW_GRID :
    {
      emit this->askViewerShot("me");
      Box3f bb=m.bbox();
      float scaleBB = parset->getFloat(BoxRatioParam());
      float majorTick = parset->getFloat(GridMajorParam());
      float minorTick = parset->getFloat(GridMinorParam());
      bool gridSnap = parset->getBool(GridSnapParam());
      bool backFlag = parset->getBool(GridBackParam());
      bool shadowFlag = parset->getBool(ShowShadowParam());
      Color4b backColor = parset->getColor4b(GridColorBackParam());
      Color4b frontColor = parset->getColor4b(GridColorFrontParam());
      bb.Offset((bb.max-bb.min)*(scaleBB-1.0));
      DrawGriddedCube(*m.mm(),bb,majorTick,minorTick,gridSnap,backFlag,shadowFlag,backColor,frontColor,gla);
    } break;
  }
}
Пример #17
0
void DepthShader::SetParameters(va_list uniformList)
{

	Matrix44f mMVP = va_arg(uniformList, Matrix44f);

	m_OpenGL->SetUniformMatrix4f(theProgram, "mMVP", mMVP.GetTranspose());

	m_OpenGL->BindActiveShadowTexture2D(va_arg(uniformList, GLuint));
	m_OpenGL->SetUniform1i(theProgram, "iTexture", 1);
}
Пример #18
0
	ci::Matrix44f CollisionObject::getTransformMatrix() const 
	{ 
		Matrix44f worldTransform;
		if ( mSoftBody != 0 ) {
			worldTransform = getTransformMatrix( mSoftBody ); 
		} else if ( mRigidBody != 0 ) {
			worldTransform = getTransformMatrix( mRigidBody );
		}
		worldTransform.scale( mScale );
		return worldTransform;
	}
Пример #19
0
Matrix44f toMatrix44f( const Leap::Matrix& m )
{
	Matrix44f mtx;
	Leap::FloatArray a = m.toArray4x4();
	for ( size_t i = 0; i < 4; ++i ) {
		size_t j = i * 4;
		Vec4f row( a[ j + 0 ], a[ j + 1 ], a[ j + 2 ], a[ j + 3 ] );
		mtx.setRow( i, row );
	}
	return mtx;
}
Пример #20
0
/** Rotate around in world coordinates
 * @param angle the angle to rotate in radians
 * @param axis the vector to rotate around
 */
void Position::rotate(float angle, const Vector3f& axis)
{
	// create rotation matrix
	Matrix44f rotMat;
	rotMat.createRotationMatrix(angle, axis.getX(), axis.getY(), axis.getZ());

	// transform the up vector
	up.transform(rotMat);

	// transform the forward vector
	forward.transform(rotMat);
}
Пример #21
0
void OccupancyGrid::AddVert(vector<Point3f> &vv, Matrix44d &Tr, int id)
{
	Point3f tmp;
	Matrix44f Trf;
	Trf.Import(Tr);
	vector<Point3f>::iterator vi;
	for(vi=vv.begin();vi!=vv.end();++vi)
    G.Grid( Trf*(*vi) ).Set(id);
	
	VM[id].coverage=0;
	VM[id].area=0;
}
Пример #22
0
	Matrix44f Camera::GetInverse() const
	{
		Matrix44f tempMatrix = myTransformation;
		Vector4f translation(tempMatrix.GetPosition());
		tempMatrix.SetPosition(Vector3f(0.0f, 0.0f, 0.0f));
		translation *= -1;
		translation.w = 1;
		tempMatrix.Transpose();
		translation = translation * tempMatrix;
		tempMatrix.SetPosition(Vector3f(translation.x, translation.y, translation.z));
		return tempMatrix;
	}
/**
 * Transform the coordinate system to match the surface of the wall
 */ 
void Dodecahedron::transformToWallCoordinateSystem( int wall )
{
	Vec3f vCenter = wallCenters[wall];
	Vec3f coordinateSystem[3] = wallCoordinateSystems[wall];
	
	//transform the model matrix to place (0,0,0) in the middle of the wall. this is awesome, took me a while to figure out
	//...probably done the wrong way :)	
	gl::pushModelView();
	Matrix44f transformation = gl::getModelView();
	transformation = transformation.createTranslation(vCenter);
	transformation.rotate(Vec3f::zAxis(), coordinateSystem[2], coordinateSystem[1]);	
	gl::multModelView(transformation);
}
Пример #24
0
	void ColliderCircle::Render(const Matrix44f& aSpace) const
	{
		CU::PoolPointer<GE::Model> model = GE::GfxFactoryWrapper::GetInstance()->GetModelFactory()->GetModel("Sphere");

		Matrix44f circleSpace;
		circleSpace.SetTranslation(myPosition);

		Matrix44f instance = circleSpace * aSpace;
		float radius = myRadius;
		instance.Scale({ radius, radius, radius });

		//CU::EventManager::GetInstance()->AddRenderCommand(CU::RenderCommandInstance(&*model, instance, instance));
	}
//对matrix类型参数的操作
Matrix44f		FilterParameterSet::getMatrix44(QString name) const
{
	const FilterParameter *p=findParameter(name);

	assert(p);
	assert(p->fieldType==FilterParameter::PARMATRIX);
	assert(p->fieldVal.type()==QVariant::List);

	Matrix44f matrix;
	QList<QVariant> matrixVals = p->fieldVal.toList();
	assert(matrixVals.size()==16);
	for(int i=0;i<16;++i)
		matrix.V()[i]=matrixVals[i].toDouble();
			return matrix;
}
Пример #26
0
	void set_translate(Matrix44f &m, float dx, float dy, float dz)
	{
		m.makeIdentity();
		m[0][3] = dx;
		m[1][3] = dy;
		m[2][3] = dz;
	}
Пример #27
0
void MeshViewApp::update()
{
	// Track the time
	float elapsed = (float) getElapsedSeconds() - m_time;
	m_time += elapsed;

	if (m_fileMonitorConfig->hasChanged())
	{
		loadConfig(m_configFileName, true);
	}

	if(m_fileMonitorVert->hasChanged() || m_fileMonitorFrag->hasChanged())
	{
		loadShader(m_shaderFileName);
	}

	if(m_rotateMesh)
	{
		float rotateAngle = elapsed * 0.2f;
		m_matrix.rotate(Vec3f::yAxis(), rotateAngle);
	}

	if(isInitialized())
	{
		m_assimpLoader.setTime(elapsed);
		m_assimpLoader.update();
	}
}
Пример #28
0
void BloomingNeonApp::setup()
{
	// setup our scene Fbo
	mFboScene = gl::Fbo(512, 512);

	// setup our blur Fbo's, smaller ones will generate a bigger blur
	mFboBlur1 = gl::Fbo(512/8, 512/8);
	mFboBlur2 = gl::Fbo(512/8, 512/8);

	// load and compile the shaders
	try { 
		mShaderBlur = gl::GlslProg( loadAsset("blur_vert.glsl"), loadAsset("blur_frag.glsl")); 
		mShaderPhong = gl::GlslProg( loadAsset("phong_vert.glsl"), loadAsset("phong_frag.glsl")); 
	} 
	catch( const std::exception &e ) { 
		console() << e.what() << endl; 
		quit();
	}

	// setup the stuff to render our ducky
	mTransform.setToIdentity();

	gl::Texture::Format format;
	format.enableMipmapping(true);

	mTexture = gl::Texture( loadImage( loadAsset("ducky.png") ), format );

	mMesh.read( loadAsset("ducky.msh") );

	mCamera.setEyePoint( Vec3f(2.5f, 5.0f, 5.0f) );
	mCamera.setCenterOfInterestPoint( Vec3f(0.0f, 2.0f, 0.0f) );
	mCamera.setPerspective( 60.0f, getWindowAspectRatio(), 1.0f, 1000.0f );
}
Пример #29
0
	void set_scale(Matrix44f &m, float sx, float sy, float sz)
	{
		m.makeIdentity();
		m[0][0] = sx;
		m[1][1] = sy;
		m[2][2] = sz;
	}
Пример #30
0
void FBOMultipleTargetsApp::update()
{
	// Rotate the torus by .06 radians around an arbitrary axis
	mTorusRotation.rotate( Vec3f( 0.16666f, 0.333333f, 0.666666f ).normalized(), 0.06f );
	
	// render into our FBO
	renderSceneToFbo();
}