Ejemplo n.º 1
0
 void TutorialScene::add(Ref<SceneGraph::GroupNode> group) 
 {
   for (auto& node : group->children) 
   {
     if (Ref<SceneGraph::LightNode> lightNode = node.dynamicCast<SceneGraph::LightNode>()) {
       lights.push_back(lightNode->light);
     } 
     else if (Ref<SceneGraph::TransformNode> xfmNode = node.dynamicCast<SceneGraph::TransformNode>()) {
       if (g_instancing_mode == SceneGraph::INSTANCING_GEOMETRY_GROUP) {
         if (Ref<SceneGraph::GroupNode> groupNode = xfmNode->child.dynamicCast<SceneGraph::GroupNode>()) {
           for (size_t i=0; i<groupNode->size(); i++) {
             addGeometry(groupNode->child(i));
           }
         }
       }
       addGeometry(xfmNode->child);
       addGeometry(node);
     }
     else if (Ref<SceneGraph::PerspectiveCameraNode> cameraNode = node.dynamicCast<SceneGraph::PerspectiveCameraNode>()) {
       cameras.push_back(cameraNode);
     } 
     else {
       addGeometry(node);
     }
     geomID_to_scene.resize(geometries.size(),nullptr);
     geomID_to_inst.resize(geometries.size());
   }
 }
Ejemplo n.º 2
0
void ResourceManager::addTextureMaterialGeometryMesh(
    const std::string&                  id,
          resource_group::ResourceGroup resourceGroup,
    const std::string&                  shader,
    const glm::vec4&                    colour,
    const std::string&                  texturePath,
          unsigned                      frameRate,
          bool                          repeat,
          unsigned                      begin,
          unsigned                      end,
    const std::string&                  geometryPath,
          int                           layer,
          unsigned                      textureFlags,
          unsigned                      materialFlags )
{
    // texture
    addTexture(
        id, resourceGroup, texturePath, frameRate,
        repeat, begin, end, textureFlags );
    // material
    addMaterial( id, resourceGroup, shader, colour, id, materialFlags );
    // geometry
    addGeometry( id, resourceGroup, geometryPath );
    // mesh
    addMesh( id, resourceGroup, layer, id, id );
}
Ejemplo n.º 3
0
void Compound::addGeometry(const Pose3<>& parentPose, Geometry& geometry, SimRobotCore2::CollisionCallback* callback)
{
  // compute pose
  Pose3<> geomPose = parentPose;
  if(geometry.translation)
    geomPose.translate(*geometry.translation);
  if(geometry.rotation)
    geomPose.rotate(*geometry.rotation);

  // create geometry
  dGeomID geom = geometry.createGeometry(Simulation::simulation->staticSpace);
  if(geom)
  {
    dGeomSetData(geom, &geometry);

    // set pose
    dGeomSetPosition(geom, geomPose.translation.x, geomPose.translation.y, geomPose.translation.z);
    dMatrix3 matrix3;
    ODETools::convertMatrix(geomPose.rotation, matrix3);
    dGeomSetRotation(geom, matrix3);
  }

  // handle nested geometries
  for(std::list< ::PhysicalObject*>::const_iterator iter = geometry.physicalDrawings.begin(), end = geometry.physicalDrawings.end(); iter != end; ++iter)
  {
    Geometry* geometry = dynamic_cast<Geometry*>(*iter);
    if(geometry)
      addGeometry(geomPose, *geometry, callback);
  }
}
Ejemplo n.º 4
0
/**
 * Constructs a new WavefrontBody object.
 *
 * @param name the name of this WavefrontBody.
 */
