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


C++ LLQuaternion函数代码示例

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


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

示例1: bbox2

	void object::test<2>()
	{	
		//
		// test the non-default constructor
		//
		
		LLBBox bbox2(LLVector3(1.0f, 2.0f, 3.0f), LLQuaternion(),
					 LLVector3(2.0f, 3.0f, 4.0f), LLVector3(4.0f, 5.0f, 6.0f));
		
		ensure_equals("Custom bbox min", bbox2.getMinLocal(), LLVector3(2.0f, 3.0f, 4.0f));
		ensure_equals("Custom bbox max", bbox2.getMaxLocal(), LLVector3(4.0f, 5.0f, 6.0f));
		ensure_equals("Custom bbox pos agent", bbox2.getPositionAgent(), LLVector3(1.0f, 2.0f, 3.0f));
		ensure_equals("Custom bbox rotation", bbox2.getRotation(), LLQuaternion(0.0f, 0.0f, 0.0f, 1.0f));		
	}
开发者ID:OS-Development,项目名称:VW.Kirsten,代码行数:14,代码来源:llbbox_test.cpp

示例2: get_selection_axis_aligned_bbox

// the selection bbox isn't axis aligned, so we must construct one
// should this be cached in the selection manager?  yes.
LLBBox get_selection_axis_aligned_bbox()
{
	LLBBox selection_bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
	LLVector3 position = selection_bbox.getPositionAgent();
	
	LLBBox axis_aligned_bbox = LLBBox(position, LLQuaternion(), LLVector3(), LLVector3());
	axis_aligned_bbox.addPointLocal(LLVector3());

	// cycle over the nodes in selection
	for (LLObjectSelection::iterator selection_iter = LLSelectMgr::getInstance()->getSelection()->begin();
		 selection_iter != LLSelectMgr::getInstance()->getSelection()->end();
		 ++selection_iter)
	{
		LLSelectNode *select_node = *selection_iter;
		if (select_node)
		{
			LLViewerObject* object = select_node->getObject();
			if (object)
			{
				axis_aligned_bbox.addBBoxAgent(object->getBoundingBoxAgent());
			}
		}
	}

	
	return axis_aligned_bbox;
}
开发者ID:OS-Development,项目名称:VW.Dolphin_v3,代码行数:29,代码来源:qtoolalign.cpp

示例3: LLVector3

LLCamera LLSpatialBridge::transformCamera(LLCamera& camera)
{
	LLCamera ret = camera;
	LLXformMatrix* mat = mDrawable->getXform();
	LLVector3 center = LLVector3(0,0,0) * mat->getWorldMatrix();
	LLQuaternion rotation = LLQuaternion(mat->getWorldMatrix());

	LLVector3 delta = ret.getOrigin() - center;
	LLQuaternion rot = ~mat->getRotation();

	delta *= rot;
	LLVector3 lookAt = ret.getAtAxis();
	LLVector3 up_axis = ret.getUpAxis();
	LLVector3 left_axis = ret.getLeftAxis();

	lookAt *= rot;
	up_axis *= rot;
	left_axis *= rot;

	if (!delta.isFinite())
	{
		delta.clearVec();
	}

	ret.setOrigin(delta);
	ret.setAxes(lookAt, left_axis, up_axis);
		
	return ret;
}
开发者ID:DarkSpyro003,项目名称:DarkSpyros_Viewer,代码行数:29,代码来源:lldrawable.cpp

示例4: offset_agent

LLVector3 primbackup::offset_agent(LLVector3 offset)
{
	LLVector3 pos= gAgent.getPositionAgent();
	LLQuaternion agent_rot=LLQuaternion(gAgent.getAtAxis(),gAgent.getLeftAxis(),gAgent.getUpAxis());
	pos=(offset*agent_rot+pos);
	return pos;
}
开发者ID:kow,项目名称:Meerkat-Viewer,代码行数:7,代码来源:primbackup.cpp

