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

C++ core::vector3df类代码示例

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

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



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

示例1: getReflected

//██████████████████████████████████████████████████████████████████████████████████
// reflection with normal  
core::vector3df getReflected( core::vector3df vector, core::vector3df normal ) { 
	f32 length = (f32)vector.getLength();
	vector.normalize();
	normal.normalize(); 
	
	return (vector - normal * 2.0f * (vector.dotProduct( normal))) * length; 
}
开发者ID:xhlwrb,项目名称:MeshlessDeformations,代码行数:9,代码来源:Globals.cpp


示例2: calculateTangents

// Copied from irrlicht
void calculateTangents(
    core::vector3df& normal,
    core::vector3df& tangent,
    core::vector3df& binormal,
    const core::vector3df& vt1, const core::vector3df& vt2, const core::vector3df& vt3, // vertices
    const core::vector2df& tc1, const core::vector2df& tc2, const core::vector2df& tc3) // texture coords
{
    core::vector3df v1 = vt1 - vt2;
    core::vector3df v2 = vt3 - vt1;
    normal = v2.crossProduct(v1);
    normal.normalize();

    // binormal

    f32 deltaX1 = tc1.X - tc2.X;
    f32 deltaX2 = tc3.X - tc1.X;
    binormal = (v1 * deltaX2) - (v2 * deltaX1);
    binormal.normalize();

    // tangent

    f32 deltaY1 = tc1.Y - tc2.Y;
    f32 deltaY2 = tc3.Y - tc1.Y;
    tangent = (v1 * deltaY2) - (v2 * deltaY1);
    tangent.normalize();

    // adjust

    core::vector3df txb = tangent.crossProduct(binormal);
    if (txb.dotProduct(normal) < 0.0f)
    {
        tangent *= -1.0f;
        binormal *= -1.0f;
    }
}
开发者ID:Benau,项目名称:stk-code,代码行数:36,代码来源:mesh_tools.cpp


示例3: vMovement

void CFreeCamera::Update(unsigned uDeltaTime)
{
    scene::ICameraSceneNode *pCamera = m_pSceneNode;
    
    // Check if dt is not 0 and we are animating active camera
    if(!uDeltaTime || pCamera->getSceneManager()->getActiveCamera() != pCamera)
        return;
    
    // Calculate some useful vectors
    core::vector3df vPos = pCamera->getPosition();
    const core::vector3df vForward = (pCamera->getTarget() - pCamera->getPosition()).normalize();
    const core::vector3df &vUp = pCamera->getUpVector();
    const core::vector3df vRight = vForward.crossProduct(vUp);
    float fSpeed = uDeltaTime / 100.0f;
    
    // Shift makes camera faster
    if(m_Controls[CTRL_FASTER])
        fSpeed *= 5.0f;
    
    // Calculate direction of movement
    core::vector3df vMovement(0.0f, 0.0f, 0.0f);
    if(m_Controls[CTRL_FORWARD])
        vMovement += vForward * fSpeed;
    if(m_Controls[CTRL_BACKWARD])
        vMovement -= vForward * fSpeed;
    if(m_Controls[CTRL_LEFT])
        vMovement += vRight * fSpeed;
    if(m_Controls[CTRL_RIGHT])
        vMovement -= vRight * fSpeed;
    
    // update camera velocity
    float fFactor = min(uDeltaTime / 200.0f, 1.0f);
    m_vVelocity = vMovement * fFactor + m_vVelocity * (1.0f - fFactor);
    vPos += m_vVelocity;
    pCamera->setPosition(vPos);
    
    // Update pitch and yaw
    if(m_vCursorPos != m_vCursorCenter)
    {
        core::vector2df vOffset = m_vCursorPos - m_vCursorCenter;
        
        m_fYaw = fmod(m_fYaw + vOffset.X, 2.0f * M_PI);
        
        const float fPitchMax = M_PI_2 - 0.1f;
        m_fPitch -= vOffset.Y;
        if(m_fPitch > fPitchMax)
            m_fPitch = fPitchMax;
        else if(m_fPitch < -fPitchMax)
            m_fPitch = -fPitchMax;
        
        m_pCursorCtrl->setPosition(0.5f, 0.5f);
        m_vCursorCenter = m_pCursorCtrl->getRelativePosition();
    }
    
    // Set camera target
    core::vector3df vTarget(sinf(m_fYaw) * cosf(m_fPitch), sinf(m_fPitch), cosf(m_fYaw) * cosf(m_fPitch));
    vTarget += vPos;
    pCamera->setTarget(vTarget);
}
开发者ID:LeviSchuck,项目名称:openfaction,代码行数:59,代码来源:CFreeCamera.cpp