WavefrontBody::WavefrontBody(const QString &name, const QString& filename, double scale)
	: SimBody(name), mReferenceObjectName(0), mLocalPosition(0), mReferenceObject(0)
{
	mScale = new DoubleValue(scale);
	mFilename = new FileNameValue(filename);
	//mFilename->useAsFileName(true);
	mReferenceObjectName = new StringValue("");
	mLocalPosition = new Vector3DValue(0.0, 0.0, 0.0);
	mLocalOrientation = new Vector3DValue(0.0, 0.0, 0.0);

	addParameter("Scale", mScale);
	addParameter("FileName", mFilename);
	addParameter("ReferenceObject", mReferenceObjectName);
	addParameter("LocalPosition", mLocalPosition);
	addParameter("LocalOrientation", mLocalOrientation);

	//Collision and visualization geometries (will be initialized in update().
	mBodyCollisionObject = new CollisionObject(WavefrontGeom(this, filename, scale));

	addGeometry(mBodyCollisionObject->getGeometry());
	mBodyCollisionObject->setMaterialType(mMaterialValue->get());
	mBodyCollisionObject->setTextureType("Default");
	mBodyCollisionObject->getGeometry()->setColor(mGeometryColorValue->get());
	addCollisionObject(mBodyCollisionObject);
}
Ejemplo n.º 5
0
Geometry* ContentManager::geometryFromFile( const char* path )
{
	std::ifstream file(path, std::ios::in|std::ios::binary);

	char header[8];

	file.read( header, 8 );

	int vertexCount = *reinterpret_cast<int*>( header );
	int indexCount = *(reinterpret_cast<int*>( header ) + 1);

	int vertsSize = (vertexCount) * sizeof(Vertex);
	int indexSize = indexCount * sizeof(unsigned short);

	char* data = new char[ vertsSize + indexSize ];

	file.read( data, vertsSize + indexSize );

	unsigned short* indices = reinterpret_cast<unsigned short*>(data);
	Vertex* verts = reinterpret_cast<Vertex*>(data+indexSize);
	
	file.close();

	Geometry* result = addGeometry( verts, vertexCount, indices, indexCount, GL_TRIANGLES );
	delete [] data;
	Vertex::setAttributes( result );
	return result;
}
Ejemplo n.º 6
0
std::unique_ptr<Bucket> CircleLayer::createBucket(StyleBucketParameters& parameters) const {
    auto bucket = std::make_unique<CircleBucket>();

    parameters.eachFilteredFeature(filter, [&] (const auto& feature) {
        bucket->addGeometry(feature.getGeometries());
    });

    return std::move(bucket);
}
Ejemplo n.º 7
0
OGRGeometryCollection::OGRGeometryCollection( const OGRGeometryCollection& other ) :
    OGRGeometry( other ),
    nGeomCount( 0 ),
    papoGeoms( NULL )
{
    for( int i = 0; i < other.nGeomCount; i++ )
    {
        addGeometry( other.papoGeoms[i] );
    }
}
Ejemplo n.º 8
0
std::unique_ptr<Bucket> CircleLayer::Impl::createBucket(BucketParameters& parameters, const GeometryTileLayer& layer) const {
    auto bucket = std::make_unique<CircleBucket>(parameters.mode);

    parameters.eachFilteredFeature(filter, layer, [&] (const auto& feature, std::size_t index, const std::string& layerName) {
        auto geometries = feature.getGeometries();
        bucket->addGeometry(geometries);
        parameters.featureIndex.insert(geometries, index, layerName, id);
    });

    return std::move(bucket);
}
Ejemplo n.º 9
0
GeoTabWidget::GeoTabWidget( QWidget* parent /*= 0*/ )
	: QWidget(parent)
{
	setupUi(this);

	connect(this->openGeoPushButton, SIGNAL(clicked()), this->treeView, SLOT(addGeometry()));
	connect(this->saveGeoPushButton, SIGNAL(clicked()), this->treeView, SLOT(writeToFile()));
	connect(this->removeGeoPushButton, SIGNAL(clicked()), this->treeView, SLOT(removeGeometry()));
	connect(this->treeView, SIGNAL(enableSaveButton(bool)), this, SLOT(enableSaveButton(bool)));
	connect(this->treeView, SIGNAL(enableRemoveButton(bool)), this, SLOT(enableRemoveButton(bool)));
}
Ejemplo n.º 10
0
void QgsRubberBand::setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
{
  if ( !geom )
  {
    reset( mGeometryType );
    return;
  }

  reset( geom->type() );
  addGeometry( geom, layer );
}
Ejemplo n.º 11
0
void QgsRubberBand::setToGeometry( const QgsGeometry& geom, QgsVectorLayer* layer )
{
  if ( geom.isEmpty() )
  {
    reset( mGeometryType );
    return;
  }

  reset( geom.type() );
  addGeometry( geom, layer );
}
bool OgreCollada::MeshWriter::writeGeometry(const COLLADAFW::Geometry* g) {
  // find where this geometry gets instantiated
  GeoUsageMapIter mit = m_geometryUsage.find(g->getUniqueId());
  if (mit == m_geometryUsage.end()) {
    LOG_DEBUG("the geometry with unique ID " + boost::lexical_cast<Ogre::String>(g->getUniqueId()) + " and original ID " + boost::lexical_cast<Ogre::String>(g->getOriginalId()) + " and name " + g->getName() + " has no recorded usage");
    return true;
  }
  for (GeoInstUsageListIter git = mit->second.begin(); git != mit->second.end(); ++git) {
    // add an instance of this geometry to the ManualObject with the specified transform
    if (!addGeometry(g, m_manobj, git->second, git->first))
      return false;
  }
  return true;
}
Ejemplo n.º 13
0
void Compound::createPhysics()
{
  // create geometry
  for(std::list< ::PhysicalObject*>::const_iterator iter = physicalDrawings.begin(), end = physicalDrawings.end(); iter != end; ++iter)
  {
    Geometry* geometry = dynamic_cast<Geometry*>(*iter);
    if(geometry)
      addGeometry(pose, *geometry, 0);
  }

  //
  ::PhysicalObject::createPhysics();

  OpenGLTools::convertTransformation(rotation, translation, transformation);
}
Ejemplo n.º 14
0
Geometry* ContentManager::addGeometry( const Vertex* verts, uint numVerts, GLuint indexingMode )
{
	ushort* indices = new ushort[numVerts];

	for( unsigned int i = 0; i < numVerts; i++ )
	{
		indices[i] = i;
	}

	Geometry* result = addGeometry( verts, numVerts, indices, numVerts, indexingMode );

	delete indices;
	
	return result;
}
Ejemplo n.º 15
0
std::unique_ptr<Bucket> LineLayer::Impl::createBucket(BucketParameters& parameters) const {
    auto bucket = std::make_unique<LineBucket>(parameters.tileID.overscaleFactor());

    bucket->layout = layout;
    bucket->layout.recalculate(CalculationParameters(parameters.tileID.overscaledZ));

    auto& name = bucketName();
    parameters.eachFilteredFeature(filter, [&] (const auto& feature, std::size_t index, const std::string& layerName) {
        auto geometries = feature.getGeometries();
        bucket->addGeometry(geometries);
        parameters.featureIndex.insert(geometries, index, layerName, name);
    });

    return std::move(bucket);
}
Ejemplo n.º 16
0
OGRGeometryCollection& OGRGeometryCollection::operator=( const OGRGeometryCollection& other )
{
    if( this != &other)
    {
        empty();

        OGRGeometry::operator=( other );

        for( int i = 0; i < other.nGeomCount; i++ )
        {
            addGeometry( other.papoGeoms[i] );
        }
    }
    return *this;
}
Ejemplo n.º 17
0
bool 
TeQuerierDB::loadGeometries(TeMultiGeometry& geometries, unsigned int& index)
{
	if((portals_.size()<(index+1)) || (geomRepr_.size()<(index+1)))
		return false;

	TeDatabasePortal* portal = portals_[index]; 
	TeRepresentation rep = geomRepr_[index];
	if(!portal)
		return false; 
	
	bool flag = addGeometry(portal, rep.geomRep_, geometries);

	return flag;
}
Ejemplo n.º 18
0
void ResourceManager::addMaterialGeometryMesh(
    const std::string&                  id,
          resource_group::ResourceGroup resourceGroup,
    const std::string&                  shader,
    const glm::vec4&                    colour,
    const std::string&                  geometryPath,
          int                           layer,
          unsigned                      materialFlags )
{
    // material
    addMaterial( id, resourceGroup, shader, colour, materialFlags );
    // geometry
    addGeometry( id, resourceGroup, geometryPath );
    // mesh
    addMesh( id, resourceGroup, layer, id, id );
}
Ejemplo n.º 19
0
/**
 * Copy constructor. 
 * 
 * @param other the CapsuleBody object to copy.
 */
