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


C++ Vec3D函数代码示例

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


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

示例1: glPushMatrix

/*
 * Draws a Entity with optional offset from parent.
 * If an Animation is active, the frames transformation is added as well.
 * TODO: Shooting brings lags
 */
void Player::draw(Transformation transformation){
    glPushMatrix();

    for(auto& anim : m_PlayingAnimations){
        Transformation *animTransformation = anim.second->tick();
        if(animTransformation == NULL){
            map<string,Animation*>::iterator it = m_PlayingAnimations.find(anim.first);
            m_PlayingAnimations.erase(it);
            continue;
        }
        m_Transformation += *animTransformation;
        //cout << "Adding to scalex " << animTransformation->m_Scale.x << endl;
        //m_Transformation.m_Scale += animTransformation->m_Scale;
    }


    transformation += m_Transformation;
    transformation.m_Scale = m_Transformation.m_Scale;

    Vec3D parentScale = Vec3D(1,1,1);
    if(m_Parent != NULL){
        parentScale = m_Parent->getTransformation()->m_Scale;
    }


    glTranslatef(transformation.m_Translation.x, transformation.m_Translation.y , transformation.m_Translation.z );
    glRotatef(transformation.m_Angle, transformation.m_Rotation.x, transformation.m_Rotation.y , transformation.m_Rotation.z);
    glScalef(transformation.m_Scale.x,transformation.m_Scale.y,transformation.m_Scale.z);

    glColor3f(0.2,0.9,0.2);
//        drawBody();
    glutSolidSphere(1,30,30);

    // Cockpit
    //glPushMatrix();
    glTranslatef(0,0,10 / transformation.m_Scale.z);
    //glScalef(transformation.m_Scale.x / 20,transformation.m_Scale.y / 20, transformation.m_Scale.z / 20);
    glScalef(15 / transformation.m_Scale.x, 20 / transformation.m_Scale.y , 10 / transformation.m_Scale.z);
    glColor3f(0.2,0.2,0.9);
    glutSolidSphere(1,30,30);
    // glPopMatrix();

    glPopMatrix();

    for(auto& part : m_Parts){
        part->draw(transformation);
    }
    //glPopMatrix();
}
开发者ID:Agreon,项目名称:SpaceInvaders3D,代码行数:54,代码来源:Player.cpp

示例2: _offx

Frame::Frame()
    : _offx(0), _offy(0), _width(640), _height(480), 
      _fontsize(12.0), _titlespace(10.0), _cmlspace(10.0), _bg(Vec3D(1,1,1)), _fg(Vec3D(0,0,0)),
      _legend_enable(true), _legend_pos(LEGEND_POS_TOP_RIGHT), _cm_legend(NULL),
      _cml_enable(true), _fixedaspect(PLOT_FIXED_ASPECT_DISABLED), _automargin(true)
{
    _legend.set_font_size( _fontsize );

    // Ruler X1
    _ruler[0].set_coord_index( 0 );
    _ruler[0].set_indir( true );
    _fenable[0] = false;
    _autorange[0] = true;
    _autorange[1] = true;

    // Ruler Y1
    _ruler[1].set_coord_index( 1 );
    _ruler[1].set_indir( false );
    _fenable[1] = false;
    _autorange[2] = true;
    _autorange[3] = true;

    // Ruler X2
    _ruler[2].set_coord_index( 0 );
    _ruler[2].set_indir( false );
    _fenable[2] = false;
    _autorange[4] = true;
    _autorange[5] = true;

    // Ruler Y2
    _ruler[3].set_coord_index( 1 );
    _ruler[3].set_indir( true );
    _fenable[3] = false;
    _autorange[6] = true;
    _autorange[7] = true;
}
开发者ID:p1heidary,项目名称:pybsimu,代码行数:36,代码来源:frame.cpp

