• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ direction函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: RectConeIntersect

bool RectConeIntersect(const Rect * rect, const Cone * cone)
{
	Circle circle(cone->GetVertex(), cone->GetHeight());
	if (Intersect(rect, &circle) == true)
	{
		Point2D corners[4] = 
		{
			Point2D(rect->GetLeft(),	rect->GetTop()),
			Point2D(rect->GetLeft(),	rect->GetBottom()),
			Point2D(rect->GetRight(),	rect->GetBottom()),
			Point2D(rect->GetRight(),	rect->GetTop()),
		};

		if (rect->ContainsPoint(cone->GetVertex()) == true)
		{
			return true;
		}
		for (uint8 i = 0; i < 4; i++)
		{
			if (cone->ContainsPoint(corners[i]) == true)
			{
				return true;
			}
		}

		Vector3D direction(cone->GetVertex(), cone->GetVertex() + cone->GetDirection());
		Float angle = direction.GetZeroAngleD();

		Float angle1 = angle + cone->GetAngle();
		Float angle2 = angle - cone->GetAngle();

		Float height = cone->GetHeight();
		Point3D vertex = cone->GetVertex();

		LineSegment line1(vertex, Point3D(vertex.GetX() + (CosD(angle1) * height), vertex.GetY() + (SinD(angle1) * height), 0));
		LineSegment line2(vertex, Point3D(vertex.GetX() + (CosD(angle2) * height), vertex.GetY() + (SinD(angle2) * height), 0));

		return ((Intersect(rect, &line1) == true) || (Intersect(rect, &line2) == true));
	}
	return false;
}
开发者ID:Dingf,项目名称:Paper-TD,代码行数:41,代码来源:shapeintersect.cpp


示例2: MMatrix

MMatrix sgHair_controlJoint::getAngleWeightedMatrix( const MMatrix& targetMtx, double weight )
{
	MMatrix mtx;
	if( m_bStaticRotation )
	{
		mtx = MMatrix() * ( weight-1 ) + targetMtx * weight;
		cleanMatrix( mtx );
	}
	else
	{
		MVector vUpDefault( 0, 1, 0 );
		MVector vCrossDefault( 0,0,1 );
		MVector vUpInput( targetMtx(1,0), targetMtx(1,1), targetMtx(1,2) );

		double angleUp = vUpInput.angle( vUpDefault ) * weight;

		if( vUpInput.x == 0 && vUpInput.z == 0 ) vUpInput.x = 1;
		MVector direction( vUpInput.x, 0, vUpInput.z );
		direction.normalize();

		MVector vUp( sin( angleUp ) * direction.x, cos( angleUp ), sin( angleUp ) * direction.z );
		double dot = vUp * MVector( 0.0, 0.0, 1.0 );
		MVector vCross( 0.0, -dot, (dot+1) );
		MVector vAim = vUp ^ vCross;

		vAim.normalize();
		vUp.normalize();
		vCross = vAim ^ vUp;

		mtx( 0, 0 ) = vAim.x;
		mtx( 0, 1 ) = vAim.y;
		mtx( 0, 2 ) = vAim.z;
		mtx( 1, 0 ) = vUp.x;
		mtx( 1, 1 ) = vUp.y;
		mtx( 1, 2 ) = vUp.z;
		mtx( 2, 0 ) = vCross.x;
		mtx( 2, 1 ) = vCross.y;
		mtx( 2, 2 ) = vCross.z;
	}
	return mtx;
}
开发者ID:jonntd,项目名称:mayadev-1,代码行数:41,代码来源:sgHair_controlJoint_def.cpp


示例3: direction