CapsuleBody::CapsuleBody(const CapsuleBody &other) 
	: Object(), ValueChangedListener(), SimBody(other) 
{
	mRadius = dynamic_cast<DoubleValue*>(getParameter("Radius"));
	mLength = dynamic_cast<DoubleValue*>(getParameter("Length"));

	mBodyCollisionObject = new CollisionObject(
		CapsuleGeom(this, mLength->get(), mRadius->get()));

	mBodyCollisionObject->getGeometry()->setColor(mGeometryColorValue->get());
	mBodyCollisionObject->setMaterialType(mMaterialValue->get());
	mBodyCollisionObject->setTextureType(mTexturesValue->get());

	addGeometry(mBodyCollisionObject->getGeometry());
	addCollisionObject(mBodyCollisionObject);
}
Ejemplo n.º 20
0
/**
 * Constructs a new CapsuleBody.
 */
CapsuleBody::CapsuleBody(const QString &name, double length, double radius)
	: SimBody(name), mRadius(0), mLength(0)
{
	mRadius = new DoubleValue(radius);
	mLength = new DoubleValue(length);

	addParameter("Radius", mRadius);
	addParameter("Length", mLength);

	//Collision and visualization geometries (will be initialized in update().
	mBodyCollisionObject = new CollisionObject(
		CapsuleGeom(this, mLength->get(), mRadius->get()));
	addGeometry(mBodyCollisionObject->getGeometry());
	mBodyCollisionObject->setMaterialType(mMaterialValue->get());
	mBodyCollisionObject->setTextureType("None");
	mBodyCollisionObject->getGeometry()->setColor(mGeometryColorValue->get());
	addCollisionObject(mBodyCollisionObject);
}
Ejemplo n.º 21
0
/**
 * Creates a copy of object body.
 * The default CollisionObject and Geometry of a BoxBody are copied as well.
 * @param body the BoxBody to copy.
 */
