当前位置: 首页>>代码示例>>C++>>正文


C++ Point3F函数代码示例

本文整理汇总了C++中Point3F函数的典型用法代码示例。如果您正苦于以下问题:C++ Point3F函数的具体用法?C++ Point3F怎么用?C++ Point3F使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Point3F函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AssertFatal

void SceneObject::resetObjectBox()
{
   AssertFatal( mWorldBox.isValidBox(), "SceneObject::resetObjectBox - Bad world box!" );

   mObjBox = mWorldBox;
   mWorldToObj.mul( mObjBox );

   Point3F objScale( mObjScale );
   objScale.setMax( Point3F( (F32)POINT_EPSILON, (F32)POINT_EPSILON, (F32)POINT_EPSILON ) );
   mObjBox.minExtents.convolveInverse( objScale );
   mObjBox.maxExtents.convolveInverse( objScale );

   AssertFatal( mObjBox.isValidBox(), "SceneObject::resetObjectBox - Bad object box!" );

   // Update the mWorldSphere from mWorldBox
   mWorldBox.getCenter( &mWorldSphere.center );
   mWorldSphere.radius = ( mWorldBox.maxExtents - mWorldSphere.center ).len();

   // Update scene managers.
   
   for( SceneObjectLink* link = mSceneObjectLinks; link != NULL; 
        link = link->getNextLink() )
      link->update();
}
开发者ID:Bloodknight,项目名称:T3D-MIT-GMK-Port,代码行数:24,代码来源:sceneObject.cpp

示例2: scaledObjMat

void GFXDrawUtil::drawObjectBox( const GFXStateBlockDesc &desc, const Point3F &size, const Point3F &pos, const MatrixF &objMat, const ColorI &color )
{
   GFXTransformSaver saver;

   mDevice->setStateBlockByDesc( desc );

   MatrixF scaledObjMat( true );
   scaledObjMat = objMat;

   scaledObjMat.scale( size );
   scaledObjMat.setPosition( pos );

   PrimBuild::color( color );
   PrimBuild::begin( GFXLineList, 48 );

   static const Point3F cubePoints[8] = 
   {
      Point3F(-0.5, -0.5, -0.5), Point3F(-0.5, -0.5,  0.5), Point3F(-0.5,  0.5, -0.5), Point3F(-0.5,  0.5,  0.5),
      Point3F( 0.5, -0.5, -0.5), Point3F( 0.5, -0.5,  0.5), Point3F( 0.5,  0.5, -0.5), Point3F( 0.5,  0.5,  0.5)
   };

   // 8 corner points of the box   
   for ( U32 i = 0; i < 8; i++ )
   {
      //const Point3F &start = cubePoints[i];  

      // 3 lines per corner point
      for ( U32 j = 0; j < 3; j++ )
      {
         Point3F start = cubePoints[i];
         Point3F end = start;
         end[j] *= 0.8f;

         scaledObjMat.mulP(start);
         PrimBuild::vertex3fv(start);
         scaledObjMat.mulP(end);
         PrimBuild::vertex3fv(end);            
      }
   }

   PrimBuild::end();
}
开发者ID:mray,项目名称:terminal-overload,代码行数:42,代码来源:gfxDrawUtil.cpp

示例3: do_runtime_substitutions

bool afxEA_ZodiacPlane::ea_start()
{
  if (!zode_data)
  {
    Con::errorf("afxEA_ZodiacPlane::ea_start() -- missing or incompatible datablock.");
    return false;
  }

  do_runtime_substitutions();

  if (!zode_data->use_full_xfm)
    zode_angle_offset = calc_facing_angle();

  switch (zode_data->face_dir)
  {
  case afxZodiacPlaneData::FACES_UP:
    aa_rot.set(Point3F(0.0f,0.0f,1.0f),0.0f);
    break;  
  case afxZodiacPlaneData::FACES_DOWN:
    aa_rot.set(Point3F(0.0f,0.0f,-1.0f),0.0f);
    break;  
  case afxZodiacPlaneData::FACES_FORWARD:
    aa_rot.set(Point3F(0.0f,1.0f,0.0f),0.0f);
    break;  
  case afxZodiacPlaneData::FACES_BACK:
    aa_rot.set(Point3F(0.0f,-1.0f,0.0f),0.0f);
    break;  
  case afxZodiacPlaneData::FACES_RIGHT:
    aa_rot.set(Point3F(1.0f,0.0f,0.0f),0.0f);
    break;  
  case afxZodiacPlaneData::FACES_LEFT:
    aa_rot.set(Point3F(-1.0f,0.0f,0.0f),0.0f);
    break;  
  }

  return true;
}
开发者ID:wwhitehead,项目名称:Torque3D-plus-AFX,代码行数:37,代码来源:afxEA_ZodiacPlane.cpp