bool shape::intersects(shape const& shape) const {
  vector direction(shape.centroid() - centroid());

  std::vector<vector> simplex;
  simplex.push_back(vertices_[support(direction)] - shape.vertices()[shape.support(-direction)]);
  direction = -direction;

  for(;;) {
    vector const a(vertices_[support(direction)] - shape.vertices()[shape.support(-direction)]);
    if(a.dot(direction) <= 0.0f)
      return false;
    simplex.push_back(a);
    vector const ao(-a);

    if(simplex.size() == 3) {
      vector const b(simplex[1]);
      vector const c(simplex[0]);
      vector const ab(b - a);
      vector const ac(c - a);

      vector const ab_triple(vector::triple_product_left(ac, ab, ab));
      if(ab_triple.dot(ao) >= 0.0f) {
        simplex.erase(simplex.begin());
        direction = ab_triple;
      } else {
        vector const ac_triple(vector::triple_product_left(ab, ac, ac));
        if(ac_triple.dot(ao) >= 0.0f) {
          simplex.erase(simplex.begin() + 1);
          direction = ac_triple;
        } else
          return true;
      }
    } else {
      vector const b(simplex[0]);
      vector const ab(b - a);
      direction = vector::triple_product_left(ab, ao, ab);
      if(!direction)
        direction = ab.left();
    }
  }
}
开发者ID:rikshot,项目名称:sandbox,代码行数:41,代码来源:shape.cpp


示例4: vsCollisionObject

void
vpDrawable::ConvertToPhysics_Rigid()
{
	m_objectCount = 1;
	m_object = new vsCollisionObject *[1];

	bool isStatic = false;
	if ( m_drawMode == DrawMode_Static )
		isStatic = true;

	m_object[0] = new vsCollisionObject( ColFlag_Player, ColFlag_All, isStatic );
	// for each line of our optimised model, add a box to our collision object!

	for ( int i = 0; i < m_optimisedIndexCount-1; i++ )
	{
		const vsVector2D &start = m_samplePos[m_optimisedIndex[i]];
		const vsVector2D &end = m_samplePos[m_optimisedIndex[i+1]];

		vsVector2D direction(end.x-start.x,end.y-start.y);
		vsAngle ang = vsAngle::FromForwardVector(direction);
		float length = direction.Length();

		if ( length > 0.f )
		{
			float density = 1.0f;
			float width = 0.15f;

			if ( m_drawMode == DrawMode_Static )
				density = 0.f;

			vsVector2D extent( width, length );
			vsVector2D midpoint = 0.5f * (start + end);

			m_object[0]->AddBox( extent, midpoint, ang, density );
		}
	}

	m_object[0]->SetCollisionsActive(true);
	m_object[0]->SetUserData(this);
	m_object[0]->SetResponder(this);
}
开发者ID:vectorstorm,项目名称:vectorstorm-testbeds,代码行数:41,代码来源:VP_Drawable.cpp


示例5: update

	void update(entityx::EntityManager &es, entityx::EventManager &events, double dt)
	{
		entityx::ComponentHandle<Moveable> moveable;
		entityx::ComponentHandle<Position> position;
		entityx::ComponentHandle<Player> player;

		for(entityx::Entity entity : es.entities_with_components(player))
		{
			float x = 0.0f;
			float y = 0.0f;

			const Uint8 *state = SDL_GetKeyboardState(NULL);
			if(state[SDL_SCANCODE_W])
			{
				y-=1.0f;
			}
			if(state[SDL_SCANCODE_A])
			{
				x-=1.0f;
			}
			if(state[SDL_SCANCODE_S])
			{
				y+=1.0f;
			}
			if(state[SDL_SCANCODE_D])
			{
				x+=1.0f;
			}
			if(state[SDL_SCANCODE_SPACE])
			{
				events.emit<PlayerInstructionLight>(entity);
			}
			if(x != 0.0f || y != 0.0f)
			{
				glm::vec2 direction(x,y);
				direction = glm::normalize(direction);// *(float) dt;
				events.emit<PlayerInstructionEvent>(direction,entity);
			}
			
		}
	}
开发者ID:svenstaro,项目名称:bgj09,代码行数:41,代码来源:system_controls.hpp


示例6: printf

int MovingObject::status()
{
    printf("Method: %c\n", _method);
    printf("First: %d - Last: %d\n", _first(), _last);
    printf("RealQueueSize: %d\n", _realQueueSize);
    printf("Filled: %s\n", _filled?"true":"false");
    printf("Valorized: %s\n", _valorized()?"true":"false");

    int i, count;
    if (_valorized()) {
        for(i=_first(), count=0; _filled?count<_realQueueSize:i<=_last; i++, count++) {
            i=i%_realQueueSize;
            printf("   Values[%d]: %f, %f\n", i, _lastValues_X[i], _lastValues_Y[i]);
        }
    }
    printf("Distance: %f\n", coveredDistance());
    printf("Speed: %f\n", speed());
    printf("Direction: %f\n", direction()*180/PI);
    printf("---\n");
    return 0;
}
开发者ID:loristissino,项目名称:multicamera-tracker,代码行数:21,代码来源:MovingObject.cpp