示例4: getAbsolutePosition

//! sets the look at target of the camera
//! \param pos: Look at target of the camera.
void CCameraSceneNode::setTarget(const core::vector3df& pos)
{
	Target = pos;

	if(TargetAndRotationAreBound)
	{
		const core::vector3df toTarget = Target - getAbsolutePosition();
		ISceneNode::setRotation(toTarget.getHorizontalAngle());
	}
}
开发者ID:2223108045,项目名称:YGOMobile,代码行数:12,代码来源:CCameraSceneNode.cpp


示例5: applyVertexShadows

void CBillboardGroupSceneNode::applyVertexShadows( const core::vector3df& lightDir, f32 intensity, f32 ambient )
{
    for ( s32 i=0; i<Billboards.size(); i++ )
    {
        core::vector3df normal = Billboards[i].Position;
        
        normal.normalize();
        
        f32 light = -lightDir.dotProduct(normal)*intensity + ambient;
        
        if ( light < 0 )
            light = 0;
        
        if ( light > 1 )
            light = 1;
        
        video::SColor color;
        
        color.setRed( (u8)(Billboards[i].Color.getRed() * light) );
        color.setGreen( (u8)(Billboards[i].Color.getGreen() * light) );
        color.setBlue( (u8)(Billboards[i].Color.getBlue() * light) );
        color.setAlpha( Billboards[i].Color.getAlpha() );
        
        for ( s32 j=0; j<4; j++ )
        {
            MeshBuffer.Vertices[i*4+j].Color = color;
        }
    }
}
开发者ID:SevenGameMaker,项目名称:CobbleStones,代码行数:29,代码来源:CBillboardGroupSceneNode.cpp


示例6: bound

/** This only modifies the relative rotation of the node.
If the camera's target and rotation are bound ( @see bindTargetAndRotation() )
then calling this will also change the camera's target to match the rotation.
\param rotation New rotation of the node in degrees. */
void CCameraSceneNode::setRotation(const core::vector3df& rotation)
{
	if(TargetAndRotationAreBound)
		Target = getAbsolutePosition() + rotation.rotationToDirection();

	ISceneNode::setRotation(rotation);
}
开发者ID:2223108045,项目名称:YGOMobile,代码行数:11,代码来源:CCameraSceneNode.cpp


示例7: getAngleWeight

// Copied from irrlicht
static inline core::vector3df getAngleWeight(const core::vector3df& v1,
    const core::vector3df& v2,
    const core::vector3df& v3)
{
    // Calculate this triangle's weight for each of its three vertices
    // start by calculating the lengths of its sides
    const f32 a = v2.getDistanceFromSQ(v3);
    const f32 asqrt = sqrtf(a);
    const f32 b = v1.getDistanceFromSQ(v3);
    const f32 bsqrt = sqrtf(b);
    const f32 c = v1.getDistanceFromSQ(v2);
    const f32 csqrt = sqrtf(c);

    // use them to find the angle at each vertex
    return core::vector3df(
        acosf((b + c - a) / (2.f * bsqrt * csqrt)),
        acosf((-b + c + a) / (2.f * asqrt * csqrt)),
        acosf((b - c + a) / (2.f * bsqrt * asqrt)));
}
开发者ID:Benau,项目名称:stk-code,代码行数:20,代码来源:mesh_tools.cpp


示例8: RotatePositionByDirectionalVector

