NodeTransitPtr OctreeVisualization::createNodeGeo(OctreePtr, const Octree::OTNodePtr node, Material* GeoMaterial, const Node* BaseGeo) { //Make the Geoemtry NodeRecPtr box = deepCloneTree(BaseGeo); dynamic_cast<Geometry*>(box->getCore())->setMaterial(GeoMaterial); Matrix m; TransformRecPtr box_trans; NodeRecPtr trans_node = makeCoredNode<Transform>(&box_trans); Pnt3f Center; node->getVolume().getCenter(Center); m.setTranslate( Center.x(), Center.y(), Center.z()); const Real32 Offset(0.0f); Vec3f Size; node->getVolume().getSize(Size); m.setScale(Size.x()-(Size.x()*Offset), Size.y()-(Size.y()*Offset), Size.z()-(Size.z()*Offset)); box_trans->setMatrix(m); trans_node->addChild(box); return NodeTransitPtr(trans_node); }
bool TurbulenceParticleAffector::affect(ParticleSystemRefPtr System, Int32 ParticleIndex, const Time& elps) { if(getBeacon() != NULL) { Matrix BeaconToWorld(getBeacon()->getToWorld()); Vec3f translation, tmp; Quaternion tmp2; BeaconToWorld.getTransform(translation,tmp2,tmp,tmp2); Pnt3f particlePos = System->getPosition(ParticleIndex); Real32 distanceFromAffector = particlePos.dist(Pnt3f(translation.x(),translation.y(),translation.z())); if((getMaxDistance() < 0.0) || (distanceFromAffector <= getMaxDistance())) //only affect the particle if it is in range { Real32 Xparam, Yparam, Zparam; Pnt3f pos(System->getPosition(ParticleIndex)); getPerlinDistribution()->setPhase(getPhase()[0]); Xparam = getPerlinDistribution()->generate(pos[0]); getPerlinDistribution()->setPhase(getPhase()[1]); Yparam = getPerlinDistribution()->generate(pos[1]); getPerlinDistribution()->setPhase(getPhase()[2]); Zparam = getPerlinDistribution()->generate(pos[2]); Vec3f fieldAffect(Vec3f(Xparam, Yparam, Zparam)); fieldAffect = fieldAffect * (getAmplitude()* (elps/(OSG::osgClamp<Real32>(1.0f,std::pow(distanceFromAffector,getAttenuation()),TypeTraits<Real32>::getMax())))); System->setVelocity(System->getVelocity(ParticleIndex) + fieldAffect, ParticleIndex); } // end distance conditional } // end null beacon conditional return false; }
bool VortexParticleAffector::affect(ParticleSystemRefPtr System, Int32 ParticleIndex, const Time& elps) { if(getBeacon() != NULL) { Matrix BeaconToWorld(getBeacon()->getToWorld()); Vec3f translation, tmp; Quaternion tmp2; BeaconToWorld.getTransform(translation,tmp2,tmp,tmp2); Pnt3f particlePos = System->getPosition(ParticleIndex); Real32 distanceFromAffector = particlePos.dist(Pnt3f(translation.x(),translation.y(),translation.z())); if((getMaxDistance() < 0.0) || (distanceFromAffector <= getMaxDistance())) //only affect the particle if it is in range { Vec3f particleDirectionFromVortex(particlePos.x() - translation.x(), particlePos.y() - translation.y(), particlePos.z() - translation.z()); particleDirectionFromVortex = particleDirectionFromVortex.cross(getVortexAxis()); particleDirectionFromVortex.normalize(); particleDirectionFromVortex = particleDirectionFromVortex * ((-getMagnitude() * elps)/OSG::osgClamp<Real32>(1.0f,std::pow(distanceFromAffector,getAttenuation()),TypeTraits<Real32>::getMax())); System->setVelocity(particleDirectionFromVortex + System->getVelocity(ParticleIndex),ParticleIndex); } } return false; }
void FModSound::setChannelPosition(const Pnt3f &pos, UInt32 ChannelID) { FMOD::Channel* channel(getChannel(ChannelID)); if(channel != NULL) { FMOD_RESULT result; FMOD_MODE TheMode; result = channel->getMode(&TheMode); FMOD_ERRCHECK(result,"FModSound::setChannelPosition()"); if(result == FMOD_OK && TheMode & FMOD_3D) { FMOD_VECTOR curPos; FMOD_VECTOR curVec; result = channel->get3DAttributes(&curPos, &curVec); FMOD_ERRCHECK(result,"FModSound::setChannelPosition()"); curPos.x = pos.x(); curPos.y = pos.y(); curPos.z = pos.z(); result = channel->set3DAttributes(&curPos, &curVec); FMOD_ERRCHECK(result,"FModSound::setChannelPosition()"); } } }
void SphereVolume::getBounds(Pnt3f &min, Pnt3f &max) const { min.setValues(_center[0] - _radius, _center[1] - _radius, _center[2] - _radius); max.setValues(_center[0] + _radius, _center[1] + _radius, _center[2] + _radius); }
Real32 DistanceLOD::calcDistance(DrawActionBase *pAction, const Matrix &mToWorld) { Matrix m; m.invertFrom(mToWorld); m.mult(pAction->getCameraToWorld()); Pnt3f eyepos; m.mult(eyepos, eyepos); _lastDist = eyepos.dist(getCenter()); return _lastDist; }
void VRMouse::multFull(Matrix _matrix, const Pnt3f &pntIn, Pnt3f &pntOut) { float w = _matrix[0][3] * pntIn[0] + _matrix[1][3] * pntIn[1] + _matrix[2][3] * pntIn[2] + _matrix[3][3]; /*if (w <1) { fstream file("dump.txt", fstream::out | fstream::app); file << w << endl; file.close(); }*/ if(w == TypeTraits<float>::getZeroElement()) { cout << "\nWARNING: w = " << _matrix[0][3] * pntIn[0] << " " << _matrix[1][3] * pntIn[1] << " " << _matrix[2][3] * pntIn[2]; pntOut.setValues( (_matrix[0][0] * pntIn[0] + _matrix[1][0] * pntIn[1] + _matrix[2][0] * pntIn[2] + _matrix[3][0] ), (_matrix[0][1] * pntIn[0] + _matrix[1][1] * pntIn[1] + _matrix[2][1] * pntIn[2] + _matrix[3][1] ), (_matrix[0][2] * pntIn[0] + _matrix[1][2] * pntIn[1] + _matrix[2][2] * pntIn[2] + _matrix[3][2] ) ); } else { w = TypeTraits<float>::getOneElement() / w; pntOut.setValues( (_matrix[0][0] * pntIn[0] + _matrix[1][0] * pntIn[1] + _matrix[2][0] * pntIn[2] + _matrix[3][0] ) * w, (_matrix[0][1] * pntIn[0] + _matrix[1][1] * pntIn[1] + _matrix[2][1] * pntIn[2] + _matrix[3][1] ) * w, (_matrix[0][2] * pntIn[0] + _matrix[1][2] * pntIn[1] + _matrix[2][2] * pntIn[2] + _matrix[3][2] ) * w ); } }
Real32 OctreeAStarAlgorithm::euclideanDistanceCost(Octree::OTNodePtr node, const Pnt3f& Location, Real32 CostPerUnit) { Pnt3f Target; node->getVolume().getCenter(Target); return CostPerUnit * Location.dist(Target); }
bool FrustumVolume::intersect(const Pnt3f &point) const { bool retCode = true; for(Int32 i = 0; i < 6; i++) { if((_planeVec[i].getNormal().x() * point.x() + _planeVec[i].getNormal().y() * point.y() + _planeVec[i].getNormal().z() * point.z() - _planeVec[i].getDistanceFromOrigin() ) < 0.f) { retCode = false; break; } } return retCode; }
void vec2pnttest(void) { Vec3f v (3.f, 3.f, 3.f); const Vec3f cv(2.f, 2.f, 2.f); Pnt3f p(5.f, 5.f, 5.f); const Pnt3f cp(8.f, 8.f, 8.f); v = p.subZero(); fprintf(stderr, "%f %f %f\n", v[0], v[1], v[2]); v = cp.subZero(); fprintf(stderr, "%f %f %f\n", v[0], v[1], v[2]); // p = v; // p = cv; }
Real32 OctreeAStarAlgorithm::manhattanDistanceCost(Octree::OTNodePtr node, const Pnt3f& Location, Real32 CostPerUnit) { Pnt3f Target; node->getVolume().getCenter(Target); return CostPerUnit * (osgAbs(Location.x() - Target.x()) + osgAbs(Location.y() - Target.y()) + osgAbs(Location.z() - Target.z())); }
Pnt3f randomOpenPosition(const Pnt3f& Min, const Pnt3f& Max, OctreePtr TheOctree) { Pnt3f Result; do { Result.setValues(RandomPoolManager::getRandomReal32(Min.x(),Max.x()), RandomPoolManager::getRandomReal32(Min.y(),Max.y()), RandomPoolManager::getRandomReal32(Min.z(),Max.z())); }while(!TheOctree->getNodeThatContains(Result)->isEmpty()); return Result; }
NodeTransitPtr OctreeVisualization::createNodeDistanceLOD(OctreePtr, const Octree::OTNodePtr node, Material* GeoMaterial, const Node* BaseGeo, Real32 Range ) { NodeRecPtr box = deepCloneTree(BaseGeo); dynamic_cast<Geometry*>(box->getCore())->setMaterial(GeoMaterial); //DistanceLOD node DistanceLODRecPtr LOD = DistanceLOD::create(); LOD->editMFRange()->push_back(10.0); NodeRecPtr LODNode = makeNodeFor(LOD); LODNode->addChild(box); LODNode->addChild(makeCoredNode<Group>()); Matrix m; TransformRecPtr box_trans; NodeRecPtr trans_node = makeCoredNode<Transform>(&box_trans); Pnt3f Center; node->getVolume().getCenter(Center); m.setTranslate(Center.x(), Center.y(), Center.z()); const Real32 Offset(0.0f); Vec3f Size; node->getVolume().getSize(Size); m.setScale(Size.x()-(Size.x()*Offset), Size.y()-(Size.y()*Offset), Size.z()-(Size.z()*Offset)); box_trans->setMatrix(m); trans_node->addChild(LODNode); return NodeTransitPtr(trans_node); }
void makeExplosion(Pnt3f Location, Real32 Impulse) { for(UInt32 i(0) ; i<allPhysicsBodies.size() ; ++i) { Vec3f Direction(allPhysicsBodies[i]->getPosition()-Location.subZero()); Real32 Distance(Direction.length()); Direction.normalize(); allPhysicsBodies[i]->addForce(physicsWorld->impulseToForce(physHandler->getStepSize(), Direction*Impulse*(1.0f/Distance))); //The bodies need to be enabled because they may be auto-disabled when they //come to rest //The bodies are not re-enabled untill a new collision is detected allPhysicsBodies[i]->setEnable(true); } }
bool RandomMovementParticleAffector::affect(ParticleSystemRefPtr System, Int32 ParticleIndex, const Time& elps) { //System->setUpdateSecAttribs(false); Real32 x, y, z, age(System->getAge(ParticleIndex)); if(getAttributeAffected() == VELOCITY_ATTRIBUTE) { Vec3f vel = System->getSecVelocity(ParticleIndex); // grab each value independently , and adjust the phase for each // axis, since we have a 3D phase and the 1D distribution only takes // one value Real32 velSum = vel.x() + vel.y() + vel.z(); getPerlinDistribution()->setPhase(getPhase().x() + velSum); x = getPerlinDistribution()->generate(vel.x() + age); getPerlinDistribution()->setPhase(getPhase().y() + velSum); y = getPerlinDistribution()->generate(vel.y() + age); getPerlinDistribution()->setPhase(getPhase().z() + velSum); z = getPerlinDistribution()->generate(vel.z() + age); System->setVelocity(Vec3f(x,y,z) + vel,ParticleIndex); }else // affecting position { Pnt3f pos = System->getSecPosition(ParticleIndex); Real32 posSum = pos.x() + pos.y() + pos.z(); getPerlinDistribution()->setPhase(getPhase().x() + posSum); x = getPerlinDistribution()->generate(pos.x() + age); getPerlinDistribution()->setPhase(getPhase().y() + posSum); y = getPerlinDistribution()->generate(pos.y() + age); getPerlinDistribution()->setPhase(getPhase().z() + posSum); z = getPerlinDistribution()->generate(pos.z() + age); System->setPosition(Pnt3f(x,y,z) + pos.subZero(),ParticleIndex); } return false; }
void C3DSLoader::Draw(Pnt3f pos0,Pnt3f pos1, Pnt3f orient, float scale) { Pnt3f originalGazePos(-pos0.x,-pos0.y,-pos0.z); Pnt3f newGazePos(pos1.x-pos0.x,pos1.y-pos0.y,pos1.z-pos0.z); originalGazePos.normalize(); newGazePos.normalize(); orient.normalize(); float productValue = originalGazePos.x * newGazePos.x + originalGazePos.y * newGazePos.y + originalGazePos.z * newGazePos.z; float cosValue = productValue / 1; float angle = acos(cosValue) * 180 / M_PI; //glPushMatrix(); //glRotatef(angle, 0,1,0); glPushAttrib(GL_CURRENT_BIT); glDisable(GL_TEXTURE_2D); for(int i = 0; i < m_3DModel.numOfObjects; i++) { if(m_3DModel.pObject.size() <= 0) break; t3DObject *pObject = &m_3DModel.pObject[i]; if(pObject->bHasTexture) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_textures[pObject->materialID]); } else glDisable(GL_TEXTURE_2D); glColor3ub(255, 255, 255); glBegin(GL_TRIANGLES); for(int j = 0; j < pObject->numOfFaces; j++) {for(int tex = 0; tex < 3; tex++) { int index = pObject->pFaces[j].vertIndex[tex]; glNormal3f(pObject->pNormals[index].x,pObject->pNormals[index].y, pObject->pNormals[index].z); if(pObject->bHasTexture) { if(pObject->pTexVerts) glTexCoord2f(pObject->pTexVerts[index].x,pObject->pTexVerts[index].y); } else { if(m_3DModel.pMaterials.size() && pObject->materialID>= 0) { BYTE *pColor = m_3DModel.pMaterials[pObject->materialID].color; glColor3ub(pColor[0],pColor[1],pColor[2]); } } //gluLookAt(pos0.x, pos0.y, pos0.z, pos1.x, pos1.y, pos1.z, 0, 1, 0); glVertex3f(pObject->pVerts[index].x + pos0.x, pObject->pVerts[index].y + pos0.y, pObject->pVerts[index].z + pos0.z); } } glEnd(); } glEnable(GL_TEXTURE_2D); glPopAttrib(); //glPopMatrix(); }
void SkeletonBlendedGeometry::calculatePositions(void) { if(getBaseGeometry() == NULL) { //Error SWARNING << "SkeletonBlendedGeometry::calculatePositions(): Base Geometry is NULL." << std::endl; return; if(getPositions() == NULL) { //Error SWARNING << "SkeletonBlendedGeometry::calculatePositions(): Positions is NULL." << std::endl; return; } if(getBaseGeometry()->getPositions() == NULL) { //Error SWARNING << "SkeletonBlendedGeometry::calculatePositions(): Base Geometry Postions is NULL." << std::endl; return; } if(getMFPositionIndexes()->size() != getMFJoints()->size()) { //Error SWARNING << "SkeletonBlendedGeometry::calculatePositions(): Positions Indexes size is not the same as the affecting Joints size." << std::endl; return; } } if(getMFPositionIndexes()->size() != getMFBlendAmounts()->size()) { //Error SWARNING << "SkeletonBlendedGeometry::calculatePositions(): Positions Indexes size is not the same as the affecting blend amount size." << std::endl; return; } Pnt3f CalculatedPoint; Pnt3f PointTemp; Vec3f CalculatedNormal; //Set the values of all points to 0 for (int i(0); i < getPositions()->size(); ++i) { getPositions()->setValue(Pnt3f(0, 0, 0), i); } //Update the Positions and Normals for(UInt32 i(0) ; i < getMFPositionIndexes()->size() ; ++i) { Matrix temp = getJoints(i)->getAbsoluteDifferenceTransformation(); temp.scale(getBlendAmounts(i)); getBaseGeometry()->getPositions()->getValue<Pnt3f>(PointTemp, getPositionIndexes(i)); temp.mult(PointTemp, CalculatedPoint); //temp.mult(getBaseGeometry()->getNormals()->getValue(getPositionIndexes(i)), CalculatedNormal); //Add CalculatedPoint += PointTemp.subZero(); getPositions()->setValue<Pnt3f>(CalculatedPoint, getPositionIndexes(i)); } for(UInt32 i = 0; i < _mfParents.size(); i++) { _mfParents[i]->invalidateVolume(); } _volumeCache.setValid(); _volumeCache.setEmpty(); }
int main(int argc, char **argv) { // OSG init osgInit(argc,argv); // Set up Window TutorialWindow = createNativeWindow(); TutorialWindow->initWindow(); TutorialWindow->setDisplayCallback(display); TutorialWindow->setReshapeCallback(reshape); TutorialKeyListener TheKeyListener; TutorialWindow->addKeyListener(&TheKeyListener); TutorialMouseListener TheTutorialMouseListener; TutorialMouseMotionListener TheTutorialMouseMotionListener; TutorialWindow->addMouseListener(&TheTutorialMouseListener); TutorialWindow->addMouseMotionListener(&TheTutorialMouseMotionListener); // Create the SimpleSceneManager helper mgr = new SimpleSceneManager; // Tell the Manager what to manage mgr->setWindow(TutorialWindow); //Particle System Material LineChunkRefPtr PSLineChunk = LineChunk::create(); PSLineChunk->setWidth(1.0f); BlendChunkRefPtr PSBlendChunk = BlendChunk::create(); PSBlendChunk->setSrcFactor(GL_SRC_ALPHA); PSBlendChunk->setDestFactor(GL_ONE_MINUS_SRC_ALPHA); MaterialChunkRefPtr PSMaterialChunk = MaterialChunk::create(); PSMaterialChunk->setAmbient(Color4f(0.3f,0.3f,0.3f,1.0f)); PSMaterialChunk->setDiffuse(Color4f(0.7f,0.7f,0.7f,1.0f)); PSMaterialChunk->setSpecular(Color4f(0.9f,0.9f,0.9f,1.0f)); PSMaterialChunk->setColorMaterial(GL_AMBIENT_AND_DIFFUSE); PSMaterialChunk->setLit(false); ChunkMaterialRefPtr PSMaterial = ChunkMaterial::create(); PSMaterial->addChunk(PSLineChunk); PSMaterial->addChunk(PSMaterialChunk); PSMaterial->addChunk(PSBlendChunk); //Particle System ParticleSystemRefPtr ExampleParticleSystem = ParticleSystem::create(); ExampleParticleSystem->attachUpdateListener(TutorialWindow); //Create the particles UInt32 NumParticlesToGenerate(2500); Distribution3DRefPtr PositionDistribution = createPositionDistribution(); Distribution3DRefPtr NormalDistribution = createNormalDistribution(); Distribution3DRefPtr ColorDistribution = createColorDistribution(); Distribution3DRefPtr SizeDistribution = createSizeDistribution(); Distribution1DRefPtr LifespanDistribution = createLifespanDistribution(); Distribution3DRefPtr VelocityDistribution = createVelocityDistribution(); Distribution3DRefPtr AccelerationDistribution = createAccelerationDistribution(); Pnt3f PositionReturnValue; Vec3f NormalReturnValue = Vec3f(0.0,0.0f,1.0f); Color4f ColorReturnValue = Color4f(1.0,1.0f,1.0f, 1.0f); Vec3f SizeReturnValue; Time LifespanReturnValue = -1; Vec3f VelocityReturnValue; Vec3f AccelerationReturnValue; for(UInt32 i(0) ; i< NumParticlesToGenerate ; ++i) { if(PositionDistribution != NULL) { PositionReturnValue.setValue(PositionDistribution->generate().getValues()); } if(ColorDistribution != NULL) { Vec3f ColorRGB = ColorDistribution->generate(); ColorReturnValue.setValuesRGBA(ColorRGB[0],ColorRGB[1],ColorRGB[2],1.0f); } if(SizeDistribution != NULL) { SizeReturnValue = SizeDistribution->generate(); } if(LifespanDistribution != NULL) { LifespanReturnValue = LifespanDistribution->generate(); } if(VelocityDistribution != NULL) { VelocityReturnValue = VelocityDistribution->generate(); } ExampleParticleSystem->addParticle(PositionReturnValue, NormalReturnValue, ColorReturnValue, SizeReturnValue, LifespanReturnValue, VelocityReturnValue, AccelerationReturnValue ); } //Particle System Drawer LineParticleSystemDrawerRefPtr ExampleParticleSystemDrawer = LineParticleSystemDrawer::create(); ExampleParticleSystemDrawer->setLineDirectionSource(LineParticleSystemDrawer::DIRECTION_VELOCITY); ExampleParticleSystemDrawer->setLineLengthSource(LineParticleSystemDrawer::LENGTH_SIZE_X); ExampleParticleSystemDrawer->setEndPointFading(Vec2f(0.0f,1.0f)); //Particle System Node ParticleSystemCoreRefPtr ParticleNodeCore = ParticleSystemCore::create(); ParticleNodeCore->setSystem(ExampleParticleSystem); ParticleNodeCore->setDrawer(ExampleParticleSystemDrawer); ParticleNodeCore->setMaterial(PSMaterial); NodeRefPtr ParticleNode = Node::create(); ParticleNode->setCore(ParticleNodeCore); // Make Main Scene Node and add the Torus NodeRefPtr scene = Node::create(); scene->setCore(Group::create()); scene->addChild(ParticleNode); mgr->setRoot(scene); // Show the whole Scene mgr->showAll(); //Open Window Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f); Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5); TutorialWindow->openWindow(WinPos, WinSize, "02DynamicDistribution"); //Enter main Loop TutorialWindow->mainLoop(); osgExit(); return 0; }
vector<Pnt3f> createControlPoints(int lineIndex, Pnt3f p1, Pnt3f p2, int thres){ vector<Pnt3f> result; Vec3f vec = p2 - p1; //cout << "start: "<<p1<<endl; //cout << "end: "<<p2<<endl; float len3D = p1.dist(p2); //cout <<"len3d: "<< len3D<<endl; //MY 2D-POINTS GLdouble modelview[16], projection2[16]; GLint viewport[4]; glGetDoublev(GL_MODELVIEW_MATRIX, modelview); glGetDoublev(GL_PROJECTION_MATRIX, projection2); glGetIntegerv(GL_VIEWPORT, viewport); double x,y,z; gluProject(p1[0], p1[1], p1[2], modelview, projection2, viewport, &x,&y,&z); Pnt2d tmp2d; tmp2d[0] = x; tmp2d[1] = y; double x1,y1,z1; gluProject(p2[0], p2[1], p2[2], modelview, projection2, viewport, &x1,&y1,&z1); Pnt2d tmp2d1; tmp2d1[0] = x1; tmp2d1[1] = y1; // length of 2D edge float len2D = tmp2d.dist(tmp2d1); float stepsize; //if(len2D < 10) // return result; if(len2D > 100){ //cout << "len2d: " << len2D<<endl; float perc = CHECK_PIXEL * 100 / len2D; //cout << "perc: "<<perc<<endl; stepsize = /*len3D */ perc / 100 / thres;} else { stepsize = 0.5 /thres; } // calculate length //float length = sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); //cout << "::: " << length<<endl; //if (len3D < 0.1) // return result; //every 5% of the line //float stepsize = 0.5 / thres; //float stepsize = (len3D * 0.05) / perc; stepsize = stepsize; //cout << "stepsize: " << stepsize<<endl; float high = tmp2d[1]-tmp2d1[1]; //cout << "high: "<<high<<endl; if(-10 < high && high < 10 && stepsize < 0.25){ //return result; stepsize = stepsize / 2; } //float stepsize = random / thres; for(int i(1);i*stepsize <= 1;i++) { //cout << "fuu: "<< i*stepsize<<endl; //cout << " cp at ->"<< p1+i*step*vec; Pnt3f np; np[0] = p1[0] + (stepsize*i) * vec[0]; np[1] = p1[1] + (stepsize*i) * vec[1]; np[2] = p1[2] + (stepsize*i) * vec[2]; // stop - in case of longer line calc //if((stepsize*i) >= len3D) // break; //cout << np[0] << " " << np[1] << " " << np[2] <<endl; //_CONTROLPOINTS.push_back(np); if(rand()%3 == 0) result.push_back(np); //if(thres>7) // result.push_back(np); //if(-10 < high < 10 && stepsize >= 0.25 ) // result.push_back(np); } //if(result.size() < 10) // result.clear(); _CONTROLPOINTS[lineIndex] = result; //exit(0); return result; }
ParticleSystemCore::ParticleSortByViewPosition::ParticleSortByViewPosition(const ParticleSystem* TheSystem, Pnt3f TheCameraPos, bool SortByMinimum) : _System(TheSystem), _CameraPos(TheCameraPos.subZero()), _SortByMinimum(SortByMinimum) { }
void SkyBackground::drawFace( DrawEnv * pEnv, TextureBaseChunk * tex, StateChunk *&oldtex, const Pnt3f &p1, const Pnt3f &p2, const Pnt3f &p3, const Pnt3f &p4, const Vec3f * texCoord) { #if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY) if(tex != NULL) { if(oldtex != NULL) { tex->changeFrom(pEnv, oldtex); } else { tex->activate(pEnv); } if(tex->isTransparent()) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); } // ENRICO: this part holds the informations about // custom texture coordinates // Mess with the best, die like the rest glBegin(GL_QUADS); { #if 0 // strange crash with par drawers. glTexCoord3fv(static_cast<const GLfloat *>( texCoord[0].getValues())); glVertex3fv (static_cast<const GLfloat *>(p1.getValues())); glTexCoord3fv(static_cast<const GLfloat *>( texCoord[1].getValues())); glVertex3fv (static_cast<const GLfloat *>(p2.getValues())); glTexCoord3fv(static_cast<const GLfloat *>( texCoord[2].getValues())); glVertex3fv (static_cast<const GLfloat *>(p3.getValues())); glTexCoord3fv(static_cast<const GLfloat *>( texCoord[3].getValues())); glVertex3fv (static_cast<const GLfloat *>(p4.getValues())); #else glTexCoord3fv(static_cast<const GLfloat *>( texCoord[0].getValues())); glVertex3f (p1[0], p1[1], p1[2]); glTexCoord3fv(static_cast<const GLfloat *>( texCoord[1].getValues())); glVertex3f (p2[0], p2[1], p2[2]); glTexCoord3fv(static_cast<const GLfloat *>( texCoord[2].getValues())); glVertex3f (p3[0], p3[1], p3[2]); glTexCoord3fv(texCoord[3].getValues()); glVertex3f (p4[0], p4[1], p4[2]); #endif } glEnd(); if(tex->isTransparent()) { glDisable(GL_BLEND); } oldtex = tex; } #endif }