示例7: drawArrow

    void drawArrow(Vector2f const& from,  Vector2f const& to, Color3f const& color, float width) {

        Vector2f direction((to-from).normalize()*width*0.5f);
        Vector2f normal(direction.y_, -direction.x_);

        glBlendFunc(GL_ONE, GL_ONE);
        glLineWidth(width);

        glBegin(GL_TRIANGLES);
            (color*0.5f).gl3f();
            glVertex2f(from.x_,from.y_);

            color.gl3f();
            glVertex2f(to.x_-normal.x_,to.y_-normal.y_);
            glVertex2f(to.x_+normal.x_,to.y_+normal.y_);

            glVertex2f(to.x_+direction.x_*3.f,to.y_+direction.y_*3.f);
            glVertex2f(to.x_+normal.x_*2.f,to.y_+normal.y_*2.f);
            glVertex2f(to.x_-normal.x_*2.f,to.y_-normal.y_*2.f);
        glEnd();
    }
开发者ID:AlohaWu,项目名称:M.A.R.S.,代码行数:21,代码来源:decoObjects.cpp


示例8: Q_UNUSED

void RGBMatrix::preRun(MasterTimer* timer)
{
    Q_UNUSED(timer);

    FixtureGroup* grp = doc()->fixtureGroup(fixtureGroup());
    {
        QMutexLocker algorithmLocker(&m_algorithmMutex);
        if (grp != NULL && m_algorithm != NULL)
        {
            m_direction = direction();

            Q_ASSERT(m_fader == NULL);
            m_fader = new GenericFader(doc());
            m_fader->adjustIntensity(getAttributeValue(Intensity));

            if (m_direction == Forward)
            {
                m_step = 0;
                m_stepColor = m_startColor.rgb();
            }
            else
            {
                m_step = m_algorithm->rgbMapStepCount(grp->size()) - 1;
                if (m_endColor.isValid())
                {
                    m_stepColor = m_endColor.rgb();
                }
                else
                {
                    m_stepColor = m_startColor.rgb();
                }
            }
            calculateColorDelta();
        }
    }

    m_roundTime->start();

    Function::preRun(timer);
}
开发者ID:Babbsdrebbler,项目名称:qlcplus,代码行数:40,代码来源:rgbmatrix.cpp


示例9: tprintf

// Refits the baseline to a constrained angle, using the stored block
// skew if good enough, otherwise the supplied default skew.
void BaselineBlock::ParallelizeBaselines(double default_block_skew) {
  if (non_text_block_) return;
  if (!good_skew_angle_) skew_angle_ = default_block_skew;
  if (debug_level_ > 0)
    tprintf("Adjusting block to skew angle %g\n", skew_angle_);
  FCOORD direction(cos(skew_angle_), sin(skew_angle_));
  for (int r = 0; r < rows_.size(); ++r) {
    BaselineRow* row = rows_[r];
    row->AdjustBaselineToParallel(debug_level_, direction);
    if (debug_level_ > 1)
      row->Print();
  }
  if (rows_.size() < 3 || !ComputeLineSpacing())
    return;
  // Enforce the line spacing model on all lines that don't yet have a good
  // baseline.
  // Start by finding the row that is best fitted to the model.
  int best_row = 0;
  double best_error = SpacingModelError(rows_[0]->PerpDisp(direction),
                                        line_spacing_, line_offset_);
  for (int r = 1; r < rows_.size(); ++r) {
    double error = SpacingModelError(rows_[r]->PerpDisp(direction),
                                     line_spacing_, line_offset_);
    if (error < best_error) {
      best_error = error;
      best_row = r;
    }
  }
  // Starting at the best fitting row, work outwards, syncing the offset.
  double offset = line_offset_;
  for (int r = best_row + 1; r < rows_.size(); ++r) {
    offset = rows_[r]->AdjustBaselineToGrid(debug_level_, direction,
                                            line_spacing_, offset);
  }
  offset = line_offset_;
  for (int r = best_row - 1; r >= 0; --r) {
    offset = rows_[r]->AdjustBaselineToGrid(debug_level_, direction,
                                            line_spacing_, offset);
  }
}
开发者ID:ArnoldWu,项目名称:tess-two,代码行数:42,代码来源:baselinedetect.cpp