BoxBody::BoxBody(const BoxBody &body)
	: Object(), ValueChangedListener(), SimBody(body)
{
	mWidth = dynamic_cast<DoubleValue*>(getParameter("Width"));
	mHeight = dynamic_cast<DoubleValue*>(getParameter("Height"));
	mDepth = dynamic_cast<DoubleValue*>(getParameter("Depth"));

	mBodyCollisionObject = new CollisionObject(
		BoxGeom(this, mWidth->get(), mHeight->get(), mDepth->get()));
	//mBodyCollisionObject = new CollisionObject(WavefrontGeom(this, "alice.obj", 0.1));

	mBodyCollisionObject->getGeometry()->setColor(mGeometryColorValue->get());
	mBodyCollisionObject->setMaterialType(mMaterialValue->get());
	mBodyCollisionObject->setTextureType(mTexturesValue->get());

	addGeometry(mBodyCollisionObject->getGeometry());
	addCollisionObject(mBodyCollisionObject);
}
Ejemplo n.º 22
0
void ResourceManager::addTextureMaterialGeometryMesh(
    const std::string&                  id,
          resource_group::ResourceGroup resourceGroup,
    const std::string&                  shader,
    const std::string&                  texturePath,
    const std::string&                  geometryPath,
          int                           layer,
          unsigned                      textureFlags,
          unsigned                      materialFlags )
{
    // texture
    addTexture( id, resourceGroup, texturePath, textureFlags );
    // material
    addMaterial( id, resourceGroup, shader, id, materialFlags );
    // geometry
    addGeometry( id, resourceGroup, geometryPath );
    // mesh
    addMesh( id, resourceGroup, layer, id, id );
}
Ejemplo n.º 23
0
/**
 * Creates a copy of object body.
 * The default CollisionObject and Geometry of a WavefrontBody are copied as well.
 * @param body the WavefrontBody to copy.
 */