示例4: SetUp

 virtual void SetUp()
 {
    // Build planes for a unit cube centered at the origin.
    // Note that the normals must be facing inwards.
    planes.push_back(PlaneF(Point3F(-0.5f,  0.f,   0.f ), Point3F( 1.f,  0.f,  0.f)));
    planes.push_back(PlaneF(Point3F( 0.5f,  0.f,   0.f ), Point3F(-1.f,  0.f,  0.f)));
    planes.push_back(PlaneF(Point3F( 0.f,  -0.5f,  0.f ), Point3F( 0.f,  1.f,  0.f)));
    planes.push_back(PlaneF(Point3F( 0.f,   0.5f,  0.f ), Point3F( 0.f, -1.f,  0.f)));
    planes.push_back(PlaneF(Point3F( 0.f,   0.f,  -0.5f), Point3F( 0.f,  0.f,  1.f)));
    planes.push_back(PlaneF(Point3F( 0.f,   0.f,   0.5f), Point3F( 0.f,  0.f, -1.f)));
 }
开发者ID:03050903,项目名称:Torque3D,代码行数:11,代码来源:mPolyhedronTest.cpp

示例5: setProjectionOffset

void Frustum::setProjectionOffset(const Point2F& offsetMat)
{
   mProjectionOffset = offsetMat;
   mProjectionOffsetMatrix.identity();
   mProjectionOffsetMatrix.setPosition(Point3F(mProjectionOffset.x, mProjectionOffset.y, 0.0f));
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:6,代码来源:frustum.cpp

示例6: Point3F

//-----------------------------------------------------------------------------
// Torque 3D
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

#include "T3D/gameTSCtrl.h"
#include "console/consoleTypes.h"
#include "T3D/gameBase.h"
#include "T3D/gameConnection.h"
#include "T3D/shapeBase.h"
#include "T3D/gameFunctions.h"

//---------------------------------------------------------------------------
// Debug stuff:
Point3F lineTestStart = Point3F(0, 0, 0);
Point3F lineTestEnd =   Point3F(0, 1000, 0);
Point3F lineTestIntersect =  Point3F(0, 0, 0);
bool gSnapLine = false;

//----------------------------------------------------------------------------
// Class: GameTSCtrl
//----------------------------------------------------------------------------
IMPLEMENT_CONOBJECT(GameTSCtrl);

GameTSCtrl::GameTSCtrl()
{
}

//---------------------------------------------------------------------------
bool GameTSCtrl::onAdd()
{
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:31,代码来源:gameTSCtrl.cpp

示例7: F32

bool AtlasGeomChunkTracer::castLeafRay(const Point2I pos, const Point3F &start,
                                       const Point3F &end, const F32 &startT, 
                                       const F32 &endT, RayInfo *info)
{
   if(AtlasInstance::smRayCollisionDebugLevel == AtlasInstance::RayCollisionDebugToColTree)
   {
      const F32 invSize = 1.f / F32(BIT(mTreeDepth-1));

      // This is a bit of a hack. But good for testing.
      // Do collision against the collision tree leaf bounding box and return the result...
      F32 t; Point3F n;
      Box3F box;

      box.minExtents.set(Point3F(F32(pos.x  ) * invSize, F32(pos.y  ) * invSize, getSquareMin(0, pos)));
      box.maxExtents.set(Point3F(F32(pos.x+1) * invSize, F32(pos.y+1) * invSize, getSquareMax(0, pos)));

      //Con::printf("   checking at xy = {%f, %f}->{%f, %f}, [%d, %d]", start.x, start.y, end.x, end.y, pos.x, pos.y);

      if(box.collideLine(start, end, &t, &n) && t >= startT && t <= endT)
      {
         info->t      = t;
         info->normal = n;
         return true;
      }

      return false;
   }
   else if( AtlasInstance::smRayCollisionDebugLevel == AtlasInstance::RayCollisionDebugToMesh )
   {
	   bool haveHit = false;
	   U32 currentIdx = 0;
	   U32 numIdx = mChunk->mIndexCount;
	   F32 bestT = F32_MAX;
	   U32 bestTri = -1;
	   Point2F bestBary;

	   while( !haveHit && currentIdx < numIdx )
	   {
		   const Point3F& a = mChunk->mVert[ mChunk->mIndex[ currentIdx ] ].point;
		   const Point3F& b = mChunk->mVert[ mChunk->mIndex[ currentIdx + 1 ] ].point;
		   const Point3F& c = mChunk->mVert[ mChunk->mIndex[ currentIdx + 2 ] ].point;

		   F32     localT;
		   Point2F localBary;

		   // Do the cast, using our conveniently precalculated ray delta...
		   if(castRayTriangle(mRayStart, mRayDelta, a,b,c, localT, localBary))
		   {
			   if(localT < bestT)
			   {
				   // And it hit before anything else we've seen.
				   bestTri  = currentIdx;
				   bestT    = localT;
				   bestBary = localBary;

				   haveHit = true;
			   }
		   }

		   currentIdx += 3;
	   }

      // Fill in extra info for the hit.
      if(!haveHit)
         return false;

      // Calculate the normal, we skip that for the initial check.
      Point3F norm; // Hi norm!

      const Point3F &a = mChunk->mVert[mChunk->mIndex[bestTri+0]].point;
      const Point3F &b = mChunk->mVert[mChunk->mIndex[bestTri+1]].point;
      const Point3F &c = mChunk->mVert[mChunk->mIndex[bestTri+2]].point;

      const Point2F &aTC = mChunk->mVert[mChunk->mIndex[bestTri+0]].texCoord;
      const Point2F &bTC = mChunk->mVert[mChunk->mIndex[bestTri+1]].texCoord;
      const Point2F &cTC = mChunk->mVert[mChunk->mIndex[bestTri+2]].texCoord;

      // Store everything relevant into the info structure.
      info->t = bestT;

      const Point3F e0 = b-a;
      const Point3F e1 = c-a;

      info->normal = mCross(e1, e0);
      info->normal.normalize();

      // Calculate and store the texture coords.
      const Point2F e0TC = bTC-aTC;
      const Point2F e1TC = cTC-aTC;
      info->texCoord = e0TC * bestBary.x + e1TC * bestBary.y + aTC;

      // Return true, we hit something!
      return true;
   }
   else
   {
      // Get the triangle list...
      U16 *triOffset = mChunk->mColIndicesBuffer + 
         mChunk->mColIndicesOffsets[pos.x * BIT(mChunk->mColTreeDepth-1) + pos.y];

//.........这里部分代码省略.........
开发者ID:dodong471520,项目名称:pap,代码行数:101,代码来源:atlasGeomCollision.cpp

示例8: Point3F

/**
 * Clears the aim location and sets it to the bot's
 * current destination so he looks where he's going
 */
void AIPlayer::clearAim()
{
   mAimObject = 0;
   mAimLocationSet = false;
   mAimOffset = Point3F(0.0f, 0.0f, 0.0f);
}
开发者ID:Bloodknight,项目名称:T3D-MIT-GMK-Port,代码行数:10,代码来源:aiPlayer.cpp

示例9: getEyeTransform

/**
 * This method calculates the moves for the AI player
 *
 * @param movePtr Pointer to move the move list into
 */
bool AIPlayer::getAIMove(Move *movePtr)
{
   *movePtr = NullMove;

   // Use the eye as the current position.
   MatrixF eye;
   getEyeTransform(&eye);
   Point3F location = eye.getPosition();
   Point3F rotation = getRotation();

#ifdef TORQUE_NAVIGATION_ENABLED
   if(mDamageState == Enabled)
   {
      if(mMoveState != ModeStop)
         updateNavMesh();
      if(!mFollowData.object.isNull())
      {
         if(mPathData.path.isNull())
         {
            if((getPosition() - mFollowData.object->getPosition()).len() > mFollowData.radius)
               followObject(mFollowData.object, mFollowData.radius);
         }
         else
         {
            if((mPathData.path->mTo - mFollowData.object->getPosition()).len() > mFollowData.radius)
               repath();
            else if((getPosition() - mFollowData.object->getPosition()).len() < mFollowData.radius)
            {
               clearPath();
               mMoveState = ModeStop;
            throwCallback("onTargetInRange");
            }
            else if((getPosition() - mFollowData.object->getPosition()).len() < mAttackRadius)
            {
            throwCallback("onTargetInFiringRange");
            }
         }
      }
   }
#endif // TORQUE_NAVIGATION_ENABLED

   // Orient towards the aim point, aim object, or towards
   // our destination.
   if (mAimObject || mAimLocationSet || mMoveState != ModeStop) 
   {
      // Update the aim position if we're aiming for an object
      if (mAimObject)
         mAimLocation = mAimObject->getPosition() + mAimOffset;
      else
         if (!mAimLocationSet)
            mAimLocation = mMoveDestination;

      F32 xDiff = mAimLocation.x - location.x;
      F32 yDiff = mAimLocation.y - location.y;

      if (!mIsZero(xDiff) || !mIsZero(yDiff)) 
      {
         // First do Yaw
         // use the cur yaw between -Pi and Pi
         F32 curYaw = rotation.z;
         while (curYaw > M_2PI_F)
            curYaw -= M_2PI_F;
         while (curYaw < -M_2PI_F)
            curYaw += M_2PI_F;

         // find the yaw offset
         F32 newYaw = mAtan2( xDiff, yDiff );
         F32 yawDiff = newYaw - curYaw;

         // make it between 0 and 2PI
         if( yawDiff < 0.0f )
            yawDiff += M_2PI_F;
         else if( yawDiff >= M_2PI_F )
            yawDiff -= M_2PI_F;

         // now make sure we take the short way around the circle
         if( yawDiff > M_PI_F )
            yawDiff -= M_2PI_F;
         else if( yawDiff < -M_PI_F )
            yawDiff += M_2PI_F;

         movePtr->yaw = yawDiff;

         // Next do pitch.
         if (!mAimObject && !mAimLocationSet) 
         {
            // Level out if were just looking at our next way point.
            Point3F headRotation = getHeadRotation();
            movePtr->pitch = -headRotation.x;
         }
         else 
         {
            // This should be adjusted to run from the
            // eye point to the object's center position. Though this
            // works well enough for now.
//.........这里部分代码省略.........
开发者ID:elfprince13,项目名称:Torque3D,代码行数:101,代码来源:aiPlayer.cpp

示例10: v0

void PlanetRenderImage::render(TSRenderContext &rc)
{
   // A simple planet culling scheme would be to dot the line of sight
   // with the vector from the camera to the planet.  This would eliminate
   // the length test of v below (after m_cross((Point3F)plane, vpNormal, &v))
   GFXSurface *gfxSurface = rc.getSurface();

   gfxSurface->setHazeSource(GFX_HAZE_NONE);
   gfxSurface->setShadeSource(GFX_SHADE_CONSTANT);
   gfxSurface->setAlphaSource(GFX_ALPHA_NONE);
	gfxSurface->setFillMode(GFX_FILL_TEXTURE);
	gfxSurface->setTransparency(FALSE);
   gfxSurface->setTexturePerspective(FALSE);

   gfxSurface->setConstantShade(1.0f);

   int textureHeight;
   gfxSurface->setTextureMap(texture);
   textureHeight = texture->height;
   
   TSCamera *camera = rc.getCamera();
  
   TS::PointArray *pointArray = rc.getPointArray();
   pointArray->reset();
   pointArray->useIntensities(false);
   pointArray->useTextures(textCoord);
   pointArray->useTextures(true);
	pointArray->setVisibility( TS::ClipMask );

   // find out how high the bitmap is at 100% as projected onto the viewport,
   // texel:pixel will be 1:1 at 640x480
   //const RectF &worldVP  = camera->getWorldViewport();
   //const float h = textureHeight*((worldVP.upperL.y - worldVP.lowerR.y)/480.0f);
   //const float sz = 0.5*distance*(h/camera->getNearDist());

   // find the position of the planet
   Point3F displacement = camera->getTCW().p;
   //displacement.z *= -(distance - visibleDistance)/visibleDistance;
   displacement.z = -displacement.z*(distance/(visibleDistance*1.5f));
   Point3F pos = position;
   pos += displacement;
 
   // find the normal to the view plane in world coords
   Point3F v0(0.0f, 1.0f, 0.0f), vpNormal;
   m_mul(v0, (RMat3F)camera->getTCW(), &vpNormal);
   vpNormal.normalize();

   // construct the plane that the camera, planet pos & celestial NP all
   // lie on
   PlaneF plane(pos, camera->getTCW().p, 
      Point3F(displacement.x, displacement.y, displacement.z + distance));

   // the cross product of the VP normal and the normal to the plane just
   // constructed is the up vector for the planet
   Point3F v;
   m_cross((Point3F)plane, vpNormal, &v);
   if (IsEqual(v.len(), 0.0f))
      // planet is directly to the right or left of camera
      return;
   v.normalize();
   
   // cross the up with the normal and we get the right vector
   Point3F u;
   m_cross(vpNormal, v, &u);
   u *= size;
   v *= size;

   TS::VertexIndexPair V[6];
   Point3F ul = pos;
   ul -= u; ul += v;
   V[0].fVertexIndex   = pointArray->addPoint(ul);
   V[0].fTextureIndex  = 0;
   Point3F ur = pos;
   ur += u; ur += v;
   V[1].fVertexIndex   = pointArray->addPoint(ur);
   V[1].fTextureIndex  = 1;
   Point3F lr = pos;
   lr += u; lr -= v;
   V[2].fVertexIndex   = pointArray->addPoint(lr);
   V[2].fTextureIndex  = 2;
   Point3F ll = pos;
   ll -= u; ll -=v;
   V[3].fVertexIndex   = pointArray->addPoint(ll);
   V[3].fTextureIndex  = 3;
	if (gfxSurface->getCaps() & GFX_DEVCAP_SUPPORTS_CONST_ALPHA)
	   gfxSurface->setZTest(GFX_NO_ZTEST);
   pointArray->drawPoly(4, V, 0);
	if (gfxSurface->getCaps() & GFX_DEVCAP_SUPPORTS_CONST_ALPHA)
	   gfxSurface->setZTest(GFX_ZTEST_AND_WRITE);
   if(lensFlare) {
      TS::TransformedVertex vx;
      camera->transformProject(pos, &vx);
      bool vis = vx.fStatus & TS::TransformedVertex::Projected;
      lensFlare->setSunPos(vis, vx.fPoint, pos);
   }
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:96,代码来源:simPlanet.cpp

示例11: unload

void SimPlanet::load()
{
   unload();
   
   if ((textureTag != 0) && (!manager->isServer())) {
      ResourceManager &rm = *SimResource::get(manager);
      const char *filename = SimTagDictionary::getString(manager, textureTag);
   
      // load the texture
      hTexture = rm.load(filename);
      AssertWarn((bool)hTexture, 
         avar("Error reading bitmap file \"%s\"", filename));
      // don't want to assert fatal because we don't want to bring down
      // the mission editor
      if ((bool)hTexture) {
         planet.texture = (GFXBitmap *)hTexture;
         addToSet(SimRenderSetId);
         inRenderSet = true;
      }         
   }   
   else
      planet.texture = NULL;

   // calculate planet position in world coordinates
   // add 90 to azimuth so that zero is at up Y axis
   if (incidence > 89.0f)
      incidence = 89.0f;
   if (incidence < -89.0f)
      incidence = -89.0f;
   const float az = azimuth + 90.0f;
   const float c = planet.distance*m_cos(DEGRAD*incidence);
   planet.position = Point3F(c*m_cos(DEGRAD*az), c*m_sin(DEGRAD*az), planet.distance*m_sin(DEGRAD*incidence));

   // initialize light if any
   Point3F direction = planet.position;
   direction.normalize();
   direction *= -1.0f;

   if (castShadows) {
      // set static data items
      shadowDirection = direction;
      shadows = true;
   }


   light.setAim(direction);
   //light.setType(TS::Light::LightDirectional);
   light.setType(TS::Light::LightDirectionalWrap);
   light.setIntensity(intensity.red, intensity.green, intensity.blue);
   if (intensity.red > 0.0f || intensity.green > 0.0f || intensity.blue > 0.0f 
      || ambient.red > 0.0f || ambient.green > 0.0f || ambient.blue > 0.0f) {
      addToSet(SimLightSetId);
      inLightSet = true;
      lensFlare.setColor(intensity);
   }
   planet.lensFlare = useLensFlare ? &lensFlare : NULL;

   // initialize static texture coordinates
   textCoord[0].x = 0.0f;  textCoord[0].y = 0.0f;
   textCoord[1].x = 1.0f;  textCoord[1].y = 0.0f;
   textCoord[2].x = 1.0f;  textCoord[2].y = 1.0f;
   textCoord[3].x = 0.0f;  textCoord[3].y = 1.0f;

   setMaskBits(Modified);
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:65,代码来源:simPlanet.cpp

示例12: vpSize


//.........这里部分代码省略.........
   gfxSurface->setAlphaSource(GFX_ALPHA_TEXTURE);

   TS::VertexIndexPair V[4];
   // if it was in the screen, go ahead and draw the lens flare.
   TSCamera *camera = rc.getCamera();
   RectI const &screenVp = camera->getScreenViewport();
   const Point2F vpSize(screenVp.lowerR.x - screenVp.upperL.x, screenVp.upperL.y + screenVp.lowerR.y);
   // preserve relative size of the textures, they should be
   // 1:1 on a 640x480 viewport
   Point2F vpScale(vpSize.x/640.0f, vpSize.y/480.0f);
   float scrSize = min(vpSize.x, vpSize.y);
   Point2F sunP(sunPosProjected.x, sunPosProjected.y);
   Point2F delta((screenVp.upperL.x + screenVp.lowerR.x) >> 1, (screenVp.upperL.y + screenVp.lowerR.y) >> 1);
   
   // find vector of the flare
   delta -= sunP;
   float deltaLen = delta.len();
   float deltaFrac = 2.0f*deltaLen / scrSize;
   float constAlpha = .5f*(1.0f - deltaFrac);
   if (constAlpha <= 0.0f)
   {
		if (renderCount == 1)
			renderCount = 0;
      return;
	}

   if (root && renderCount%15 == 1) {
      // do a LOS query, see if anything is in the way
      SimCollisionInfo collision;
      SimContainerQuery query;
      query.id    = 0;
      query.type  = SimContainerQuery::DefaultDetail;
      query.mask  = -1;
      Vector3F v = sunPosWorld - camera->getTCW().p;
      v.normalizef();
      v *= 2.0f;
      query.box.fMin = camera->getTCW().p + v;
      query.box.fMax = sunPosWorld;
      if (root->findLOS(query, &collision, SimCollisionImageQuery::High)) {
         obscured = true;
         return;
      }
   }
   obscured = false;
   gfxSurface->setConstantAlpha(constAlpha);
   
   // generate rotated box info
   float angle;
   if (delta.x == 0.0f && delta.y == 0.0f)
      angle = 0.0f;
   else
      angle = m_atan(delta.x, delta.y) - M_PI/2.0f;
   float c = m_cos(angle), s = m_sin(angle);
   float a = c*(-1.0f) - s*(-1.0f), b = s*(-1.0f) + c*(-1.0f);
   Point2F rotPoints[4];
   rotPoints[0].x =  a;  rotPoints[0].y =  b;
   rotPoints[1].x = -b;  rotPoints[1].y =  a;
   rotPoints[2].x = -a;  rotPoints[2].y = -b;
   rotPoints[3].x =  b;  rotPoints[3].y = -a;

   for (int i = 0; i < flares.size(); i++) {
      const FlareInfo &flare = flares[i];
      Point2F flarePos = delta;
      flarePos *= flare.dist;
      flarePos += sunP;
      const GFXBitmap *bitmap = hMaterialList->getMaterial(flare.textureIndex).getTextureMap();
      gfxSurface->setTextureMap(bitmap);
      Point2F dimension(bitmap->width*vpScale.x, bitmap->height*vpScale.y);
      const float scale = 0.5*(flare.minScale + (1.0f - deltaFrac)*flare.scaleRange);
      for (int j = 0; j < 4; j++) {
         Point3F drawPoint;
         if (flare.rotate)
            drawPoint.set(rotPoints[j].x*dimension.x, rotPoints[j].y*dimension.y, 0);
         else
            drawPoint.set(boxPoints[j][0]*dimension.x, boxPoints[j][1]*dimension.y, 0);
         drawPoint *= scale;
         drawPoint += Point3F(flarePos.x, flarePos.y, 1.0);
         V[j].fVertexIndex = pointArray->addProjectedPoint(drawPoint);
         V[j].fTextureIndex = j;
      }
      pointArray->drawProjectedPoly(4, V, 0);
   }
   
   gfxSurface->setTransparency(FALSE);
   if(deltaFrac < .3)
   {
      pointArray->useTextures(false);
      gfxSurface->setAlphaSource(GFX_ALPHA_CONSTANT);
      gfxSurface->setFillMode(GFX_FILL_CONSTANT);
      gfxSurface->setConstantAlpha(3.3 * (.3 - deltaFrac));
      gfxSurface->setFillColor(&color);
      V[0].fVertexIndex = pointArray->addProjectedPoint(Point3F(screenVp.upperL.x, screenVp.upperL.y, 1.0));
      V[1].fVertexIndex = pointArray->addProjectedPoint(Point3F(screenVp.lowerR.x, screenVp.upperL.y, 1.0));
      V[2].fVertexIndex = pointArray->addProjectedPoint(Point3F(screenVp.lowerR.x, screenVp.lowerR.y, 1.0));
      V[3].fVertexIndex = pointArray->addProjectedPoint(Point3F(screenVp.upperL.x, screenVp.lowerR.y, 1.0));
      pointArray->drawProjectedPoly(4, V, 0);
   }

   gfxSurface->setAlphaSource(GFX_ALPHA_NONE);
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:101,代码来源:simPlanet.cpp

示例13: Point3F

      V[0].fVertexIndex = pointArray->addProjectedPoint(Point3F(screenVp.upperL.x, screenVp.upperL.y, 1.0));
      V[1].fVertexIndex = pointArray->addProjectedPoint(Point3F(screenVp.lowerR.x, screenVp.upperL.y, 1.0));
      V[2].fVertexIndex = pointArray->addProjectedPoint(Point3F(screenVp.lowerR.x, screenVp.lowerR.y, 1.0));
      V[3].fVertexIndex = pointArray->addProjectedPoint(Point3F(screenVp.upperL.x, screenVp.lowerR.y, 1.0));
      pointArray->drawProjectedPoly(4, V, 0);
   }

   gfxSurface->setAlphaSource(GFX_ALPHA_NONE);
}

//--------------------------------------------------------------------------- 

//--------------------------------------------------------------------------- 

bool SimPlanet::shadows = false;
Point3F SimPlanet::shadowDirection = Point3F(0.0f, 0.0f, 1.0f);

SimPlanet::SimPlanet()
{ 
   planet.itype = SimRenderImage::Background;
   planet.sortValue = PLANET_SORTVALUE;
   planet.lensFlare = NULL;
   planet.size = 2000.0f;
   planet.distance = PLANET_DISTANCE;
   textureTag = 0;
   azimuth = 0.0f;
   incidence = 30.0f;
   castShadows = false;
   useLensFlare = false;
   inLightSet = false;
   inRenderSet = false;
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:31,代码来源:simPlanet.cpp

示例14: getBoundingBox

Box3F ForestConvex::getBoundingBox() const
{
   // This is probably a bad idea? -- BJG
   return getBoundingBox( mTransform, Point3F(mScale,mScale,mScale) );
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:5,代码来源:forestCollision.cpp

示例15: PROFILE_SCOPE

void LightFlareData::prepRender( SceneRenderState *state, LightFlareState *flareState )
{
   PROFILE_SCOPE( LightFlareData_prepRender );

   const LightInfo *lightInfo = flareState->lightInfo;

   if (  mIsZero( flareState->fullBrightness ) ||
         mIsZero( lightInfo->getBrightness() ) )
      return;

   // Figure out the element count to render.
   U32 elementCount = mElementCount;
   const bool isReflectPass = state->isReflectPass();
   if ( isReflectPass )
   {
      // Then we don't render anything this pass.
      if ( !mRenderReflectPass )
         return;

      // Find the zero distance elements which make 
      // up the corona of the light flare.
      elementCount = 0.0f;
      for ( U32 i=0; i < mElementCount; i++ )
         if ( mIsZero( mElementDist[i] ) )
            elementCount++;
   }

   // Better have something to render.
   if ( elementCount == 0 )
      return;
  
   U32 visDelta = U32_MAX;
   F32 occlusionFade = 1.0f;
   Point3F lightPosSS;
   bool lightVisible = _testVisibility( state, flareState, &visDelta, &occlusionFade, &lightPosSS );
   
   // We can only skip rendering if the light is not 
   // visible, and it has elapsed the fade out time.
   if (  mIsZero( occlusionFade ) ||
         !lightVisible && visDelta > FadeOutTime )
      return;

   const RectI &viewport = GFX->getViewport();
   Point3F oneOverViewportExtent( 1.0f / (F32)viewport.extent.x, 1.0f / (F32)viewport.extent.y, 0.0f );

   // Really convert it to screen space.
   lightPosSS.x -= viewport.point.x;
   lightPosSS.y -= viewport.point.y;
   lightPosSS *= oneOverViewportExtent;
   lightPosSS = ( lightPosSS * 2.0f ) - Point3F::One;
   lightPosSS.y = -lightPosSS.y;
   lightPosSS.z = 0.0f;

   // Take any projection offset into account so that the point where the flare's
   // elements converge is at the 'eye' point rather than the center of the viewport.
   const Point2F& projOffset = state->getCameraFrustum().getProjectionOffset();
   Point3F flareVec( -lightPosSS + Point3F(projOffset.x, projOffset.y, 0.0f) );
   const F32 flareLength = flareVec.len();
   if ( flareLength > 0.0f )
      flareVec *= 1.0f / flareLength;

   // Setup the flare quad points.
   Point3F rotatedBasePoints[4];
   dMemcpy(rotatedBasePoints, sBasePoints, sizeof( sBasePoints ));

   // Rotate the flare quad.
   F32 rot = mAcos( -1.0f * flareVec.x );
   rot *= flareVec.y > 0.0f ? -1.0f : 1.0f;
   MathUtils::vectorRotateZAxis( rot, rotatedBasePoints, 4 );

   // Here we calculate a the light source's influence on 
   // the effect's size and brightness.

   // Scale based on the current light brightness compared to its normal output.
   F32 lightSourceBrightnessScale = lightInfo->getBrightness() / flareState->fullBrightness;

   const Point3F &camPos = state->getCameraPosition();
   const Point3F &lightPos = flareState->lightMat.getPosition();   
   const bool isVectorLight = lightInfo->getType() == LightInfo::Vector;

   // Scale based on world space distance from camera to light source.
   F32 distToCamera = ( camPos - lightPos ).len();
   F32 lightSourceWSDistanceScale = isVectorLight && distToCamera > 0.0f ? 1.0f : getMin( 10.0f / distToCamera, 10.0f );

   // Scale based on screen space distance from screen position of light source to the screen center.
   F32 lightSourceSSDistanceScale = getMax( ( 1.5f - flareLength ) / 1.5f, 0.0f );

   // Scale based on recent visibility changes, fading in or out.
   F32 fadeInOutScale = 1.0f;   
   if (  lightVisible &&
         visDelta < FadeInTime && 
         flareState->occlusion > 0.0f )
      fadeInOutScale = (F32)visDelta / (F32)FadeInTime;
   else if (   !lightVisible && 
               visDelta < FadeOutTime )
      fadeInOutScale = 1.0f - (F32)visDelta / (F32)FadeOutTime;

   // This combined scale influences the size of all elements this effect renders.
   // Note we also add in a scale that is user specified in the Light.
   F32 lightSourceIntensityScale = lightSourceBrightnessScale * 
//.........这里部分代码省略.........
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:101,代码来源:lightFlareData.cpp


注:本文中的Point3F函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。