示例10: direction

void LevelFactory::LoadDirectionalLights(XMLReader& aReader, tinyxml2::XMLElement* aLevelElement)
{
	for (tinyxml2::XMLElement* entityElement = aReader.FindFirstChild(aLevelElement, "directionallight"); entityElement != nullptr;
		entityElement = aReader.FindNextElement(entityElement, "directionallight"))
	{
		tinyxml2::XMLElement* directionalElement = aReader.ForceFindFirstChild(entityElement, "rotation");

		Prism::DirectionalLight* newDirLight = new Prism::DirectionalLight();

		

		CU::Vector3<float> lightDirection;
		aReader.ForceReadAttribute(directionalElement, "X", lightDirection.x);
		aReader.ForceReadAttribute(directionalElement, "Y", lightDirection.y);
		aReader.ForceReadAttribute(directionalElement, "Z", lightDirection.z);

		CU::Matrix44<float> orientation;
		
		CU::GetOrientation(orientation, lightDirection);
		CU::Vector3<float> direction(0.f, 0.f, 1.f);

		direction = direction * orientation;

		newDirLight->SetDir(direction);

		//newDirLight->SetOrientation(orientation);
		//newDirLight->SetDir(lightDirection);

		directionalElement = aReader.ForceFindFirstChild(entityElement, "color");

		CU::Vector4<float> lightColor;
		aReader.ForceReadAttribute(directionalElement, "R", lightColor.myR);
		aReader.ForceReadAttribute(directionalElement, "G", lightColor.myG);
		aReader.ForceReadAttribute(directionalElement, "B", lightColor.myB);
		aReader.ForceReadAttribute(directionalElement, "A", lightColor.myA);
		newDirLight->SetColor(lightColor);

		myDirectionalLights.Add(newDirLight);
	}
}
开发者ID:nian0601,项目名称:Spaceshooter,代码行数:40,代码来源:LevelFactory.cpp


示例11: algorithmLocker

void RGBMatrix::preRun(MasterTimer* timer)
{
    {
        QMutexLocker algorithmLocker(&m_algorithmMutex);

        m_group = doc()->fixtureGroup(m_fixtureGroupID);
        if (m_group == NULL)
        {
            // No fixture group to control
            stop(FunctionParent::master());
            return;
        }

        if (m_algorithm != NULL)
        {
            Q_ASSERT(m_fader == NULL);
            m_fader = new GenericFader(doc());
            m_fader->adjustIntensity(getAttributeValue(Intensity));
            m_fader->setBlendMode(blendMode());

            // Copy direction from parent class direction
            m_stepHandler->initializeDirection(direction(), m_startColor, m_endColor, m_stepsCount);

            if (m_algorithm->type() == RGBAlgorithm::Script)
            {
                RGBScript *script = static_cast<RGBScript*> (m_algorithm);
                QHashIterator<QString, QString> it(m_properties);
                while(it.hasNext())
                {
                    it.next();
                    script->setProperty(it.key(), it.value());
                }
            }
        }
    }

    m_roundTime->restart();

    Function::preRun(timer);
}
开发者ID:janosvitok,项目名称:qlcplus,代码行数:40,代码来源:rgbmatrix.cpp


示例12: waveNumber

