void PhysicsTriMeshGeom::onDestroy() { PhysicsTriMeshGeomPtr tmpPtr(*this); if (tmpPtr->data) dGeomTriMeshDataDestroy(tmpPtr->data); if(vertexData) free((void*)vertexData); if(faceData) free((void*)faceData); if(normalData) free((void*)normalData); geoNode=NullFC; }
void RegisterCombinersChunk::setConstantColors( Color4f &color0, Color4f &color1) { RegisterCombinersChunkPtr tmpPtr(*this); beginEditCP(tmpPtr, PerStageConstantsFieldMask); editColor0() = color0; editColor1() = color1; endEditCP(tmpPtr, PerStageConstantsFieldMask); }
void RegisterCombinersChunk::setCombinerColors(UInt16 which, Color4f &color0, Color4f &color1) { RegisterCombinersChunkPtr tmpPtr(*this); beginEditCP(tmpPtr, PerStageConstantsFieldMask); setPerStageConstants(true); editCombinerColor0(which) = color0; editCombinerColor1(which) = color1; endEditCP(tmpPtr, PerStageConstantsFieldMask); }
/*-------------------------------------------------------------------------*\ - public - \*-------------------------------------------------------------------------*/ void PhysicsTriMeshGeom::onCreate(const PhysicsTriMeshGeom *) { PhysicsTriMeshGeomPtr tmpPtr(*this); tmpPtr->id = dCreateTriMesh(0, 0, 0, 0, 0); data = 0; numVertices = 0; numFaces = 0; vertexData = 0; faceData = 0; normalData = 0; geoNode=NullFC; PhysicsGeomBase::setCategoryBits(dGeomGetCategoryBits(id)); PhysicsGeomBase::setCollideBits(dGeomGetCollideBits(id)); }
// ----------------------------------------------------------------------------- // CUpnpTableBean::ReadLongTextColL // (other items were commented in a header). // ----------------------------------------------------------------------------- // HBufC8* CUpnpTableBean::ReadLongTextColL(const RDbRowSet& aRowSet, const TInt aColNo) { // prepare buffer TInt colLen = aRowSet.ColLength(aColNo); HBufC8* tmp = HBufC8::NewLC(colLen); TPtr8 tmpPtr(tmp->Des()); // read RDbColReadStream colReadStream; colReadStream.OpenLC(aRowSet, aColNo); colReadStream.ReadL(tmpPtr, colLen); // as the length of the HBufC can be grater than requested // clean up CleanupStack::PopAndDestroy(&colReadStream); CleanupStack::Pop(tmp); return tmp; }
void Matrix<ValueType>::ReadFile(const std::string filename) { DEBUGLOG(this, "Matrix::ReadFile()", "filename = " << filename, 1); if (GetFormat() == COO ) { pImplHost->ReadFile(filename); pImpl = pImplHost; } if (GetFormat() == CSR) { std::shared_ptr<HostMatrix<ValueType>> tmpPtr (new HostCOOMatrix<ValueType>()); tmpPtr->ReadFile(filename); pImplHost->CopyFromHost(*(tmpPtr)); pImpl = pImplHost; } DEBUGEND(); }
void PhysicsPlaneGeom::setParams(const Vec4f &value ) { PhysicsPlaneGeomPtr tmpPtr(*this); dGeomPlaneSetParams(tmpPtr->id, value.x(), value.y(), value.z(), value.w()); PhysicsPlaneGeomBase::setParams(value); }
Real32 PhysicsPlaneGeom::getPointDepth(const Vec3f& p) { PhysicsPlaneGeomPtr tmpPtr(*this); return (Real32)dGeomPlanePointDepth(tmpPtr->id, p.x(), p.y(), p.z()); }
Real32 PhysicsHinge2Joint::getParam(Int32 param ) { PhysicsHinge2JointPtr tmpPtr(*this); return dJointGetHinge2Param(tmpPtr->id, param); }
/*-------------------------------------------------------------------------*\ - public - \*-------------------------------------------------------------------------*/ void PhysicsHinge2Joint::onCreate(const PhysicsHinge2Joint *) { PhysicsHinge2JointPtr tmpPtr(*this); //call initJoint! }
Real32 PhysicsHinge2Joint::getAngle2Rate(void) { PhysicsHinge2JointPtr tmpPtr(*this); return dJointGetHinge2Angle2Rate(tmpPtr->id); }
void PhysicsTriMeshGeom::enableTC( Int32 geomClass, bool enable ) { PhysicsTriMeshGeomPtr tmpPtr(*this); dGeomTriMeshEnableTC(tmpPtr->id, geomClass, enable ? 1:0); }
void PhysicsHinge2Joint::setAxis2(const Vec3f &value ) { PhysicsHinge2JointPtr tmpPtr(*this); dJointSetHinge2Axis2(tmpPtr->id, value.x(), value.y(), value.z()); PhysicsHinge2JointBase::setAxis2(value); }
dTriRayCallback* PhysicsTriMeshGeom::getRayCallback(void) { PhysicsTriMeshGeomPtr tmpPtr(*this); return dGeomTriMeshGetRayCallback(tmpPtr->id); }
/***************************************************************************\ * Field Set * \***************************************************************************/ void PhysicsTriMeshGeom::setGeometryNode(NodePtr& node) { PhysicsTriMeshGeomPtr tmpPtr(*this); GeometryPtr geo = GeometryPtr::dcast(node->getCore()); if(geo!=NullFC) { calcVertexNormals(geo, deg2rad( 30)); separateProperties(geo); createSingleIndex(geo); GeoPositions3f::StoredFieldType* positions = GeoPositions3fPtr::dcast( geo->getPositions())->getFieldPtr(); GeoIndicesUI32::StoredFieldType* indices = GeoIndicesUI32Ptr::dcast( geo->getIndices())->getFieldPtr(); GeoNormals3f::StoredFieldType* normals = GeoNormals3fPtr::dcast( geo->getNormals())->getFieldPtr(); GeoPTypesPtr geoTypes = geo->getTypes(); bool triangles = false; //has to be some triangle soup! for( Int32 i=0; i < geoTypes->size(); ++i) { switch( geoTypes->getValue(i)) { case GL_TRIANGLES: triangles=true; break; case GL_TRIANGLE_STRIP: triangles=true; break; case GL_TRIANGLE_FAN: triangles=true; break; } } UInt32 vertexCount = GeoPositions3fPtr::dcast(geo->getPositions())->getSize(); UInt32 vertexStride = 3*sizeof(Real32); UInt32 indexCount = GeoIndicesUI32Ptr::dcast(geo->getIndices())->getSize(); UInt32 indexStride = 3*sizeof(UInt32); //pass the pointers to ODE if(tmpPtr->data) dGeomTriMeshDataDestroy(tmpPtr->data); tmpPtr->data = dGeomTriMeshDataCreate(); if(triangles) { dGeomTriMeshDataBuildSingle(tmpPtr->data, (Real32*)&positions->front(), vertexStride, vertexCount, (Int32*)&indices->front(), indexCount, indexStride/* just can't use this, (Real32*)&normals->front()*/); tmpPtr->setData(tmpPtr->data); /* use this method if you build with single precision dGeomTriMeshDataBuildSingle1(tmpPtr->data, (Real32*)&positions->front(), vertexStride, vertexCount, (Int32*)&indices->front(), indexCount, indexStride, (Real32*)&normals->front()); tmpPtr->setData(tmpPtr->data); */ } else { FWARNING(("No triangle mesh given to ODE! Convert to triangles first!\n")); tmpPtr->setData(tmpPtr->data); } } tmpPtr->geoNode=node; PhysicsTriMeshGeomBase::setGeometryNode(node); }
void PhysicsTriMeshGeom::clearTCCache(void) { PhysicsTriMeshGeomPtr tmpPtr(*this); dGeomTriMeshClearTCCache(tmpPtr->id); }
bool PhysicsTriMeshGeom::isTCEnabled( Int32 geomClass) { PhysicsTriMeshGeomPtr tmpPtr(*this); return dGeomTriMeshIsTCEnabled(tmpPtr->id, geomClass) == 1; }
void PhysicsTriMeshGeom::setRayCallback( dTriRayCallback* callback ) { PhysicsTriMeshGeomPtr tmpPtr(*this); dGeomTriMeshSetRayCallback(tmpPtr->id, callback); }
void PhysicsHinge2Joint::setParam(Int32 param, Real32 value ) { PhysicsHinge2JointPtr tmpPtr(*this); dJointSetHinge2Param(tmpPtr->id, param, value); }
void PhysicsHinge2Joint::setWorld(const PhysicsWorldPtr &value ) { PhysicsHinge2JointPtr tmpPtr(*this); tmpPtr->id = dJointCreateHinge2(value->getWorldID(), 0); PhysicsJointBase::setWorld(value); }
void PhysicsTriMeshGeom::setData( dTriMeshDataID data ) { PhysicsTriMeshGeomPtr tmpPtr(*this); dGeomTriMeshSetData(tmpPtr->id, data); }