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

C++ Float4函数代码示例

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

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



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

示例1: ConvertToStaticSampler

D3D12_STATIC_SAMPLER_DESC ConvertToStaticSampler(const D3D12_SAMPLER_DESC& samplerDesc, uint32 shaderRegister,
                                                 uint32 registerSpace, D3D12_SHADER_VISIBILITY visibility)
{
    D3D12_STATIC_SAMPLER_DESC staticDesc = { };
    staticDesc.Filter = samplerDesc.Filter;
    staticDesc.AddressU = samplerDesc.AddressU;
    staticDesc.AddressV = samplerDesc.AddressV;
    staticDesc.AddressW = samplerDesc.AddressW;
    staticDesc.MipLODBias = samplerDesc.MipLODBias;
    staticDesc.MaxAnisotropy = samplerDesc.MaxAnisotropy;
    staticDesc.ComparisonFunc = samplerDesc.ComparisonFunc;
    staticDesc.MinLOD = samplerDesc.MinLOD;
    staticDesc.MaxLOD = samplerDesc.MaxLOD;
    staticDesc.ShaderRegister = shaderRegister;
    staticDesc.RegisterSpace = registerSpace;
    staticDesc.ShaderVisibility = visibility;

    Float4 borderColor = Float4(samplerDesc.BorderColor[0], samplerDesc.BorderColor[1], samplerDesc.BorderColor[2], samplerDesc.BorderColor[3]);
    if(borderColor == Float4(1.0f, 1.0f, 1.0f, 1.0f))
        staticDesc.BorderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE;
    else if(borderColor == Float4(0.0f, 0.0f, 0.0f, 1.0f))
        staticDesc.BorderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK;
    else
        staticDesc.BorderColor =  D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK;

    return staticDesc;
}
开发者ID:TheRealMJP,项目名称:DeferredTexturing,代码行数:27,代码来源:DX12_Helpers.cpp


示例2: lightGray

//----------------------------------------------------------------------------
void Delaunay3D::DoSearch ()
{
    // Make all tetra wireframe.
    const int numSimplices = mDelaunay->GetNumSimplices();
    Float4 lightGray(0.75f, 0.75f, 0.75f, 1.0f);
    int i;
    for (i = 0; i < numSimplices; ++i)
    {
        ChangeTetraStatus(i, lightGray, true);
    }

    // Generate random point in AABB of data set.
    Vector3f random;
    random.X() = Mathf::IntervalRandom(mMin.X(), mMax.X());
    random.Y() = Mathf::IntervalRandom(mMin.Y(), mMax.Y());
    random.Z() = Mathf::IntervalRandom(mMin.Z(), mMax.Z());

    // Move sphere to this location.
    Spatial* sphere = mScene->GetChild(0);
    sphere->Culling = Spatial::CULL_DYNAMIC;
    sphere->LocalTransform.SetTranslate(random);
    sphere->Update();

    if (mDelaunay->GetContainingTetrahedron(random) >= 0)
    {
        // Make all tetra on the path solid.
        const int pathLast = mDelaunay->GetPathLast();
        for (i = 0; i <= pathLast; ++i)
        {
            int index = mDelaunay->GetPath()[i];
            float red, blue;
            if (pathLast > 0)
            {
                red = i/(float)pathLast;
                blue = 1.0f - red;
            }
            else
            {
                red = 1.0f;
                blue = 0.0f;
            }
            ChangeTetraStatus(index, Float4(red, 0.0f, blue, 0.5f), false);
        }
    }
    else
    {
        // The point is outside the convex hull.  Change the wireframe
        // color for the last visited face in the search path.
        int index = mDelaunay->GetPath()[mDelaunay->GetPathLast()];
        int v0, v1, v2, v3;
        int vOpposite = mDelaunay->GetLastFace(v0, v1, v2, v3);
        ChangeLastTetraStatus(index, vOpposite,
            Float4(0.0f, 1.0f, 0.0f, 0.5f),
            Float4(0.0f, 0.25f, 0.0f, 0.5f));
    }

    mCuller.ComputeVisibleSet(mScene);
}
开发者ID:rasslingcats,项目名称:calico,代码行数:59,代码来源:Delaunay3D.cpp


示例3: Float4

LightDescPoint::LightDescPoint()
{
	ambient		= Float4(0.0f, 0.0f, 0.0f, 0.0f);
	diffuse		= Float4(0.0f, 0.0f, 0.0f, 0.0f);
	specular	= Float4(0.0f, 0.0f, 0.0f, 0.0f);

	range		= 0.0f;
	attenuation	= Float3(0.0f, 0.0f, 0.0f);
}
开发者ID:CaterHatterPillar,项目名称:xkill-source,代码行数:9,代码来源:LightDesc.cpp


示例4: OnGrassClick

void GrassModule::OnGrassClick(const MGUI::MouseEvent * e)
{
	if (mImageBox_Selected)
		mImageBox_Selected->SetColor(Float4(1.0f, 1.0f, 1.0f));

	mImageBox_Selected = (MGUI::ImageBox *)e->sender;

	if (mImageBox_Selected)
		mImageBox_Selected->SetColor(Float4(0.7f, 0.7f, 1.0f));
}
开发者ID:MSoft1115,项目名称:Rad3D,代码行数:10,代码来源:GrassModule.cpp


示例5: lerp3d

 Point lerp3d(const Point& px0y0z0, const Point& px1y0z0, const Point& px0y1z0, const Point& px1y1z0,
     const Point& px0y0z1, const Point& px1y0z1, const Point& px0y1z1, const Point& px1y1z1,
     float xPoint, float yPoint, float zPoint) {
         return Point(lerp3d(Float4(px0y0z0), Float4(px1y0z0), Float4(px0y1z0), Float4(px1y1z0), 
             Float4(px0y0z1), Float4(px1y0z1), Float4(px0y1z1), Float4(px1y1z1), 
             xPoint, yPoint, zPoint));
 }
开发者ID:atanas1054,项目名称:ray_tracer,代码行数:7,代码来源:interpolate.cpp


示例6: Float4

Float4 Quaternion::getAxisAndAngle() const
{
    float ha = std::acos(w);
    float sha = std::sin(ha);

    return Float4(x / sha, y / sha, z / sha, ha*2.0f);
}
开发者ID:pendingchaos,项目名称:WIP12,代码行数:7,代码来源:quaternion.cpp


示例7: Float3

void GrassModule::OnRender()
{
	if (!mLayout->IsVisible() || mImageBox_Selected == NULL || !Terrain::Instance()->IsValid())
		return ;

	Aabb aabb;
	aabb.minimum = mBrushPosition - Float3(mBrushSize * 0.5f, 1, mBrushSize * 0.5f);
	aabb.maximum = mBrushPosition + Float3(mBrushSize * 0.5f, 1, mBrushSize * 0.5f);

	RenderSystem::Instance()->SetWorldTM(Mat4::Identity);

	for (int y = 0; y < Terrain::Instance()->GetInfo()->BlockCount.x; ++y)
	{
		for (int x = 0; x < Terrain::Instance()->GetInfo()->BlockCount.y; ++x)
		{
			TerrainMesh * mesh = Terrain::Instance()->_getBlock(x, y);
			const Aabb & bound = mesh->GetWorldAabb();

			float x0 = Max(aabb.minimum.x, bound.minimum.x);
			float z0 = Max(aabb.minimum.z, bound.minimum.z);

			float x1 = Min(aabb.maximum.x, bound.maximum.x);
			float z1 = Min(aabb.maximum.z, bound.maximum.z);

			if (x0 <= x1 && z0 <= z1)
			{
				mShaderFX_Brush->GetPass(0)->SetConst("u_MinInvSize", Float4(aabb.minimum.x, aabb.minimum.z, 1 / mBrushSize, 1 / mBrushSize));
				mShaderFX_Brush->GetPass(0)->SetConst("u_XZTransform", mesh->GetXZTransform());

				RenderSystem::Instance()->SetTexture(0, MGUI::Helper::Instance()->GetWhiteTexture().c_ptr());
				RenderSystem::Instance()->Render(mShaderFX_Brush, mesh->GetRenderOp());
			}
		}
	}
}
开发者ID:MSoft1115,项目名称:Rad3D,代码行数:35,代码来源:GrassModule.cpp


示例8: WindowApplication3

//----------------------------------------------------------------------------
BSplineSurfaceFitter::BSplineSurfaceFitter ()
	:
	WindowApplication3("SampleMathematics/BSplineSurfaceFitter", 0, 0, 640,
	                   480, Float4(0.0f, 0.5f, 0.75f, 1.0f)),
	mTextColor(0.0f, 0.0f, 0.0f, 1.0f)
{
}
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:8,代码来源:BSplineSurfaceFitter.cpp


示例9: WindowApplication3

//----------------------------------------------------------------------------
PolyhedronDistance::PolyhedronDistance ()
    :
    WindowApplication3("SamplePhysics/PolyhedronDistance", 0, 0, 640, 480,
        Float4(0.5f, 0.0f, 1.0f, 1.0f)),
        mTextColor(1.0f, 1.0f, 1.0f, 1.0f)
{
}
开发者ID:rasslingcats,项目名称:calico,代码行数:8,代码来源:PolyhedronDistance.cpp


示例10: WindowApplication3

//----------------------------------------------------------------------------
FoucaultPendulum::FoucaultPendulum ()
    :
    WindowApplication3("SamplePhysics/FoucaultPendulum", 0, 0, 640, 480,
        Float4(0.819607f, 0.909803f, 0.713725f, 1.0f)),
        mTextColor(1.0f, 1.0f, 1.0f, 1.0f)
{
}
开发者ID:vijaynerella,项目名称:GeometricTools,代码行数:8,代码来源:FoucaultPendulum.cpp


示例11: WindowApplication2

//----------------------------------------------------------------------------
RoughPlaneThinRod2::RoughPlaneThinRod2 ()
	:
	WindowApplication2("SamplePhysics/RoughPlaneThinRod2", 0, 0, 256, 256,
	                   Float4(1.0f, 1.0f, 1.0f, 1.0f))
{
	mSize = GetWidth();
}
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:8,代码来源:RoughPlaneThinRod2.cpp


示例12: WindowApplication3

//----------------------------------------------------------------------------
BillboardNodes::BillboardNodes ()
    :
    WindowApplication3("SampleGraphics/BillboardNodes",0, 0, 640, 480,
        Float4(0.9f, 0.9f, 0.9f, 1.0f)),
        mTextColor(1.0f, 1.0f, 1.0f, 1.0f)
{
}
开发者ID:rasslingcats,项目名称:calico,代码行数:8,代码来源:BillboardNodes.cpp


示例13: WindowApplication3

//----------------------------------------------------------------------------
ClodMeshes::ClodMeshes ()
    :
    WindowApplication3("SampleGraphics/ClodMeshes", 0, 0, 640, 480,
        Float4(0.9f, 0.9f, 0.9f, 1.0f)),
        mTextColor(0.0f, 0.0f, 0.0f, 1.0f)
{
}
开发者ID:vijaynerella,项目名称:GeometricTools,代码行数:8,代码来源:ClodMeshes.cpp


示例14: Float4

			const Ray operator * ( const Ray& lhs, const Matrix4x4& world )
			{
				const Float3 origin = lhs.origin * world;
				const Float3 direction = ( Float4( lhs.direction, 0 ) * world );
				Ray result( origin, direction );
				return result;
			}
开发者ID:kpongky,项目名称:At-Math,代码行数:7,代码来源:Ray.cpp


示例15: WindowApplication3

//----------------------------------------------------------------------------
NonuniformScale::NonuniformScale ()
    :
    WindowApplication3("SampleGraphics/NonuniformScale", 0, 0, 640, 480,
        Float4(0.5f, 0.0f, 1.0f, 1.0f)),
        mTextColor(1.0f, 1.0f, 1.0f, 1.0f)
{
}
开发者ID:rasslingcats,项目名称:calico,代码行数:8,代码来源:NonuniformScale.cpp


示例16: WindowApplication3

//----------------------------------------------------------------------------
BlendedAnimations::BlendedAnimations ()
	:
	WindowApplication3("SampleGraphics/BlendedAnimations", 0, 0, 768, 768,
	                   Float4(0.5f, 0.0f, 1.0f, 1.0f)),
	mTextColor(1.0f, 1.0f, 1.0f, 1.0f),
	mManager(ThePath + "Data/", "Biped"),
	mAnimTime(0.0),
	mUpArrowPressed(false),
	mShiftPressed(false)
{
	// Set animation information.  The counts differ in debug and release
	// builds because of the differing frame rates of those builds.
#ifdef _DEBUG
	int idleWalkCount = 100;
	int walkCount = 10;
	int walkRunCount = 100;
	mAnimTimeDelta = 0.01;
#else
	int idleWalkCount = 1000;
	int walkCount = 100;
	int walkRunCount = 1000;
	mAnimTimeDelta = 0.001;
#endif

	// The idle head turning occurs too frequently (frequency = 1 in the
	// original model).  Reduce the turning by half.
	mManager.SetIdle(0.5, 0.0);

	// The walk and run cycles must be aligned properly for blending.  A
	// phase of 0.2 for the run cycle aligns the biped feet.
	mManager.SetRun(1.0, 0.2);

	// The initial state is 'idle'.
	mManager.Initialize(idleWalkCount, walkCount, walkRunCount);
}
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:36,代码来源:BlendedAnimations.cpp


示例17: WindowApplication3

//----------------------------------------------------------------------------
ClipMesh::ClipMesh ()
    :
    WindowApplication3("SampleMathematics/ClipMesh", 0, 0, 640, 480,
        Float4(0.75f, 0.75f, 0.75f, 1.0f)),
        mTextColor(1.0f, 1.0f, 1.0f, 1.0f)
{
}
开发者ID:vijaynerella,项目名称:GeometricTools,代码行数:8,代码来源:ClipMesh.cpp


示例18: WindowApplication2

//----------------------------------------------------------------------------
PolygonDistance::PolygonDistance ()
	:
	WindowApplication2("SamplePhysics/PolygonDistance", 0, 0, 512, 512,
	                   Float4(1.0f, 1.0f, 1.0f, 1.0f))
{
	mSize = GetWidth();
}
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:8,代码来源:PolygonDistance.cpp


示例19: OnInit

	virtual void OnInit()
	{
		MGUI::FontManager::Instance()->Load("Sample.font");
		MGUI::InputManager::Instance()->E_MouseUp += new ncListener1<const MGUI::MouseEvent *>(OnPick);
		MGUI::InputManager::Instance()->E_TouchUp += new ncListener1<const MGUI::TouchEvent *>(OnPickTE);

		World::Instance()->MainRenderContext()->SetColorClear(eClearMode::ALL, Float4(0.15f, 0.15f, 0.15f));
		World::Instance()->MainCamera()->SetPosition(Float3(0, 5, -10));
		World::Instance()->MainCamera()->SetDirection(Float3(0, -5, 10));
		World::Instance()->MainLight()->SetDirection(Float3(0, -0.5f, 1));

		gMeshFloor = MeshManager::Instance()->NewPlane(Plane(0, 1, 0, 0), 10, 10);
		gMeshFloor->GetSubMesh(0)->GetMaterial()->ambient = Float3(0.3f, 0.0f, 0.3f);
		gMeshFloor->GetSubMesh(0)->GetMaterial()->diffuse = Float3(0.0f, 0.0f, 0.0f);

		gMeshBox = MeshManager::Instance()->NewBox(1, 1, 1);
		gMeshBox->GetSubMesh(0)->GetMaterial()->ambient = Float3(0.1f, 0.1f, 0.1f);
		gMeshBox->GetSubMesh(0)->GetMaterial()->diffuse = Float3(0.0f, 0.5f, 0.0f);
		gMeshBox->SetPosition(Float3(0, 3, 0));

		PhyWorld::Instance()->SetWorldGravity(0, -9.8f, 0);
		PhyWorld::Instance()->SetWorldContactSurfaceLayer(0.01f);

		gPhyEntityFloor = new PhyPlane;
		gPhyEntityFloor->SetCollisionFlag(FLAG_FLOOR);

		gPhyEntityBox = new PhyBox(PhyEntity::RIGID_BODY);
		gPhyEntityBox->SetBodyAutoDisable(false);
		gPhyEntityBox->SetLength(1, 1, 1);
		gPhyEntityBox->SetMass(5, 1, 1, 1);
		gPhyEntityBox->SetPosition(Float3(0, 3, 0));
		gPhyEntityBox->SetBounceParam(1.0f, 1.0f);
		gPhyEntityBox->SetCollisionFlag(FLAG_BOX);
		gPhyEntityBox->SetAngularVel(Float3(2, 2, 2));
	}
开发者ID:MSoft1115,项目名称:Rad3D,代码行数:35,代码来源:Demo08_Physics.cpp


示例20: Float3

void ExplosionSpherePhysicsObject::onUpdate(float delta)
{
	//--------------------------------------------------------------------------------------
	// Update scaling. Expand explosion sphere according to mutator settings retrieved in "subClassSpecificInitHook()"
	//--------------------------------------------------------------------------------------
	std::vector<int> explosionSphereEntityId = itrPhysics.ownerAt(attributeIndex_)->getAttributes(ATTRIBUTE_EXPLOSIONSPHERE);
	for(unsigned int i = 0; i < explosionSphereEntityId.size(); i++)
	{
		AttributePtr<Attribute_ExplosionSphere> ptr_explosionSphere = itrExplosionSphere.at(explosionSphereEntityId.at(i));
		ptr_explosionSphere->currentRadius += explosionSphereExpansionRate_*delta;
		if(ptr_explosionSphere->currentRadius >= explosionSphereFinalRadius_)
		{
			ptr_explosionSphere->currentRadius = explosionSphereFinalRadius_;
		}
		itrPhysics.at(attributeIndex_)->ptr_spatial->scale = Float3(ptr_explosionSphere->currentRadius,ptr_explosionSphere->currentRadius,ptr_explosionSphere->currentRadius);
		localCollisionShape_->setLocalScaling(btVector3(ptr_explosionSphere->currentRadius, ptr_explosionSphere->currentRadius, ptr_explosionSphere->currentRadius));
	}

	//--------------------------------------------------------------------------------------
	// Update rotation
	//--------------------------------------------------------------------------------------
	btQuaternion randomRotationQuaternion (randomRotation_.x()*delta,randomRotation_.y()*delta,randomRotation_.z()*delta);
	btQuaternion rotateWithRandomRotationQuaternion = randomRotationQuaternion*getWorldTransform().getRotation();
	getWorldTransform().setRotation(rotateWithRandomRotationQuaternion);
	itrPhysics.at(attributeIndex_)->ptr_spatial->rotation = Float4(rotateWithRandomRotationQuaternion.x(),rotateWithRandomRotationQuaternion.y(),rotateWithRandomRotationQuaternion.z(),rotateWithRandomRotationQuaternion.w());
}
开发者ID:CaterHatterPillar,项目名称:xkill-source,代码行数:26,代码来源:ExplosionSpherePhysicsObject.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ FloatAsInt函数代码示例发布时间:2022-05-30
下一篇:
C++ Float3函数代码示例发布时间: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