void stokesFifthProperties::set( Ostream& os)
{
    scalar k = waveNumber();

    // Write the beginning of the sub-dictionary
    writeBeginning( os );

    // Write the already given parameters
    writeGiven( os, "waveType" );

    writeGiven( os, "height");
    writeGiven( os, "period" );

    writeGiven( os, "depth" );
    writeGiven( os, "stokesDrift");
    writeGiven( os, "direction" );

    if (dict_.found( "Tsoft" ))
    {
        writeGiven( os, "Tsoft");
    }

    writeGiven( os, "phi");

    if (write_)
    {
        vector direction( vector(dict_.lookup("direction")));
        direction /= Foam::mag(direction);
        direction *= k;

        writeDerived(os, "waveNumber", direction);
        writeDerived(os, "omega", omega_);
    }

    // Write the relaxation zone
    writeRelaxationZone( os );

    // Write the closing bracket
    writeEnding( os );
}
开发者ID:Aidan-Bharath,项目名称:waves2Foam,代码行数:40,代码来源:stokesFifthProperties.C


示例13: glPushName

void CylinderMy::draw_with_name(unsigned int i) const {
    glPushName(i);
    {
        GLUquadricObj* qobj = gluNewQuadric();
        glPushMatrix();
        glTranslatef(base_center_.x(), base_center_.y(), base_center_.z());

        double angle = 0.0;
        double x = 1.0;
        double y = 0.0;
        double z = 0.0;

        //--- Compute orientation of normal
        // TODO: Comparing doubles with == or != is not safe
        Vector3d dir = direction();
        if((dir.x() == 0.0f) && (dir.y() == 0.0f)) {
            if(dir.z() > 0)
                angle = 0.0f;
            else
                angle = 180.0f;
        }
        else {
            Vector3d k(0.0f, 0.0f, 1.0f);

            Vector3d tmp = CGAL::cross_product(dir, k);
            angle = std::acos(dir * k);
            angle = -180.0f * angle / M_PI;
            x = tmp[0];
            y = tmp[1];
            z = tmp[2];
        }

        glRotatef(angle, x, y, z);
        gluCylinder(qobj, radius_, radius_, height(), 30, 1);
        glPopMatrix();

        gluDeleteQuadric(qobj);
    }
    glPopName();
}
开发者ID:LemonChiu,项目名称:Mesh-Skeleton-Tool,代码行数:40,代码来源:cylinder.cpp


示例14: GetAbsOrigin

CBaseEntity *CDecal::GetDecalEntityAndPosition( Vector *pPosition, bool bStatic )
{
	CBaseEntity *pEntity = NULL;
	if ( !m_entityName )
	{
		trace_t trace;
		Vector start = GetAbsOrigin();
		Vector direction(1,1,1);
		if ( GetAbsAngles() == vec3_angle )
		{
			start -= direction * 5;
		}
		else
		{
			GetVectors( &direction, NULL, NULL );
		}
		Vector end = start + direction * 10;
		if ( bStatic )
		{
			CTraceFilterValidForDecal traceFilter( this, COLLISION_GROUP_NONE );
			UTIL_TraceLine( start, end, MASK_SOLID, &traceFilter, &trace );
		}
		else
		{
			UTIL_TraceLine( start, end, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &trace );
		}
		if ( trace.DidHitNonWorldEntity() )
		{
			*pPosition = trace.endpos;
			return trace.m_pEnt;
		}
	}
	else
	{
		pEntity = gEntList.FindEntityByName( NULL, m_entityName );
	}

	*pPosition = GetAbsOrigin();
	return pEntity;
}
开发者ID:DeadFuze,项目名称:swarm-sdk,代码行数:40,代码来源:world.cpp


示例15: ASSERT

TextRun SVGInlineTextBox::constructTextRun(RenderStyle* style, const SVGTextFragment& fragment) const
{
    ASSERT(style);
    ASSERT(textRenderer());

    RenderText* text = textRenderer();
    ASSERT(text);

    // FIXME(crbug.com/264211): This should not be necessary but can occur if we
    //                          layout during layout. Remove this when 264211 is fixed.
    RELEASE_ASSERT(!text->needsLayout());

    TextRun run(static_cast<const LChar*>(0) // characters, will be set below if non-zero.
                , 0 // length, will be set below if non-zero.
                , 0 // xPos, only relevant with allowTabs=true
                , 0 // padding, only relevant for justified text, not relevant for SVG
                , TextRun::AllowTrailingExpansion
                , direction()
                , dirOverride() || style->rtlOrdering() == VisualOrder /* directionalOverride */);

    if (fragment.length) {
        if (text->is8Bit())
            run.setText(text->characters8() + fragment.characterOffset, fragment.length);
        else
            run.setText(text->characters16() + fragment.characterOffset, fragment.length);
    }

    if (textRunNeedsRenderingContext(style->font()))
        run.setRenderingContext(SVGTextRunRenderingContext::create(text));

    run.disableRoundingHacks();

    // We handle letter & word spacing ourselves.
    run.disableSpacing();

    // Propagate the maximum length of the characters buffer to the TextRun, even when we're only processing a substring.
    run.setCharactersLength(text->textLength() - fragment.characterOffset);
    ASSERT(run.charactersLength() >= run.length());
    return run;
}
开发者ID:glenkim-dev,项目名称:blink-crosswalk,代码行数:40,代码来源:SVGInlineTextBox.cpp