示例5: ensure_equals

	void object::test<12>()
	{
		//
		// test the expand() method
		//
		
		LLBBox bbox1;
		bbox1.expand(0.0);

		ensure_equals("Zero-expanded Default BBox center", bbox1.getCenterLocal(), LLVector3(0.0f, 0.0f, 0.0f));

		LLBBox bbox2(LLVector3(1.0f, 1.0f, 1.0f), LLQuaternion(),
					 LLVector3(1.0f, 1.0f, 1.0f), LLVector3(3.0f, 3.0f, 3.0f));
		bbox2.expand(0.0);
		
		ensure_equals("Zero-expanded center local", bbox2.getCenterLocal(), LLVector3(2.0f, 2.0f, 2.0f));
		ensure_equals("Zero-expanded center agent", bbox2.getCenterAgent(), LLVector3(3.0f, 3.0f, 3.0f));
		ensure_equals("Zero-expanded min", bbox2.getMinLocal(), LLVector3(1.0f, 1.0f, 1.0f));
		ensure_equals("Zero-expanded max", bbox2.getMaxLocal(), LLVector3(3.0f, 3.0f, 3.0f));

		bbox2.expand(0.5);

		ensure_equals("Positive-expanded center", bbox2.getCenterLocal(), LLVector3(2.0f, 2.0f, 2.0f));
		ensure_equals("Positive-expanded min", bbox2.getMinLocal(), LLVector3(0.5f, 0.5f, 0.5f));
		ensure_equals("Positive-expanded max", bbox2.getMaxLocal(), LLVector3(3.5f, 3.5f, 3.5f));

		bbox2.expand(-1.0);
		
		ensure_equals("Negative-expanded center", bbox2.getCenterLocal(), LLVector3(2.0f, 2.0f, 2.0f));
		ensure_equals("Negative-expanded min", bbox2.getMinLocal(), LLVector3(1.5f, 1.5f, 1.5f));
		ensure_equals("Negative-expanded max", bbox2.getMaxLocal(), LLVector3(2.5f, 2.5f, 2.5f));		
	}
开发者ID:OS-Development,项目名称:VW.Kirsten,代码行数:32,代码来源:llbbox_test.cpp

示例6: bbox1

	void object::test<13>()
	{
		//
		// test the localToAgent() method
		//
		
		LLBBox bbox1(LLVector3(1.0f, 1.0f, 1.0f), LLQuaternion(),
					 LLVector3(1.0f, 1.0f, 1.0f), LLVector3(3.0f, 3.0f, 3.0f));
		
		ensure_equals("localToAgent(1,2,3)", bbox1.localToAgent(LLVector3(1.0f, 2.0f, 3.0f)), LLVector3(2.0f, 3.0f, 4.0f));
		
		LLBBox bbox2(LLVector3(1.0f, 1.0f, 1.0f), LLQuaternion(ANGLE, LLVector3(1.0f, 0.0f, 0.0f)),
					 LLVector3(1.0f, 1.0f, 1.0f), LLVector3(3.0f, 3.0f, 3.0f));
		
		ensure("localToAgent(1,2,3) rot", APPROX_EQUAL(bbox2.localToAgent(LLVector3(1.0f, 2.0f, 3.0f)), LLVector3(2.0f, -2.0f, 3.0f)));
	}
开发者ID:OS-Development,项目名称:VW.Kirsten,代码行数:16,代码来源:llbbox_test.cpp

示例7:

const LLVector3&	LLVector3::rotVec(F32 angle, const LLVector3 &vec)
{
	if ( !vec.isExactlyZero() && angle )
	{
		*this = *this * LLQuaternion(angle, vec);
	}
	return *this;
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:8,代码来源:v3math.cpp

示例8: ftm

void LLSpatialBridge::updateSpatialExtents()
{
	LLSpatialGroup* root = (LLSpatialGroup*) mOctree->getListener(0);
	
	{
		LLFastTimer ftm(LLFastTimer::FTM_CULL_REBOUND);
		root->rebound();
	}
	
	LLXformMatrix* mat = mDrawable->getXform();
	
	LLVector3 offset = root->mBounds[0];
	LLVector3 size = root->mBounds[1];
		
	LLVector3 center = LLVector3(0,0,0) * mat->getWorldMatrix();
	LLQuaternion rotation = LLQuaternion(mat->getWorldMatrix());
	
	offset *= rotation;
	center += offset;
	
	LLVector3 v[4];
	//get 4 corners of bounding box
	v[0] = (size * rotation);
	v[1] = (LLVector3(-size.mV[0], -size.mV[1], size.mV[2]) * rotation);
	v[2] = (LLVector3(size.mV[0], -size.mV[1], -size.mV[2]) * rotation);
	v[3] = (LLVector3(-size.mV[0], size.mV[1], -size.mV[2]) * rotation);

	LLVector3& newMin = mExtents[0];
	LLVector3& newMax = mExtents[1];
	
	newMin = newMax = center;
	
	for (U32 i = 0; i < 4; i++)
	{
		for (U32 j = 0; j < 3; j++)
		{
			F32 delta = fabsf(v[i].mV[j]);
			F32 min = center.mV[j] - delta;
			F32 max = center.mV[j] + delta;
			
			if (min < newMin.mV[j])
			{
				newMin.mV[j] = min;
			}
			
			if (max > newMax.mV[j])
			{
				newMax.mV[j] = max;
			}
		}
	}

	LLVector3 diagonal = newMax - newMin;
	mRadius = diagonal.magVec() * 0.5f;
	
	mPositionGroup.setVec((newMin + newMax) * 0.5f);
	updateBinRadius();
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:58,代码来源:lldrawable.cpp

示例9: initRotation

LLMatrix4::LLMatrix4(const F32 angle, const LLVector4 &vec)
{
	initRotation(LLQuaternion(angle, vec));

	mMatrix[3][0] = 0.f;
	mMatrix[3][1] = 0.f;
	mMatrix[3][2] = 0.f;
	mMatrix[3][3] = 1.f;
}
开发者ID:Xara,项目名称:Opensource-V2-SL-Viewer,代码行数:9,代码来源:m4math.cpp

示例10: LLQuaternion

	void LLSDMessageReaderTestObject::test<17>()
		// Quaternion
	{
		 LLQuaternion outValue, inValue = LLQuaternion(1,2,3,4);
		LLSD sdValue = ll_sd_from_quaternion(inValue);
		LLSDMessageReader msg = testType(sdValue);
		msg.getQuat("block", "var", outValue);
		ensure_equals("Ensure Quaternion", outValue, inValue);
	}
开发者ID:Boy,项目名称:netbook,代码行数:9,代码来源:llsdmessagereader_tut.cpp

示例11: vec

const LLVector3&	LLVector3::rotVec(F32 angle, F32 x, F32 y, F32 z)
{
	LLVector3 vec(x, y, z);
	if ( !vec.isExactlyZero() && angle )
	{
		*this = *this * LLQuaternion(angle, vec);
	}
	return *this;
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:9,代码来源:v3math.cpp

示例12: ftm

void LLWLParamManager::update(LLViewerCamera * cam)
{
	LLFastTimer ftm(LLFastTimer::FTM_UPDATE_WLPARAM);
	
	// update clouds, sun, and general
	mCurParams.updateCloudScrolling();
	
	// update only if running
	if(mAnimator.mIsRunning) 
	{
		mAnimator.update(mCurParams);
	}

	// update the shaders and the menu
	propagateParameters();
	
	// sync menus if they exist
	if(LLFloaterWindLight::isOpen()) 
	{
		LLFloaterWindLight::instance()->syncMenu();
	}
	if(LLFloaterDayCycle::isOpen()) 
	{
		LLFloaterDayCycle::instance()->syncMenu();
	}
	if(LLFloaterEnvSettings::isOpen()) 
	{
		LLFloaterEnvSettings::instance()->syncMenu();
	}

	F32 camYaw = cam->getYaw();

	stop_glerror();

	// *TODO: potential optimization - this block may only need to be
	// executed some of the time.  For example for water shaders only.
	{
		F32 camYawDelta = mSunDeltaYaw * DEG_TO_RAD;
		
		LLVector3 lightNorm3(mLightDir);	
		lightNorm3 *= LLQuaternion(-(camYaw + camYawDelta), LLVector3(0.f, 1.f, 0.f));
		mRotatedLightDir = LLVector4(lightNorm3, 0.f);

		LLViewerShaderMgr::shader_iter shaders_iter, end_shaders;
		end_shaders = LLViewerShaderMgr::instance()->endShaders();
		for(shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
		{
			if (shaders_iter->mProgramObject != 0
				&& (gPipeline.canUseWindLightShaders()
				|| shaders_iter->mShaderGroup == LLGLSLShader::SG_WATER))
			{
				shaders_iter->mUniformsDirty = TRUE;
			}
		}
	}
}
开发者ID:djdevil1989,项目名称:Luna-Viewer,代码行数:56,代码来源:llwlparammanager.cpp

示例13: mat

LLMatrix4::LLMatrix4(const F32 roll, const F32 pitch, const F32 yaw)
{
	LLMatrix3	mat(roll, pitch, yaw);
	initRotation(LLQuaternion(mat));

	mMatrix[3][0] = 0.f;
	mMatrix[3][1] = 0.f;
	mMatrix[3][2] = 0.f;
	mMatrix[3][3] = 1.f;
}
开发者ID:Xara,项目名称:Opensource-V2-SL-Viewer,代码行数:10,代码来源:m4math.cpp

示例14: LLQuaternion

	void LLSDMessageBuilderTestObject::test<14>()
		 // Quaternion
	{
	  LLQuaternion outValue, inValue = LLQuaternion(1,2,3,4);
	  LLSDMessageBuilder builder = defaultBuilder();
	  builder.addQuat("var", inValue);
	  LLSDMessageReader reader = setReader(builder);
	  reader.getQuat("block", "var", outValue);
	  ensure_equals("Ensure Quaternion", inValue, outValue);
	}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:10,代码来源:llsdmessagebuilder_tut.cpp

示例15: dxcmd

bool dxcmd(std::string revised_text, EChatType type)
{
    
        std::istringstream i(revised_text);
		std::string command;
		i >> command;
        LLStringUtil::toLower(command);
		if(command != "")
        {
            if(command == "###test")
            {
                llinfos << "test chat dxchatcmd!" << llendl;
				return false;
            }
            else if(command == "###platform")
            {
                llinfos << "rez a platform!" << llendl;
			    LLVector3 agentPos = gAgent.getPositionAgent()+(gAgent.getVelocity()*(F32)0.333);
				LLMessageSystem* msg = gMessageSystem;
				msg->newMessageFast(_PREHASH_ObjectAdd);
				msg->nextBlockFast(_PREHASH_AgentData);
				msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
				msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
				msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
				msg->nextBlockFast(_PREHASH_ObjectData);
				msg->addU8Fast(_PREHASH_PCode, LL_PCODE_VOLUME);
				msg->addU8Fast(_PREHASH_Material,	LL_MCODE_METAL);

				if(agentPos.mV[2] > 4096.0)msg->addU32Fast(_PREHASH_AddFlags, FLAGS_CREATE_SELECTED);
				else msg->addU32Fast(_PREHASH_AddFlags, 0);

				LLVolumeParams	volume_params;

				volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE );
				volume_params.setBeginAndEndS( 0.f, 1.f );
				volume_params.setBeginAndEndT( 0.f, 1.f );
				volume_params.setRatio	( 1, 1 );
				volume_params.setShear	( 0, 0 );

				LLVolumeMessage::packVolumeParams(&volume_params, msg);
				LLVector3 rezpos = agentPos - LLVector3(0.0f,0.0f,2.5f);
				msg->addVector3Fast(_PREHASH_Scale,			LLVector3(20.0f,20.0f,0.25f) );
				msg->addQuatFast(_PREHASH_Rotation,			LLQuaternion() );
				msg->addVector3Fast(_PREHASH_RayStart,		rezpos );
				msg->addVector3Fast(_PREHASH_RayEnd,			rezpos );
				msg->addU8Fast(_PREHASH_BypassRaycast,		(U8)1 );
				msg->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE );
				msg->addU8Fast(_PREHASH_State, 0);
				msg->addUUIDFast(_PREHASH_RayTargetID,			LLUUID::null );
				msg->sendReliable(gAgent.getRegionHost());
				return false;
            }
        }
     return true;
    }
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:55,代码来源:dxchatcmd.cpp


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