core::vector3df RotatePositionByDirectionalVector(core::vector3df vPos, core::vector3df vNormal )
{
	//OPTIMIZE Isn't there a much faster way to do this?

	//calculate rotated z
	core::vector3df vFinal = vNormal * vPos.Z;

	//calculate rotation x
	vFinal = vFinal + (vNormal.crossProduct(core::vector3df(0,1,0)) * vPos.X);

	//y will just be up.. yeah, not really right
	vFinal.Y += vPos.Y;
	return vFinal;


}
开发者ID:yohanip,项目名称:proton_sdk_source,代码行数:16,代码来源:IrrlichtManager.cpp


示例9: ShaderOnSetConstants

	void ShaderOnSetConstants(IShader *shader) override
	{
		shader->SetPixelConstant("rippleScroll", engine->GetRenderUpdater().GetVirtualTime() * 0.02);
		
		
		// Are we looking in to the sun?
		core::vector3df camVec = maths::rotation_to_direction( engine->GetWorld()->GetCamera()->GetRotation() );
		
		sunDirection.normalize();
		
		f32 dp = camVec.dotProduct(sunDirection);
		//f32 brightness = 1.f + 0.5 * dp*dp*dp*dp*dp*dp*dp*dp*dp*dp*dp*dp*dp*dp*dp*dp;
		f32 brightness = 1.f + 0.5 * dp*dp*dp*dp*dp*dp*dp*dp*dp*dp;
		
		if (brightness < 1.f || camVec.getDistanceFrom(sunDirection) > 1.f)
			brightness = 1.f;
		
		brightness = core::lerp(lastBrightness, brightness,
				core::clamp(engine->GetRenderUpdater().GetLastDeltaTime(), 0.f, 1.f));
		
		lastBrightness = brightness;
		
		shader->SetPixelConstant("brightness", brightness);
	}
开发者ID:LibreGames,项目名称:puzzlemoppet,代码行数:24,代码来源:main.cpp


示例10: C2

/*------------------------------------------------------------------------------
|
|                           PROCEDURE LAMBERTUNIV
|
|  This PROCEDURE solves the Lambert problem for orbit determination and returns
|    the velocity vectors at each of two given position vectors.  The solution
|    uses Universal Variables for calculation and a bissection technique for
|    updating psi.
|
|  Algorithm     : Setting the initial bounds:
|                  Using -8Pi and 4Pi2 will allow single rev solutions
|                  Using -4Pi2 and 8Pi2 will allow multi-rev solutions
|                  The farther apart the initial guess, the more iterations
|                    because of the iteration
|                  Inner loop is for special cases. Must be sure to exit both!
|
|  Author        : David Vallado                  303-344-6037    1 Mar 2001
|
|  Inputs          Description                    Range / Units
|    R1          - IJK Position vector 1          ER
|    R2          - IJK Position vector 2          ER
|    DM          - direction of motion            'L','S'
|    DtTU        - Time between R1 and R2         TU
|
|  OutPuts       :
|    V1          - IJK Velocity vector            ER / TU
|    V2          - IJK Velocity vector            ER / TU
|    Error       - Error flag                     'ok', ...
|
|  Locals        :
|    VarA        - Variable of the iteration,
|                  NOT the semi or axis!
|    Y           - Area between position vectors
|    Upper       - Upper bound for Z
|    Lower       - Lower bound for Z
|    CosDeltaNu  - Cosine of true anomaly change  rad
|    F           - f expression
|    G           - g expression
|    GDot        - g DOT expression
|    XOld        - Old Universal Variable X
|    XOldCubed   - XOld cubed
|    ZOld        - Old value of z
|    ZNew        - New value of z
|    C2New       - C2(z) FUNCTION
|    C3New       - C3(z) FUNCTION
|    TimeNew     - New time                       TU
|    Small       - Tolerance for roundoff errors
|    i, j        - index
|
|  Coupling
|    MAG         - Magnitude of a vector
|    DOT         - DOT product of two vectors
|    FINDC2C3    - Find C2 and C3 functions
|
|  References    :
|    Vallado       2001, 459-464, Alg 55, Ex 7-5
|
-----------------------------------------------------------------------------*/
void LambertUniv
(
 core::vector3df Ro, core::vector3df R, char Dm, char OverRev, f64 DtTU,
 core::vector3df& Vo, core::vector3df& V, char* Error)
{
	const f64 TwoPi   = 2.0 * core::PI64;
	const f64 Small   = 0.0000001;
	const u32 NumIter = 40;

	u32 Loops, i, YNegKtr;
	f64 VarA, Y, Upper, Lower, CosDeltaNu, F, G, GDot, XOld, XOldCubed, FDot,
		PsiOld, PsiNew, C2New, C3New, dtNew;

	/* --------------------  Initialize values   -------------------- */
	strcpy(Error, "ok");
	PsiNew = 0.0;
	Vo = core::vector3df(0,0,0);
	V = core::vector3df(0,0,0);

	CosDeltaNu = Ro.dotProduct(R) / (Ro.getLength() * R.getLength());
	if (Dm == 'L')
		VarA = -sqrt(Ro.getLength() * R.getLength() * (1.0 + CosDeltaNu));
	else
		VarA =  sqrt(Ro.getLength() * R.getLength() * (1.0 + CosDeltaNu));

	/* ----------------  Form Initial guesses   --------------------- */
	PsiOld = 0.0;
	PsiNew = 0.0;
	XOld   = 0.0;
	C2New  = 0.5;
	C3New  = 1.0 / 6.0;

	/* -------- Set up initial bounds for the bissection ------------ */
	if (OverRev == 'N')
	{
		Upper = TwoPi * TwoPi;
		Lower = -4.0 * TwoPi;
	}
	else
	{
		Upper = -0.001 + 4.0 * TwoPi * TwoPi; // at 4, not alw work, 2.0, makes
		Lower =  0.001+TwoPi*TwoPi;           // orbit bigger, how about 2 revs??xx
//.........这里部分代码省略.........
开发者ID:oygx210,项目名称:slingshot,代码行数:101,代码来源:lambert2.cpp


示例11: Battin

/*------------------------------------------------------------------------------
|
|                           PROCEDURE LAMBERBATTIN
|
|  This PROCEDURE solves Lambert's problem using Battins method. The method is
|    developed in Battin (1987).
|
|  Author        : David Vallado                  303-344-6037    1 Mar 2001
|
|  Inputs          Description                    Range / Units
|    Ro          - IJK Position vector 1          ER
|    R           - IJK Position vector 2          ER
|    DM          - direction of motion            'L','S'
|    DtTU        - Time between R1 and R2         TU
|
|  OutPuts       :
|    Vo          - IJK Velocity vector            ER / TU
|    V           - IJK Velocity vector            ER / TU
|    Error       - Error flag                     'ok',...
|
|  Locals        :
|    i           - Index
|    Loops       -
|    u           -
|    b           -
|    Sinv        -
|    Cosv        -
|    rp          -
|    x           -
|    xn          -
|    y           -
|    l           -
|    m           -
|    CosDeltaNu  -
|    SinDeltaNu  -
|    DNu         -
|    a           -
|    Tan2w       -
|    RoR         -
|    h1          -
|    h2          -
|    Tempx       -
|    eps         -
|    denom       -
|    chord       -
|    k2          -
|    s           -
|    f           -
|    g           -
|    fDot        -
|    am          -
|    ae          -
|    be          -
|    tm          -
|    gDot        -
|    arg1        -
|    arg2        -
|    tc          -
|    AlpE        -
|    BetE        -
|    AlpH        -
|    BetH        -
|    DE          -
|    DH          -
|
|  Coupling      :
|    ARCSIN      - Arc sine FUNCTION
|    ARCCOS      - Arc cosine FUNCTION
|    MAG         - Magnitude of a vector
|    ARCSINH     - Inverse hyperbolic sine
|    ARCCOSH     - Inverse hyperbolic cosine
|    SINH        - Hyperbolic sine
|    POWER       - Raise a base to a POWER
|    ATAN2       - Arc tangent FUNCTION that resolves quadrants
|
|  References    :
|    Vallado       2001, 464-467, Ex 7-5
|
-----------------------------------------------------------------------------*/
void LambertBattin
(
 core::vector3df Ro, core::vector3df R, char dm, char OverRev, f64 DtTU,
 core::vector3df* Vo, core::vector3df* V, char* Error
 )
{
	const f64 Small = 0.000001;

	core::vector3df RCrossR;
	s32   i, Loops;
	f64   u, b, Sinv,Cosv, rp, x, xn, y, L, m, CosDeltaNu, SinDeltaNu,DNu, a,
		tan2w, RoR, h1, h2, Tempx, eps, Denom, chord, k2, s, f, g, FDot, am,
		ae, be, tm, GDot, arg1, arg2, tc, AlpE, BetE, AlpH, BetH, DE, DH;

	strcpy(Error, "ok");
	CosDeltaNu = Ro.dotProduct(R) / (Ro.getLength() * R.getLength());
	RCrossR    = Ro.crossProduct(R);
	SinDeltaNu = RCrossR.getLength() / (Ro.getLength() * R.getLength());
	DNu        = atan2(SinDeltaNu, CosDeltaNu);

	RoR   = R.getLength() / Ro.getLength();
//.........这里部分代码省略.........
开发者ID:oygx210,项目名称:slingshot,代码行数:101,代码来源:lambert2.cpp


示例12: LambertCompute

/** Computes the delta-v's required to go from r0,v0 to rf,vf.
* @return Total delta-v (magnitude) required.
* @param dt Time of flight
* @param r0 Initial position vector.
* @param v0 Initial velocity vector.
* @param rf Desired final position vector.
* @param vf Desired final velocity vector.
* //pointers to return results
* @param deltaV0 computed Initial delta-V.
* @param deltaV1 computed Final delta-V.
* @param totalV0 computed Initial total-V.
* @param totalV0 computed Final total-V.
*/
void LambertCompute(f64 GM, 
                    core::vector3df r0,
                    core::vector3df v0,
                    core::vector3df rf,
                    core::vector3df vf, 
                    f64 dt,
                    core::vector3df* deltaV0,
                    core::vector3df* deltaV1,
                    core::vector3df* totalV0,
                    core::vector3df* totalV1)
{
    s = 0.0;
    c = 0.0;
    aflag = false;
    bflag = false;
    debug_print=true;

    f64 tp = 0.0;
    f64 magr0 = r0.getLength();
    f64 magrf = rf.getLength();
    //GM is expected in km^3/s^2
    mu = GM / 1000000000.0;
    //time of flight expected in seconds
    dt *= 86400;
    tof = dt;

    core::vector3df dr = r0 - (rf);
    c = dr.getLength();
    s = (magr0 + magrf + c) / 2.0;
    f64 amin = s / 2.0;
    
    if(debug_print)
        printf("amin = %.9E\n", amin);
    
    f64 dtheta = acos(r0.dotProduct(rf) / (magr0 * magrf));

    //dtheta = 2.0 * core::PI64 - dtheta;

    if(debug_print)
        printf("dtheta = %.9E\n", dtheta);
    
    if (dtheta < core::PI64)
    {
        tp = sqrt(2.0 / (mu)) * (pow(s, 1.5) - pow(s - c, 1.5)) / 3.0;
    }
    if (dtheta > core::PI64)
    {
        tp = sqrt(2.0 / (mu)) * (pow(s, 1.5) + pow(s - c, 1.5)) / 3.0;
        bflag = true;
    }

    if(debug_print)
        printf("tp = %.9f\n", tp);

    f64 betam = getbeta(amin);
    f64 tm = getdt(amin, core::PI64, betam);

    if(debug_print)
        printf("tm = %.9E\n", tm);

    if (dtheta == core::PI64)
    {
        printf(" dtheta = 180.0. Do a Hohmann\n");
        return;
    }

    f64 ahigh = 1000.0 * amin;
    f64 npts = 3000.0;
    
    if(debug_print)
        printf("dt = %.9E seconds\n", dt);

    if(debug_print)
        printf("************************************************\n");

    if (dt < tp)
    {
        printf(" No elliptical path possible \n");
        return;
    }

    if (dt > tm)
    {
        aflag = true;
    }

    f64 fm = evaluate(amin);
//.........这里部分代码省略.........
开发者ID:oygx210,项目名称:slingshot,代码行数:101,代码来源:Lambert_Jat.cpp


示例13: collideWithWorld

core::vector3df collideWithWorld(s32 recursionDepth, SCollisionData &colData, core::vector3df pos, core::vector3df vel)
{
	f32 veryCloseDistance = colData.slidingSpeed;
	
	if (recursionDepth > 5)
		return pos;

	colData.velocity = vel;
	colData.normalizedVelocity = vel;
	colData.normalizedVelocity.normalize();
	colData.basePoint = pos;
	colData.foundCollision = false;
	colData.nearestDistance = FLT_MAX;

	double uhel_cos = 90 - acos(colData.normalizedVelocity.dotProduct(vector3df(0, -1, 0).normalize())) * 180.0 / PI;

	if (recursionDepth > 0 && vel.getLength() > 0 && vel.Y < 0)
	{
		if (abs(uhel_cos) < 50)
			return pos;
	}


	//------------------ collide with world

	// get all triangles with which we might collide
	core::aabbox3d<f32> box(colData.R3Position);
	box.addInternalPoint(colData.R3Position + colData.R3Velocity);
	box.MinEdge -= colData.eRadius;
	box.MaxEdge += colData.eRadius;

	s32 totalTriangleCnt = colData.selector->getTriangleCount();
	Triangles.set_used(totalTriangleCnt);

	core::matrix4 scaleMatrix;
	scaleMatrix.setScale(
			core::vector3df(1.0f / colData.eRadius.X,
					1.0f / colData.eRadius.Y,
					1.0f / colData.eRadius.Z));

	s32 triangleCnt = 0;


	colData.selector->getTriangles(Triangles.pointer(), totalTriangleCnt, triangleCnt, box, &scaleMatrix);


	for (s32 i=0; i<triangleCnt; ++i)
		if(testTriangleIntersection(&colData, Triangles[i]))
			colData.triangleIndex = i;


	//---------------- end collide with world

	if (!colData.foundCollision)
		return pos + vel;

	// original destination point
	const core::vector3df destinationPoint = pos + vel;
	core::vector3df newBasePoint = pos;

	if (colData.nearestDistance >= veryCloseDistance)
	{
		core::vector3df v = vel;
		v.setLength( colData.nearestDistance - veryCloseDistance );
		newBasePoint = colData.basePoint + v;

		v.normalize();
		colData.intersectionPoint -= (v * veryCloseDistance);
	}

	// calculate sliding plane

	const core::vector3df slidePlaneOrigin = colData.intersectionPoint;
	const core::vector3df slidePlaneNormal = (newBasePoint - colData.intersectionPoint).normalize();
	core::plane3d<f32> slidingPlane(slidePlaneOrigin, slidePlaneNormal);

	core::vector3df newDestinationPoint =
		destinationPoint -
		(slidePlaneNormal * slidingPlane.getDistanceTo(destinationPoint));

	// generate slide vector

	const core::vector3df newVelocityVector = newDestinationPoint -
		colData.intersectionPoint;

	if (newVelocityVector.getLength() < veryCloseDistance)
		return newBasePoint;

	//printf("Puvodni delka: %f | nova delka: %f\n", colData.velocity.getLength(), newVelocityVector.getLength());

	return collideWithWorld(recursionDepth+1, colData,
		newBasePoint, newVelocityVector);
}
开发者ID:vasekkraka,项目名称:WorldOfWraithRPG,代码行数:93,代码来源:CColManager.cpp


示例14: main

int main()
{
	srand((u32)time(0)); // This is to generate random seeds.

	IrrlichtDevice* device = createDevice(video::EDT_OPENGL);

	CEventReceiver receiver;
	device->setEventReceiver(&receiver);

	manager = device->getSceneManager();
	driver = device->getVideoDriver();

	gui::IGUIEnvironment* guienv = device->getGUIEnvironment();
	//
	// Load tree designs
	//
	for (s32 i = 0; i<NUM_TREE_DESIGNS; i++)
	{
		treeDesigns[i].Generator = new CTreeGenerator(manager);

		io::IXMLReader* xml = device->getFileSystem()->createXMLReader(treeDesignFiles[i].DesignFile);

		treeDesigns[i].Generator->loadFromXML(xml);

		xml->drop();

		treeDesigns[i].TreeTexture = driver->getTexture(treeDesignFiles[i].TreeTextureFile);

		treeDesigns[i].LeafTexture = driver->getTexture(treeDesignFiles[i].LeafTextureFile);

		treeDesigns[i].BillTexture = driver->getTexture(treeDesignFiles[i].BillTextureFile);
	}

	//
	// Load leaf shader
	//
	leafMaterialType = (video::E_MATERIAL_TYPE) driver->getGPUProgrammingServices()->addHighLevelShaderMaterialFromFiles(
		"./shaders/leaves.vert",
		"main",
		EVST_VS_2_0,
		"./shaders/leaves.frag",
		"main",
		EPST_PS_2_0,
		0,
		EMT_TRANSPARENT_ALPHA_CHANNEL,
		0);



	//
	// Tree scene node
	//    
	tree = new CTreeSceneNode(manager->getRootSceneNode(), manager);
	tree->drop();

	tree->setMaterialFlag(video::EMF_LIGHTING, lightsEnabled);


	//
	// Camera
	//
	scene::ICameraSceneNode* camera = manager->addCameraSceneNodeFPS(0, 100, 100);

	camera->setPosition(core::vector3df(23.4f, 233.4f, -150.9f));


	//
	// Light
	//
	scene::ILightSceneNode* light = manager->addLightSceneNode(0, core::vector3df(100, 100, 100), video::SColorf(1, 1, 1, 1), 10000.0f);

	light->getLightData().AmbientColor.set(0.25f, 0.25f, 0.25f, 0.25f);

	lightDir = core::vector3df(-1, -1, -1);
	lightDir.normalize();


	generateNewTree();

	//
	// Interface
	//
	guienv->getSkin()->setColor(gui::EGDC_BUTTON_TEXT, video::SColor(255, 200, 255, 255));

	guienv->addStaticText(L"By Asger Feldthaus", core::rect<s32>(10, 40, 100, 60));

	guienv->addStaticText(L"F6: Toggle lighting", core::rect<s32>(10, 260, 100, 280));
	guienv->addStaticText(L"F7: Previous tree design", core::rect<s32>(10, 280, 100, 300));
	guienv->addStaticText(L"F8: Next tree design", core::rect<s32>(10, 300, 100, 320));
	guienv->addStaticText(L"F9: Generate new tree", core::rect<s32>(10, 320, 100, 340));

	//
	// Run loop
	//
	while (device->run())
	{
		//
		// Render
		//
		driver->beginScene(true, true, video::SColor(0, 40, 40, 40));
//.........这里部分代码省略.........
开发者ID:pdpdds,项目名称:win32opensource2,代码行数:101,代码来源:irrTreeEx.cpp


示例15: clear

	void Vertex::clear()
	{
		position.set(0,0,0);
		normal.set(0,0,0);
		color.clear();
		texCoords.set(0,0,0);
		lmapCoords.set(0,0,0);
	}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:8,代码来源:CCSMLoader.cpp


示例16: clear

	void Mesh::clear()
	{
		flags = 0;
		groupId = 0;
		visgroupId = 0;
		props = "";
		color.clear();
		position.set(0,0,0);

		for(u32 s = 0; s < surfaces.size(); s++)
		{
			delete surfaces[s];
		}
		surfaces.clear();
	}
开发者ID:RealBadAngel,项目名称:irrlicht.netcp,代码行数:15,代码来源:CCSMLoader.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ coreipc::ArgumentDecoder类代码示例发布时间:2022-05-31
下一篇:
C++ core::stringw类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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