示例16: TEST

TEST(FileChannel, files)
{
  unlink("output");
  const auto hub = new Hub::Hub ("Hub");

  const auto ich = channeling::ChannelFactory::create("file", hub, "data://direction=input\nname=infile");
  const int buffer_size = sizeof(testLine) + ich->name().length() + 2 + 5;   // file: and ": " sizes
  const std::string valid_line = "file:" + ich->name() + ": " + testLine;
  const auto buffer = new char[buffer_size];

  channeling::ChannelFactory::create("file", hub, "data://direction=output\nname=outfile");

  // Check that at least constructor works
  ASSERT_EQ(ich->name(),      "infile");
  ASSERT_EQ(ich->direction(), channeling::ChannelDirection::Input);

  // Open input pipe from file channel
  hub->activate();
  int fd = open("input", O_WRONLY | O_SYNC, 0666);
  ASSERT_NE(fd, -1);

  int err = write(fd, testLine, sizeof(testLine));
  ASSERT_EQ(err, sizeof(testLine));
  std::this_thread::sleep_for( std::chrono::milliseconds (50) );
  hub->deactivate();
  std::this_thread::sleep_for( std::chrono::milliseconds (50) );
  delete hub;

  close(fd);    // @todo move after adding file close support in poll thread

  fd = open("output", O_RDONLY | O_SYNC);
  ASSERT_NE(fd, -1);
  bzero(buffer, buffer_size);
  err = read(fd, buffer, buffer_size - 1);
  ASSERT_EQ(err, buffer_size - 1);
  close(fd);
  ASSERT_STREQ(buffer, valid_line.c_str());
  delete[] buffer;
}
开发者ID:rayslava,项目名称:chatsync,代码行数:39,代码来源:channel.cpp


示例17: direction

/*
			Ramps up the voltage on a dc motor.
 */
void DCMotor::speed (double _speed)
	{

	 clock_t start_time,stop_time;

	 //  ramps up the motor to a  certain speed...
		direction ();
		start_time = clock ();
		double voltsinc;
		//accelerate or deccelerate?
		if (_speed > cur_speed) voltsinc = DCACCEL_DCRES;
		else voltsinc = -DCACCEL_DCRES;
		// start at the current speed.
		double volts = cur_speed;
		AD_board->generate_volts (dac,volts);

//		cerr <<"SLEW SPEED TO "<<_speed<<"  from:"<<cur_speed<<endl;

 //char buf[256];
 //sprintf (buf,"speed:%lf",volts);
 //debug.post (buf);
//(_speed > cur_speed?(volts < _speed):(volts > _speed))
		while (  matchspeed (_speed,volts,cur_speed) &&
						 volts <= max_speed) {
			stop_time = clock ();
			if ((stop_time-start_time) > DCRES_INV*CLK_TCK) {
			 volts += voltsinc;
			 AD_board->generate_volts (dac,volts);
//debug3 = volts;
			 start_time = clock ();
			}
		}

		AD_board->generate_volts (dac,_speed);
		cur_speed = _speed;
//debug3 = cur_speed;
		if (cur_speed == 0.0) stop_dome (); // the dome requires that the fwd & rev
												 // ttl lines be set to 0v.
	}
开发者ID:robblovell,项目名称:telescope-hiltner-2.4m,代码行数:42,代码来源:DCMOTOR.CPP


示例18: glClearColor