示例3: RespondNode

 TeteNode::TeteNode(Device* d, QGraphicsItem* parent, QGraphicsScene* scene) :
   RespondNode(d, parent, scene) {
   tete_ = NULL;
   x_vel_ = 0.0;
   y_vel_ = 0.0;
   frame_rect_ = QRectF(-1, -1, 2, 2);
   frame_rect_object_ = NULL;
   mouse_moved_ = true;
   velocity_ = Vec3D();
   dormant_ = false;
   frame_on_needed_ = false;
   frame_on_threshold_ = 1.001;
   setFlag(QGraphicsItem::ItemIsMovable);
   //setAcceptDrops(true); // Needed for drag and drop events (like dragEnterEvent)
 }
开发者ID:ptierney,项目名称:Kaleidoscope,代码行数:15,代码来源:teteNode.cpp

示例4: Vec3D

bool toxi::geom::AABB::planeBoxOverlap( Vec3D & normal, const float & d, const Vec3D & maxBox )
{
	Vec3D vmin = Vec3D();
	Vec3D vmax = Vec3D();

	if (normal.getX() > 0.0f) {
		vmin.setX( -maxBox.getX() );
		vmax.setX( maxBox.getX() );
	} else {
		vmin.setX( maxBox.getX() );
		vmax.setX( -maxBox.getX() );
	}

	if (normal.getY() > 0.0f) {
		vmin.setY( -maxBox.getY() );
		vmax.setY( maxBox.getY() );
	} else {
		vmin.setY( maxBox.getY() );
		vmax.setY( -maxBox.getY() );
	}

	if (normal.getZ() > 0.0f) {
		vmin.setZ( -maxBox.getZ() );
		vmax.setZ( maxBox.getZ() );
	} else {
		vmin.setZ( maxBox.getZ() );
		vmax.setZ( -maxBox.getZ() );
	}
	if (normal.dot(vmin) + d > 0.0f) {
		return false;
	}
	if (normal.dot(vmax) + d >= 0.0f) {
		return true;
	}
	return false;
}
开发者ID:Jornason,项目名称:ofxToxiclibs,代码行数:36,代码来源:AABB.cpp

示例5: UF_CreateMaterial

void TSpawnZone::debugDraw( bool beDebug )
{
    if ( beDebug )
    {
        FnMaterial mat = UF_CreateMaterial();
        mat.SetEmissive( Vec3D(1,1,1) );
        m_dbgObj.Object( getLiveLevel()->getFlyScene().CreateObject() );
        UF_CreateBoxLine( &m_dbgObj , 5 , 5 , 10 , mat.Object());
        m_dbgObj.SetWorldPosition( pos );
    }
    else
    {
        UF_DestoryObject( m_dbgObj );
    }
}
开发者ID:uvbs,项目名称:GameProject,代码行数:15,代码来源:debugShow.cpp

示例6: setupInitialConditions

  void setupInitialConditions()
  {	
    BaseParticle p0;
    p0.setRadius(0.005);
    p0.setPosition(Vec3D(0.5*getXMax(),0.5*getYMax(),0.0));
    p0.setVelocity(Vec3D(1.2,1.3,0.0));
    particleHandler.copyAndAddObject(p0);

//! [T7:infiniteWalls]
    InfiniteWall w0;

    w0.set(Vec3D(1.0,0.0,0.0),Vec3D(getXMax(),0.0,0.0));
    wallHandler.copyAndAddObject(w0);

    w0.set(Vec3D(-1.0,0.0,0.0),Vec3D(getXMin(),0.0,0.0));
    wallHandler.copyAndAddObject(w0);

    w0.set(Vec3D(0.0,1.0,0.0),Vec3D(0.0,getYMax(),0.0));
    wallHandler.copyAndAddObject(w0);

    w0.set(Vec3D(0.0,-1.0,0.0),Vec3D(0.0,getYMin(),0.0));
    wallHandler.copyAndAddObject(w0);
//! [T7:infiniteWalls]
  }
开发者ID:gladk,项目名称:MercuryDPM,代码行数:24,代码来源:Tutorial7.cpp

示例7: Vec3D

Sky::Sky(MPQFile &f)
{
	lightinfo li;
	f.read(&li, 64);

	pos = Vec3D(li.fa/skymul, li.fb/skymul, li.fc/skymul);
	r1 = li.fd / skymul;
	r2 = li.fe / skymul;

	strcpy(name,li.name);

	for (int i=0; i<36; i++) mmin[i] = -2;

	global = (li.ia==-1);
}
开发者ID:MgCore,项目名称:mcapps,代码行数:15,代码来源:sky.cpp

示例8: Vec3D

void CUIDisplayWorld::MoveCamera(int x, int y)
{
	Matrix mCameraRot;
	// ----
	Vec3D vPos = CGameCamera::getInstance().getTargetPos();
	// ----
	// # 基于摄像机的 yaw 创建旋转矩阵 (Warning ! huihui need translate)
	// ----
	mCameraRot.rotationYawPitchRoll(CGameCamera::getInstance().getYawAngle(), 0, 0);
	// ----
	vPos	+= mCameraRot * Vec3D(x, 0, y) * 0.001f * CGameCamera::getInstance().getRadius();
	// ----
	vPos.y	= CWorld::getInstance().getHeight(vPos.x, vPos.z);
	// ----
	CGameCamera::getInstance().setTargetPos(vPos);
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:16,代码来源:UIDisplayWorld.cpp

示例9: Vec3D

Vec3D Sky::colorFor(int r, int t) const
{
    if (mmin[r]<0)
    {
        return Vec3D(0, 0, 0);
    }
    Vec3D c1, c2;
    int t1, t2;
    size_t last = colorRows[r].size() - 1;

    if (t<mmin[r])
    {
        // reverse interpolate
        c1 = colorRows[r][last].color;
        c2 = colorRows[r][0].color;
        t1 = colorRows[r][last].time;
        t2 = colorRows[r][0].time + 2880;
        t += 2880;
    }
    else
    {
        for (size_t i = last; true; i--)
        {   //! \todo iterator this.
            if (colorRows[r][i].time <= t)
            {
                c1 = colorRows[r][i].color;
                t1 = colorRows[r][i].time;

                if (i == last)
                {
                    c2 = colorRows[r][0].color;
                    t2 = colorRows[r][0].time + 2880;
                }
                else
                {
                    c2 = colorRows[r][i + 1].color;
                    t2 = colorRows[r][i + 1].time;
                }
                break;
            }
        }
    }

    float tt = static_cast<float>(t - t1) / static_cast<float>(t2 - t1);
    return c1*(1.0f - tt) + c2*tt;
}
开发者ID:vienis,项目名称:noggit,代码行数:46,代码来源:Sky.cpp

示例10: Vec3D

void CFrustum::Build(Vec3D vecMin,Vec3D vecMax)
{
	m_vtx[0] = Vec3D(vecMin.x, vecMin.y,  vecMin.z); // xyz
	m_vtx[1] = Vec3D(vecMax.x, vecMin.y,  vecMin.z); // Xyz
	m_vtx[2] = Vec3D(vecMin.x, vecMax.y,  vecMin.z); // xYz
	m_vtx[3] = Vec3D(vecMax.x, vecMax.y,  vecMin.z); // XYz
	m_vtx[4] = Vec3D(vecMin.x, vecMin.y,  vecMax.z); // xyZ
	m_vtx[5] = Vec3D(vecMax.x, vecMin.y,  vecMax.z); // XyZ
	m_vtx[6] = Vec3D(vecMin.x, vecMax.y,  vecMax.z); // xYZ
	m_vtx[7] = Vec3D(vecMax.x, vecMax.y,  vecMax.z); // XYZ

	m_planes.resize(6);
	m_planes[0]=Plane(m_vtx[0], m_vtx[1], m_vtx[2]); // Near
	m_planes[1]=Plane(m_vtx[6], m_vtx[7], m_vtx[5]); // Far
	m_planes[2]=Plane(m_vtx[2], m_vtx[6], m_vtx[4]); // Left
	m_planes[3]=Plane(m_vtx[7], m_vtx[3], m_vtx[5]); // Right
	m_planes[4]=Plane(m_vtx[2], m_vtx[3], m_vtx[6]); // Top
	m_planes[5]=Plane(m_vtx[1], m_vtx[0], m_vtx[4]); // Bottom
}
开发者ID:constantinbogdan,项目名称:node3d,代码行数:19,代码来源:Frustum.cpp

示例11: Vec3D

CDMask::CDMask( Vec2i const& size , CFScene* scene )
	:size( size )
	,needShow( true )
{

	spr = scene->createObject( nullptr );
	
	spr->setOpacity( 0.5f );
	//spr->createPlane( NULL , 100 , 100 , Vec3D(1,0,0) );
	spr->setLocalPosition( Vec3D(0,0,10) );
	spr->enableVisibleTest( false );
	spr->setRenderOption( CFly::CFRO_CULL_FACE , CFly::CF_CULL_NONE );

	int geom = createMask( spr , nullptr );

	CFly::MeshBase* shape = spr->getElement( geom )->getMesh();
	mGoemBuf = shape->getVertexElement( CFly::CFV_XYZ , mGoemOffset );
}
开发者ID:uvbs,项目名称:GameProject,代码行数:18,代码来源:CPlayButton.cpp

示例12: if

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// Method for finding boost to special r.f.
inline Vec3D Vec4D::SRFBoost() const
{
    VEC3D_T n=Norm2();
    if( n > 0.) {            // time-like vector
        // e.g. physical particle

        return r/r0;           // boost to r.f. where r=0
        // i.e. particle's rest frame

    } else if ( n < 0.) {    // space-like vector
        // e.g. tachyon

        return r0*r/(r*r);     // boost to r.f. where r0=0

    }
    // light-like
    return Vec3D();          // boost=0. is returned
}
开发者ID:tbrandonstevenson,项目名称:GRCSim,代码行数:20,代码来源:Vec4D.hpp

示例13: Vec3D

TChestTrigger::TChestTrigger() :TBoxTrigger( Vec3D( 100 , 100 , 100 ) )
	,m_items( new TItemStorage(MaxItemNum) )
{
	m_DTime = 0.0f;

	OBJECTid objID = TResManager::instance().cloneModel( "bag" , true );

	modelObj.Object( objID );
	float scale = 20;
	modelObj.Scale( scale , scale , scale , LOCAL  );
	modelObj.Rotate( X_AXIS , 90 , LOCAL );
	modelObj.XForm();

	XForm trans;
	trans.setIdentity();
	TObjMotionState* motionState = new TObjMotionState( trans , objID );
	setMotionState( motionState );
}
开发者ID:uvbs,项目名称:GameProject,代码行数:18,代码来源:TTrigger.cpp

示例14: findSkyWeights

void Skies::initSky(Vec3D pos, int t)
{
	if (numSkies==0) return;

	findSkyWeights(pos);

	for (int i=0; i<18; i++) colorSet[i] = Vec3D(0,0,0);

	// interpolation
	for (size_t j=0; j<skies.size(); j++) {
		if (skies[j].weight>0) {
			// now calculate the color rows
			for (int i=0; i<18; i++) {
				colorSet[i] += skies[j].colorFor(i,t) * skies[j].weight;
			}
		}
	}
}
开发者ID:MgCore,项目名称:mcapps,代码行数:18,代码来源:sky.cpp

示例15: selectedChange

  /* Part of the object has changed.  Broadcast a message to Grids that lets
       the server know of the change. */
  QVariant InputTextItem::itemChange(GraphicsItemChange change,
                                     const QVariant &value)
  {
    if (change == QGraphicsItem::ItemSelectedHasChanged)
      emit selectedChange(this);

    /* Check for text change. */

    /*d->getNoticeWindow()->write("change");*/

    /* Check for position change. */
    if(change == QGraphicsItem::ItemPositionChange) {
      //d->getNoticeWindow()->write("Pos change");
      updatePosition(d, Vec3D(value.toPointF().x(), value.toPointF().y(), zValue()));
    }
    return value;
    //return QGraphicsItem::itemChange(change, value);
  }
开发者ID:ptierney,项目名称:Kaleidoscope,代码行数:20,代码来源:inputTextItem.cpp


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