WavefrontBody::WavefrontBody(const WavefrontBody &body) 
	: Object(), ValueChangedListener(), SimBody(body), mReferenceObjectName(0), 
	  mLocalPosition(0), mReferenceObject(0)
{
	mScale = dynamic_cast<DoubleValue*>(getParameter("Scale"));
	mFilename = dynamic_cast<FileNameValue*>(getParameter("FileName"));
	mReferenceObjectName = dynamic_cast<StringValue*>(getParameter("ReferenceObject"));
	mLocalPosition = dynamic_cast<Vector3DValue*>(getParameter("LocalPosition"));
	mLocalOrientation = dynamic_cast<Vector3DValue*>(getParameter("LocalOrientation"));

	mBodyCollisionObject = new CollisionObject(WavefrontGeom(this, mFilename->get(), mScale->get()));

	addGeometry(mBodyCollisionObject->getGeometry());
	mBodyCollisionObject->setMaterialType(mMaterialValue->get());
	mBodyCollisionObject->setTextureType("Default");
	mBodyCollisionObject->getGeometry()->setColor(mGeometryColorValue->get());
	
	addCollisionObject(mBodyCollisionObject);
}
Ejemplo n.º 24
0
 void SceneCache::initDefault() {
     Color errorColor = Color::Magenta;
     ColorTexturePtr errorCTexture(new ConstantTexture<Color>(errorColor));
     addColorTexture(mErrorCode, errorCTexture);
     FloatTexturePtr errorFTexture(new ConstantTexture<float>(0.5f));
     addFloatTexture(mErrorCode, errorFTexture); 
     MaterialPtr errorMaterial(new LambertMaterial(errorCTexture));
     addMaterial(mErrorCode, errorMaterial);
     Geometry* errorGeometry = new Sphere(1.0f);
     errorGeometry->init();
     addGeometry(mErrorCode, errorGeometry);
     ParamSet modelParams;
     modelParams.setString("geometry", mErrorCode);
     modelParams.setString("material", mErrorCode);
     const Primitive* errorPrimitive = 
         ModelPrimitiveCreator().create(modelParams, *this);
     addPrimitive(mErrorCode, errorPrimitive);
     addAreaLight(mErrorCode, NULL);
 }
Ejemplo n.º 25
0
BoxBody::BoxBody(const QString &name, double width, double height, double depth)
		: SimBody(name)
{
	mWidth = new DoubleValue(width);
	mHeight = new DoubleValue(height);
	mDepth = new DoubleValue(depth);

	addParameter("Width", mWidth);
	addParameter("Height", mHeight);
	addParameter("Depth", mDepth);

	//Collision and visualization geometries (will be initialized in update().
	mBodyCollisionObject = new CollisionObject(
		BoxGeom(this, mWidth->get(), mHeight->get(), mDepth->get()));
	//mBodyCollisionObject = new CollisionObject(WavefrontGeom(this, "alice.obj", 0.1));

	addGeometry(mBodyCollisionObject->getGeometry());
	mBodyCollisionObject->setMaterialType(mMaterialValue->get());
	mBodyCollisionObject->setTextureType("Default");
	mBodyCollisionObject->getGeometry()->setColor(mGeometryColorValue->get());
	addCollisionObject(mBodyCollisionObject);
}
Ejemplo n.º 26
0
void MythFrontendCommandLineParser::LoadArguments(void)
{
    addHelp();
    addVersion();
    addWindowed();
    addMouse();
    addSettingsOverride();
    addGeometry();
    addDisplay();
    addUPnP();
    addLogging();

    add(QStringList( QStringList() << "-r" << "--reset" ), "reset", false,
        "Resets appearance settings and language.", "");
    add(QStringList( QStringList() << "-p" << "--prompt" ), "prompt", false,
        "Always prompt for backend selection.", "");
    add(QStringList( QStringList() << "-d" << "--disable-autodiscovery" ),
        "noautodiscovery", false,
        "Prevent frontend from using UPnP autodiscovery.", "");

    add("--jumppoint", "jumppoint", "",
        "Start the frontend at specified jump point.", "")
            ->SetGroup("Startup Behavior");
    add("--runplugin", "runplugin", "",
        "Start the frontend within specified plugin.", "")
            ->SetGroup("Startup Behavior")
            ->SetBlocks("jumppoint");

    add(QStringList( QStringList() << "-G" << "--get-setting" ),
        "getsetting", "", "", "")
            ->SetRemoved("Use the Services API instead.", "0.25");
    add(QStringList( QStringList() << "-u" << "--upgrade-schema" ),
        "upgradeschema", "", "", "")
            ->SetRemoved("The frontend is no longer allowed to update\n"
               "          the primary database schema. Use mythtv-setup\n"
               "          or restart your primary backend to have it\n"
               "          perform the task automatically.", "0.25");
}
Ejemplo n.º 27
0
MainWindow::MainWindow(QWidget *parent) :
	QMainWindow(parent)
{
	ui = new Ui::MainWindow();
	rayDialog = 0;

	animationTimer = NULL;

	ui->setupUi(this);

	// we create a simple timer, with the widget being its parent
	animationTimer = new QTimer(this);
	// the timer will send a signal timeout at regular intervals.
	// whenever this timeout signal occurs, we want it to call our drawOpenGL
	// function
	connect(animationTimer, SIGNAL(timeout()), this, SLOT(drawOpenGL()));
	// we start the timer with a timeout interval of 20ms
	animationTimer->start(20);

	connect(ui->oglwidget, SIGNAL(addedNewGeometry(std::string)), this, SLOT(newGeometryAdded(std::string)));
	connect(ui->oglwidget, SIGNAL(removedGeometry(std::string)), this, SLOT(geometryRemoved(std::string)));

	connect(ui->addModel, SIGNAL(clicked()), this, SLOT(addGeometry()));
	connect(ui->removeModel, SIGNAL(clicked()), this, SLOT(removeGeometry()));

	connect(ui->XRotSlider, SIGNAL(valueChanged(int)), this, SLOT(rotateGeometryX(int)));
	connect(ui->YRotSlider, SIGNAL(valueChanged(int)), this, SLOT(rotateGeometryY(int)));
	connect(ui->ZRotSlider, SIGNAL(valueChanged(int)), this, SLOT(rotateGeometryZ(int)));

	connect(ui->XTransSlider, SIGNAL(valueChanged(int)), this, SLOT(translateGeometryX(int)));
	connect(ui->YTransSlider, SIGNAL(valueChanged(int)), this, SLOT(translateGeometryY(int)));
	connect(ui->ZTransSlider, SIGNAL(valueChanged(int)), this, SLOT(translateGeometryZ(int)));

	connect(ui->orthoProj, SIGNAL(stateChanged(int)), this, SLOT(setOrtho(int)));
	connect(ui->postMult, SIGNAL(stateChanged(int)), this, SLOT(setPost(int)));

	connect(ui->traceButton, SIGNAL(clicked()), this, SLOT(addTraceDialog()));
}
Ejemplo n.º 28
0
bool QgsGeometryCollection::fromWkb( QgsConstWkbPtr &wkbPtr )
{
  if ( !wkbPtr )
  {
    return false;
  }

  QgsWkbTypes::Type wkbType = wkbPtr.readHeader();
  if ( QgsWkbTypes::flatType( wkbType ) != QgsWkbTypes::flatType( mWkbType ) )
    return false;

  mWkbType = wkbType;

  int nGeometries = 0;
  wkbPtr >> nGeometries;

  QVector<QgsAbstractGeometry *> geometryListBackup = mGeometries;
  mGeometries.clear();
  for ( int i = 0; i < nGeometries; ++i )
  {
    std::unique_ptr< QgsAbstractGeometry > geom( QgsGeometryFactory::geomFromWkb( wkbPtr ) );  // also updates wkbPtr
    if ( geom )
    {
      if ( !addGeometry( geom.release() ) )
      {
        qDeleteAll( mGeometries );
        mGeometries = geometryListBackup;
        return false;
      }
    }
  }
  qDeleteAll( geometryListBackup );

  clearCache(); //set bounding box invalid

  return true;
}
void ArticulatedModel::loadHeightfield(const Specification& specification) {
    Part* part = addPart("root");
    Geometry* geom = addGeometry("geom");
    Mesh* mesh = addMesh("mesh", part, geom);
    mesh->material = UniversalMaterial::create();

    shared_ptr<Image1> im = Image1::fromFile(specification.filename);

    geom->cpuVertexArray.hasTangent = false;
    geom->cpuVertexArray.hasTexCoord0 = true;

    const bool spaceCentered = true;
    const bool generateBackFaces = specification.heightfieldOptions.generateBackfaces;
    const Vector2& textureScale  = specification.heightfieldOptions.textureScale;

    Array<Point3> vertex;
    Array<Point2> texCoord;
    MeshAlg::generateGrid
    (vertex, texCoord, mesh->cpuIndexArray,
     im->width(), im->height(), textureScale,
     spaceCentered,
     generateBackFaces,
     CFrame(Matrix4::scale((float)im->width(), 1.0, (float)im->height()).upper3x3()),
     im);


    // Copy the vertex data into the mesh
    geom->cpuVertexArray.vertex.resize(vertex.size());
    CPUVertexArray::Vertex* vertexPtr = geom->cpuVertexArray.vertex.getCArray();
    for (uint32 i = 0; i < (uint32)vertex.size(); ++i) {
        CPUVertexArray::Vertex& v = vertexPtr[i];
        v.position = vertex[i];
        v.texCoord0 = texCoord[i];
        v.tangent.x = v.normal.x = fnan();
    } // for
}
Ejemplo n.º 30
0
	void SimpleLightSource::createCollisionObject() {
		
		if(mBodyCollisionObject != 0) {
			delete mBodyCollisionObject;
		}
		mBodyCollisionObject = 0;

		CylinderGeom geom(this, mRadius->get(), 0.05);
		Quaternion orientation;
		if(mSwitchYZAxes != 0 && mSwitchYZAxes->get()) {
			orientation.setFromAngles(90.0, 0.0, 0.0);
		}
		else {
			orientation.setFromAngles(0.0, 0.0, 90.0);
		}
		geom.setLocalOrientation(orientation);
		mBodyCollisionObject = new CollisionObject(geom);

		addGeometry(mBodyCollisionObject->getGeometry());
		mBodyCollisionObject->setMaterialType("Light");
		mBodyCollisionObject->setTextureType("None");
		mBodyCollisionObject->getGeometry()->setColor(mLightColor->get());
		addCollisionObject(mBodyCollisionObject);
	}