void TaskCubeMap::update( void )
{
	glClearColor( 0.2f, 0.2f, 0.2f, 1.0f );
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

	const horizon::input::PadState& pad = horizon::input::getPadState( 0 );

	if( pad.stick.right.y != 0.0f ) {
		mCamera.rotation().x -= DEG_TO_RAD( pad.stick.right.y );
	}
	if( pad.stick.right.x != 0.0f ) {
		mCamera.rotation().y -= DEG_TO_RAD( pad.stick.right.x );
	}

	glm::vec4 direction( -pad.stick.left.x, 0.0f, - pad.stick.left.y, 0.0f );
	glm::mat4 identityMtx( 1.0f );
	direction = glm::rotate( identityMtx, mCamera.rotation().x, GLM_X_AXIS ) * direction;
	direction = glm::rotate( identityMtx, mCamera.rotation().y, GLM_Y_AXIS ) * direction;
	mCamera.position().x += direction.x;
	mCamera.position().y += direction.y;
	mCamera.position().z += direction.z;

	mCamera.apply();

	mCubeMap.useProgram();
	mCubeMap.bindTexture( 0, mTextureCubeChapel );

	mCubeMap.getProgram().setUniform( "SkyBox", 1 );
	mSkyBox.draw();


	glClear( GL_DEPTH_BUFFER_BIT );

	mCubeMap.getProgram().setUniform( "SkyBox", 0 );
	mSphere.draw();

	mShader_PresentNormal.useProgram();
	mSphere.draw();
}
开发者ID:devgoeson,项目名称:sandbox,代码行数:39,代码来源:TaskCubeMap.cpp


示例19: DateTimeFieldElement

DateTimeNumericFieldElement::DateTimeNumericFieldElement(Document* document, FieldOwner& fieldOwner, int minimum, int maximum, const String& placeholder, const DateTimeNumericFieldElement::Parameters& parameters)
    : DateTimeFieldElement(document, fieldOwner)
    , m_lastDigitCharTime(0)
    , m_placeholder(placeholder)
    , m_range(minimum, maximum)
    , m_value(0)
    , m_hasValue(false)
    , m_step(parameters.step)
    , m_stepBase(parameters.stepBase)
{
    ASSERT(m_step);

    // We show a direction-neutral string such as "--" as a placeholder. It
    // should follow the direction of numeric values.
    if (localeForOwner().isRTL()) {
        Direction dir = direction(formatValue(this->maximum())[0]);
        if (dir == LeftToRight || dir == EuropeanNumber || dir == ArabicNumber) {
            setInlineStyleProperty(CSSPropertyUnicodeBidi, CSSValueBidiOverride);
            setInlineStyleProperty(CSSPropertyDirection, CSSValueLtr);
        }
    }
}
开发者ID:awong-chromium,项目名称:webkit,代码行数:22,代码来源:DateTimeNumericFieldElement.cpp


示例20: direction

/*
==========
CylinderShape::BuildPoints

	Generates the points for the cylinder.
==========
*/
void CylinderShape::BuildPoints( void ) {
	float angleIncrements = 360.0f / m_subdivisions;
	float currentAngle = 0.0f;
	glm::vec3 direction( 0.0f );
	const glm::mat4& modelMat = m_transform.GetModelMatrix();
	
	for ( unsigned int i = 0; i < m_subdivisions; ++i ) {
		direction.x = cos( glm::radians( currentAngle ) );
		direction.z = sin( glm::radians( currentAngle ) );

		direction	= glm::normalize( direction );
		direction   = direction * m_radius;

		m_points[i] = glm::vec4( direction.x, m_height * 0.5f, direction.z, 1.0f );
		m_points[i + m_subdivisions] = glm::vec4( direction.x, -m_height * 0.5f, direction.z, 1.0f );

		m_points[i] = modelMat * m_points[i];
		m_points[i + m_subdivisions] = modelMat * m_points[i + m_subdivisions];

		currentAngle += angleIncrements;
	}
}
开发者ID:Mertank,项目名称:ToneArm,代码行数:29,代码来源:CylinderShape.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ directive_failed函数代码示例发布时间:2022-05-30
下一篇:
C++ dir_open函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap