本文整理汇总了C++中LLVector3类的典型用法代码示例。如果您正苦于以下问题:C++ LLVector3类的具体用法?C++ LLVector3怎么用?C++ LLVector3使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLVector3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: llmax
S32 LLGlobalEconomy::calculateLightRent(const LLVector3& object_size) const
{
F32 intensity_mod = llmax(object_size.magVec(), 1.f);
return (S32)(intensity_mod * getPriceRentLight());
}
示例2: updateWind
void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
{
LLVector3 wind_pos;
F64 pitch;
F64 center_freq;
ALenum error;
if (!mEnableWind)
return;
if (!mWindBuf)
return;
if (mWindUpdateTimer.checkExpirationAndReset(LL_WIND_UPDATE_INTERVAL))
{
// wind comes in as Linden coordinate (+X = forward, +Y = left, +Z = up)
// need to convert this to the conventional orientation DS3D and OpenAL use
// where +X = right, +Y = up, +Z = backwards
wind_vec.setVec(-wind_vec.mV[1], wind_vec.mV[2], -wind_vec.mV[0]);
pitch = 1.0 + mapWindVecToPitch(wind_vec);
center_freq = 80.0 * pow(pitch,2.5*(mapWindVecToGain(wind_vec)+1.0));
mWindGen->mTargetFreq = (F32)center_freq;
mWindGen->mTargetGain = (F32)mapWindVecToGain(wind_vec) * mMaxWindGain;
mWindGen->mTargetPanGainR = (F32)mapWindVecToPan(wind_vec);
alSourcei(mWindSource, AL_LOOPING, AL_FALSE);
alSource3f(mWindSource, AL_POSITION, 0.0, 0.0, 0.0);
alSource3f(mWindSource, AL_VELOCITY, 0.0, 0.0, 0.0);
alSourcef(mWindSource, AL_ROLLOFF_FACTOR, 0.0);
alSourcei(mWindSource, AL_SOURCE_RELATIVE, AL_TRUE);
}
// ok lets make a wind buffer now
ALint processed, queued, unprocessed;
alGetSourcei(mWindSource, AL_BUFFERS_PROCESSED, &processed);
alGetSourcei(mWindSource, AL_BUFFERS_QUEUED, &queued);
unprocessed = queued - processed;
// ensure that there are always at least 3x as many filled buffers
// queued as we managed to empty since last time.
mNumEmptyWindALBuffers = llmin(mNumEmptyWindALBuffers + processed * 3 - unprocessed, MAX_NUM_WIND_BUFFERS-unprocessed);
mNumEmptyWindALBuffers = llmax(mNumEmptyWindALBuffers, 0);
//llinfos << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << llendl;
while (processed--) // unqueue old buffers
{
ALuint buffer;
ALenum error;
alGetError(); /* clear error */
alSourceUnqueueBuffers(mWindSource, 1, &buffer);
error = alGetError();
if (error != AL_NO_ERROR)
{
llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (unqueuing) buffers" << llendl;
}
else
{
alDeleteBuffers(1, &buffer);
}
}
unprocessed += mNumEmptyWindALBuffers;
while (mNumEmptyWindALBuffers > 0) // fill+queue new buffers
{
ALuint buffer;
alGetError(); /* clear error */
alGenBuffers(1,&buffer);
if ((error=alGetError()) != AL_NO_ERROR)
{
llwarns << "LLAudioEngine_OpenAL::updateWind() Error creating wind buffer: " << convertALErrorToString(error) << llendl;
break;
}
alBufferData(buffer,
AL_FORMAT_STEREO16,
mWindGen->windGenerate(mWindBuf,
mWindBufSamples),
mWindBufBytes,
mWindBufFreq);
error = alGetError();
if (error != AL_NO_ERROR)
{
llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers" << llendl;
}
alSourceQueueBuffers(mWindSource, 1, &buffer);
error = alGetError();
if (error != AL_NO_ERROR)
{
llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers" << llendl;
}
--mNumEmptyWindALBuffers;
}
//.........这里部分代码省略.........
示例3: frameRot
// writes contents to datapacker
BOOL LLBVHLoader::serialize(LLDataPacker& dp)
{
JointVector::iterator ji;
KeyVector::iterator ki;
F32 time;
// count number of non-ignored joints
S32 numJoints = 0;
for (ji=mJoints.begin(); ji!=mJoints.end(); ++ji)
{
Joint *joint = *ji;
if ( ! joint->mIgnore )
numJoints++;
}
// print header
dp.packU16(KEYFRAME_MOTION_VERSION, "version");
dp.packU16(KEYFRAME_MOTION_SUBVERSION, "sub_version");
dp.packS32(mPriority, "base_priority");
dp.packF32(mDuration, "duration");
dp.packString(mEmoteName, "emote_name");
dp.packF32(mLoopInPoint, "loop_in_point");
dp.packF32(mLoopOutPoint, "loop_out_point");
dp.packS32(mLoop, "loop");
dp.packF32(mEaseIn, "ease_in_duration");
dp.packF32(mEaseOut, "ease_out_duration");
dp.packU32(mHand, "hand_pose");
dp.packU32(numJoints, "num_joints");
for ( ji = mJoints.begin();
ji != mJoints.end();
++ji )
{
Joint *joint = *ji;
// if ignored, skip it
if ( joint->mIgnore )
continue;
LLQuaternion first_frame_rot;
LLQuaternion fixup_rot;
dp.packString(joint->mOutName, "joint_name");
dp.packS32(joint->mPriority, "joint_priority");
// compute coordinate frame rotation
LLQuaternion frameRot( joint->mFrameMatrix );
LLQuaternion frameRotInv = ~frameRot;
LLQuaternion offsetRot( joint->mOffsetMatrix );
// find mergechild and mergeparent joints, if specified
LLQuaternion mergeParentRot;
LLQuaternion mergeChildRot;
Joint *mergeParent = NULL;
Joint *mergeChild = NULL;
JointVector::iterator mji;
for (mji=mJoints.begin(); mji!=mJoints.end(); ++mji)
{
Joint *mjoint = *mji;
if ( !joint->mMergeParentName.empty() && (mjoint->mName == joint->mMergeParentName) )
{
mergeParent = *mji;
}
if ( !joint->mMergeChildName.empty() && (mjoint->mName == joint->mMergeChildName) )
{
mergeChild = *mji;
}
}
dp.packS32(joint->mNumRotKeys, "num_rot_keys");
LLQuaternion::Order order = bvhStringToOrder( joint->mOrder );
S32 outcount = 0;
S32 frame = 1;
for ( ki = joint->mKeys.begin();
ki != joint->mKeys.end();
++ki )
{
if ((frame == 1) && joint->mRelativeRotationKey)
{
first_frame_rot = mayaQ( ki->mRot[0], ki->mRot[1], ki->mRot[2], order);
fixup_rot.shortestArc(LLVector3::z_axis * first_frame_rot * frameRot, LLVector3::z_axis);
}
if (ki->mIgnoreRot)
{
frame++;
continue;
}
time = (F32)frame * mFrameTime;
if (mergeParent)
{
mergeParentRot = mayaQ( mergeParent->mKeys[frame-1].mRot[0],
mergeParent->mKeys[frame-1].mRot[1],
mergeParent->mKeys[frame-1].mRot[2],
//.........这里部分代码省略.........
示例4: resetDeltas
// -----------------------------------------------------------------------------
void LLViewerJoystick::moveFlycam(bool reset)
{
static LLQuaternion sFlycamRotation;
static LLVector3 sFlycamPosition;
static F32 sFlycamZoom;
if (!gFocusMgr.getAppHasFocus() || mDriverState != JDS_INITIALIZED
|| !gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickFlycamEnabled"))
{
return;
}
S32 axis[] =
{
gSavedSettings.getS32("JoystickAxis0"),
gSavedSettings.getS32("JoystickAxis1"),
gSavedSettings.getS32("JoystickAxis2"),
gSavedSettings.getS32("JoystickAxis3"),
gSavedSettings.getS32("JoystickAxis4"),
gSavedSettings.getS32("JoystickAxis5"),
gSavedSettings.getS32("JoystickAxis6")
};
bool in_build_mode = LLToolMgr::getInstance()->inBuildMode();
if (reset || mResetFlag)
{
sFlycamPosition = LLViewerCamera::getInstance()->getOrigin();
sFlycamRotation = LLViewerCamera::getInstance()->getQuaternion();
sFlycamZoom = LLViewerCamera::getInstance()->getView();
resetDeltas(axis);
return;
}
F32 axis_scale[] =
{
gSavedSettings.getF32("FlycamAxisScale0"),
gSavedSettings.getF32("FlycamAxisScale1"),
gSavedSettings.getF32("FlycamAxisScale2"),
gSavedSettings.getF32("FlycamAxisScale3"),
gSavedSettings.getF32("FlycamAxisScale4"),
gSavedSettings.getF32("FlycamAxisScale5"),
gSavedSettings.getF32("FlycamAxisScale6")
};
F32 dead_zone[] =
{
gSavedSettings.getF32("FlycamAxisDeadZone0"),
gSavedSettings.getF32("FlycamAxisDeadZone1"),
gSavedSettings.getF32("FlycamAxisDeadZone2"),
gSavedSettings.getF32("FlycamAxisDeadZone3"),
gSavedSettings.getF32("FlycamAxisDeadZone4"),
gSavedSettings.getF32("FlycamAxisDeadZone5"),
gSavedSettings.getF32("FlycamAxisDeadZone6")
};
F32 time = gFrameIntervalSeconds;
// avoid making ridicously big movements if there's a big drop in fps
if (time > .2f)
{
time = .2f;
}
F32 cur_delta[7];
F32 feather = gSavedSettings.getF32("FlycamFeathering");
bool absolute = gSavedSettings.getBOOL("Cursor3D");
for (U32 i = 0; i < 7; i++)
{
cur_delta[i] = -getJoystickAxis(axis[i]);
F32 tmp = cur_delta[i];
if (absolute)
{
cur_delta[i] = cur_delta[i] - sLastDelta[i];
}
sLastDelta[i] = tmp;
if (cur_delta[i] > 0)
{
cur_delta[i] = llmax(cur_delta[i]-dead_zone[i], 0.f);
}
else
{
cur_delta[i] = llmin(cur_delta[i]+dead_zone[i], 0.f);
}
// we need smaller camera movements in build mode
// NOTE: this needs to remain after the deadzone calculation, otherwise
// we have issues with flycam "jumping" when the build dialog is opened/closed -Nyx
if (in_build_mode)
{
if (i == X_I || i == Y_I || i == Z_I)
{
cur_delta[i] /= BUILDMODE_FLYCAM_T_SCALE;
}
//.........这里部分代码省略.........
示例5: LLVertexBuffer
BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable)
{
LLStrider<LLVector3> verticesp;
LLStrider<LLColor4U> colorsp;
LLStrider<LLVector2> texcoordsp;
if (mStarsVerts.isNull())
{
mStarsVerts = new LLVertexBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK, GL_DYNAMIC_DRAW);
mStarsVerts->allocateBuffer(getStarsNumVerts()*6, 0, TRUE);
}
BOOL success = mStarsVerts->getVertexStrider(verticesp)
&& mStarsVerts->getColorStrider(colorsp)
&& mStarsVerts->getTexCoord0Strider(texcoordsp);
if(!success)
{
llerrs << "Failed updating star geometry." << llendl;
}
// *TODO: fix LLStrider with a real prefix increment operator so it can be
// used as a model of OutputIterator. -Brad
// std::copy(mStarVertices.begin(), mStarVertices.end(), verticesp);
if (mStarVertices.size() < getStarsNumVerts())
{
llerrs << "Star reference geometry insufficient." << llendl;
}
for (U32 vtx = 0; vtx < getStarsNumVerts(); ++vtx)
{
LLVector3 at = mStarVertices[vtx];
at.normVec();
LLVector3 left = at%LLVector3(0,0,1);
LLVector3 up = at%left;
F32 sc = 0.5f+ll_frand()*1.25f;
left *= sc;
up *= sc;
*(verticesp++) = mStarVertices[vtx];
*(verticesp++) = mStarVertices[vtx]+left;
*(verticesp++) = mStarVertices[vtx]+left+up;
*(verticesp++) = mStarVertices[vtx]+left;
*(verticesp++) = mStarVertices[vtx]+left+up;
*(verticesp++) = mStarVertices[vtx]+up;
*(texcoordsp++) = LLVector2(0,0);
*(texcoordsp++) = LLVector2(0,1);
*(texcoordsp++) = LLVector2(1,1);
*(texcoordsp++) = LLVector2(0,1);
*(texcoordsp++) = LLVector2(1,1);
*(texcoordsp++) = LLVector2(1,0);
*(colorsp++) = LLColor4U(mStarColors[vtx]);
*(colorsp++) = LLColor4U(mStarColors[vtx]);
*(colorsp++) = LLColor4U(mStarColors[vtx]);
*(colorsp++) = LLColor4U(mStarColors[vtx]);
*(colorsp++) = LLColor4U(mStarColors[vtx]);
*(colorsp++) = LLColor4U(mStarColors[vtx]);
}
mStarsVerts->flush();
return TRUE;
}
示例6: llmax
BOOL LLHUDNameTag::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a& intersection, BOOL debug_render)
{
if (!mVisible || mHidden)
{
return FALSE;
}
// don't pick text that isn't bound to a viewerobject
if (!mSourceObject || mSourceObject->mDrawable.isNull())
{
return FALSE;
}
F32 alpha_factor = 1.f;
LLColor4 text_color = mColor;
if (mDoFade)
{
if (mLastDistance > mFadeDistance)
{
alpha_factor = llmax(0.f, 1.f - (mLastDistance - mFadeDistance)/mFadeRange);
text_color.mV[3] = text_color.mV[3]*alpha_factor;
}
}
if (text_color.mV[3] < 0.01f)
{
return FALSE;
}
mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
LLVector3 position = mPositionAgent;
if (mSourceObject)
{ //get intersection of eye through mPositionAgent to plane of source object
//using this position keeps the camera from focusing on some seemingly random
//point several meters in front of the nametag
const LLVector3& p = mSourceObject->getPositionAgent();
const LLVector3& n = LLViewerCamera::getInstance()->getAtAxis();
const LLVector3& eye = LLViewerCamera::getInstance()->getOrigin();
LLVector3 ray = position-eye;
ray.normalize();
LLVector3 delta = p-position;
F32 dist = delta*n;
F32 dt = dist/(ray*n);
position += ray*dt;
}
// scale screen size of borders down
LLVector3 x_pixel_vec;
LLVector3 y_pixel_vec;
LLViewerCamera::getInstance()->getPixelVectors(position, y_pixel_vec, x_pixel_vec);
LLVector3 width_vec = mWidth * x_pixel_vec;
LLVector3 height_vec = mHeight * y_pixel_vec;
LLCoordGL screen_pos;
LLViewerCamera::getInstance()->projectPosAgentToScreen(position, screen_pos, FALSE);
LLVector2 screen_offset;
screen_offset = updateScreenPos(mPositionOffset);
LLVector3 render_position = position
+ (x_pixel_vec * screen_offset.mV[VX])
+ (y_pixel_vec * screen_offset.mV[VY]);
LLVector3 bg_pos = render_position
+ (F32)mOffsetY * y_pixel_vec
- (width_vec / 2.f)
- (height_vec);
LLVector3 v[] =
{
bg_pos,
bg_pos + width_vec,
bg_pos + width_vec + height_vec,
bg_pos + height_vec,
};
LLVector4a dir;
dir.setSub(end,start);
F32 a, b, t;
LLVector4a v0,v1,v2,v3;
v0.load3(v[0].mV);
v1.load3(v[1].mV);
v2.load3(v[2].mV);
v3.load3(v[3].mV);
if (LLTriangleRayIntersect(v0, v1, v2, start, dir, a, b, t) ||
LLTriangleRayIntersect(v2, v3, v0, start, dir, a, b, t) )
{
if (t <= 1.f)
{
dir.mul(t);
intersection.setAdd(start, dir);
//.........这里部分代码省略.........
示例7: part_pos_agent
void LLVOPartGroup::getGeometry(S32 idx,
LLStrider<LLVector3>& verticesp,
LLStrider<LLVector3>& normalsp,
LLStrider<LLVector2>& texcoordsp,
LLStrider<LLColor4U>& colorsp,
LLStrider<U16>& indicesp)
{
if (idx >= (S32) mViewerPartGroupp->mParticles.size())
{
return;
}
const LLViewerPart &part = *((LLViewerPart*) (mViewerPartGroupp->mParticles[idx]));
U32 vert_offset = mDrawable->getFace(idx)->getGeomIndex();
LLVector3 part_pos_agent(part.mPosAgent);
LLVector3 camera_agent = getCameraPosition();
LLVector3 at = part_pos_agent - camera_agent;
LLVector3 up;
LLVector3 right;
right = at % LLVector3(0.f, 0.f, 1.f);
right.normalize();
up = right % at;
up.normalize();
if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK)
{
LLVector3 normvel = part.mVelocity;
normvel.normalize();
LLVector2 up_fracs;
up_fracs.mV[0] = normvel*right;
up_fracs.mV[1] = normvel*up;
up_fracs.normalize();
LLVector3 new_up;
LLVector3 new_right;
new_up = up_fracs.mV[0] * right + up_fracs.mV[1]*up;
new_right = up_fracs.mV[1] * right - up_fracs.mV[0]*up;
up = new_up;
right = new_right;
up.normalize();
right.normalize();
}
right *= 0.5f*part.mScale.mV[0];
up *= 0.5f*part.mScale.mV[1];
LLVector3 normal = -LLViewerCamera::getInstance()->getXAxis();
*verticesp++ = part_pos_agent + up - right;
*verticesp++ = part_pos_agent - up - right;
*verticesp++ = part_pos_agent + up + right;
*verticesp++ = part_pos_agent - up + right;
*colorsp++ = part.mColor;
*colorsp++ = part.mColor;
*colorsp++ = part.mColor;
*colorsp++ = part.mColor;
*texcoordsp++ = LLVector2(0.f, 1.f);
*texcoordsp++ = LLVector2(0.f, 0.f);
*texcoordsp++ = LLVector2(1.f, 1.f);
*texcoordsp++ = LLVector2(1.f, 0.f);
*normalsp++ = normal;
*normalsp++ = normal;
*normalsp++ = normal;
*normalsp++ = normal;
*indicesp++ = vert_offset + 0;
*indicesp++ = vert_offset + 1;
*indicesp++ = vert_offset + 2;
*indicesp++ = vert_offset + 1;
*indicesp++ = vert_offset + 3;
*indicesp++ = vert_offset + 2;
}
示例8: getTargetMediaImpl
//.........这里部分代码省略.........
// <FS:ND> VWR-29449; If this is a HUD always set it visible, but hide each control if user has no perms.
// When setting it invisible it won't receive any mouse messages anymore, thus eg trying to sroll a webpage with mousewheel has surprising effects.
// setVisible(enabled);
if( !is_hud )
setVisible(enabled);
else
{
if( !hasPermsControl )
{
mBackCtrl->setVisible(false);
mFwdCtrl->setVisible(false);
mReloadCtrl->setVisible(false);
mStopCtrl->setVisible(false);
mHomeCtrl->setVisible(false);
mZoomCtrl->setVisible(false);
mUnzoomCtrl->setVisible(false);
mOpenCtrl->setVisible(false);
mMediaAddressCtrl->setVisible(false);
mMediaPlaySliderPanel->setVisible(false);
mVolumeCtrl->setVisible(false);
mMediaProgressPanel->setVisible(false);
mVolumeSliderCtrl->setVisible(false);
}
setVisible(true);
}
// </FS:ND>
//
// Calculate position and shape of the controls
//
std::vector<LLVector3>::iterator vert_it;
std::vector<LLVector3>::iterator vert_end;
std::vector<LLVector3> vect_face;
LLVolume* volume = objectp->getVolume();
if (volume)
{
const LLVolumeFace& vf = volume->getVolumeFace(mTargetObjectFace);
LLVector3 ext[2];
ext[0].set(vf.mExtents[0].getF32ptr());
ext[1].set(vf.mExtents[1].getF32ptr());
LLVector3 center = (ext[0]+ext[1])*0.5f;
LLVector3 size = (ext[1]-ext[0])*0.5f;
LLVector3 vert[] =
{
center + size.scaledVec(LLVector3(1,1,1)),
center + size.scaledVec(LLVector3(-1,1,1)),
center + size.scaledVec(LLVector3(1,-1,1)),
center + size.scaledVec(LLVector3(-1,-1,1)),
center + size.scaledVec(LLVector3(1,1,-1)),
center + size.scaledVec(LLVector3(-1,1,-1)),
center + size.scaledVec(LLVector3(1,-1,-1)),
center + size.scaledVec(LLVector3(-1,-1,-1)),
};
LLVOVolume* vo = (LLVOVolume*) objectp;
for (U32 i = 0; i < 8; i++)
{
vect_face.push_back(vo->volumePositionToAgent(vert[i]));
示例9: childSetCommitCallback
//.........这里部分代码省略.........
mMotionID.setNull();
mAnimPreview = NULL;
}
// </edit>
}
}
// <edit>
else if(exten == "anim" || exten == "animatn" || exten == "neil")
{
S32 file_size;
LLAPRFile raw_animatn;
raw_animatn.open(mFilenameAndPath, LL_APR_RB, LLAPRFile::global, &file_size);
if (!raw_animatn.getFileHandle())
{
llwarns << "Can't open animatn file:" << mFilename << llendl;
}
else
{
char* file_buffer;
file_buffer = new char[file_size + 1];
if (file_size == raw_animatn.read(file_buffer, file_size))
{
file_buffer[file_size] = '\0';
llinfos << "Loading animatn file " << mFilename << llendl;
mTransactionID.generate();
mMotionID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());
mAnimPreview = new LLPreviewAnimation(256, 256);
motionp = (LLKeyframeMotion*)mAnimPreview->getDummyAvatar()->createMotion(mMotionID);
LLDataPackerBinaryBuffer dp((U8*)file_buffer, file_size);
dp.reset();
success = motionp && motionp->deserialize(dp);
}
raw_animatn.close();
delete[] file_buffer;
}
}
// </edit>
if (success)
{
setAnimCallbacks() ;
if (!mInWorld)
{
const LLBBoxLocal &pelvis_bbox = motionp->getPelvisBBox();
LLVector3 temp = pelvis_bbox.getCenter();
// only consider XY?
//temp.mV[VZ] = 0.f;
F32 pelvis_offset = temp.magVec();
temp = pelvis_bbox.getExtent();
//temp.mV[VZ] = 0.f;
F32 pelvis_max_displacement = pelvis_offset + (temp.magVec() * 0.5f) + 1.f;
F32 camera_zoom = LLViewerCamera::getInstance()->getDefaultFOV() / (2.f * atan(pelvis_max_displacement / PREVIEW_CAMERA_DISTANCE));
mAnimPreview->setZoom(camera_zoom);
}
motionp->setName(childGetValue("name_form").asString());
if (!mInWorld)
{
mAnimPreview->getDummyAvatar()->startMotion(mMotionID);
}
childSetMinValue("playback_slider", 0.0);
childSetMaxValue("playback_slider", 1.0);
childSetValue("loop_check", LLSD(motionp->getLoop()));
childSetValue("loop_in_point", LLSD(motionp->getLoopIn() / motionp->getDuration() * 100.f));
childSetValue("loop_out_point", LLSD(motionp->getLoopOut() / motionp->getDuration() * 100.f));
childSetValue("priority", LLSD((F32)motionp->getPriority()));
childSetValue("hand_pose_combo", LLHandMotion::getHandPoseName(motionp->getHandPose()));
childSetValue("ease_in_time", LLSD(motionp->getEaseInDuration()));
childSetValue("ease_out_time", LLSD(motionp->getEaseOutDuration()));
setEnabled(TRUE);
std::string seconds_string;
seconds_string = llformat(" - %.2f seconds", motionp->getDuration());
setTitle(mFilename + std::string(seconds_string));
}
else
{
delete mAnimPreview;
mAnimPreview = NULL;
mMotionID.setNull();
childSetValue("bad_animation_text", getString("failed_to_initialize"));
}
refresh();
delete loaderp;
return TRUE;
}
示例10:
template <> LLSD convert_to_llsd<LLVector3>(const LLVector3& in)
{
return in.getValue();
}
示例11: gluUnProject
//static
void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, BOOL ortho, BOOL zflip, BOOL no_hacks)
{
GLint* viewport = (GLint*) gGLViewport;
GLdouble* model = gGLModelView;
GLdouble* proj = gGLProjection;
GLdouble objX,objY,objZ;
LLVector3 frust[8];
if (no_hacks)
{
gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
frust[4].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0]+viewport[2],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
frust[5].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
frust[6].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
frust[7].setVec((F32)objX,(F32)objY,(F32)objZ);
}
else if (zflip)
{
gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
frust[4].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
frust[5].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0]+viewport[2],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
frust[6].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
frust[7].setVec((F32)objX,(F32)objY,(F32)objZ);
for (U32 i = 0; i < 4; i++)
{
frust[i+4] = frust[i+4]-frust[i];
frust[i+4].normVec();
frust[i+4] = frust[i] + frust[i+4]*camera.getFar();
}
}
else
{
gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
if (ortho)
{
LLVector3 far_shift = camera.getAtAxis()*camera.getFar()*2.f;
for (U32 i = 0; i < 4; i++)
{
frust[i+4] = frust[i] + far_shift;
}
}
else
{
for (U32 i = 0; i < 4; i++)
{
LLVector3 vec = frust[i] - camera.getOrigin();
vec.normVec();
frust[i+4] = camera.getOrigin() + vec*camera.getFar();
}
}
}
camera.calcAgentFrustumPlanes(frust);
}
示例12: getChildView
//.........这里部分代码省略.........
break;
case TYPE_F32:
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("value")); // Debug, don't translate
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(sd);
}
break;
case TYPE_BOOLEAN:
bool_ctrl->setVisible(true);
if (!bool_ctrl->hasFocus())
{
if (sd.asBoolean())
{
bool_ctrl->setValue(LLSD("TRUE"));
}
else
{
bool_ctrl->setValue(LLSD("FALSE"));
}
}
break;
case TYPE_STRING:
getChildView("val_text")->setVisible( TRUE);
if (!getChild<LLUICtrl>("val_text")->hasFocus())
{
getChild<LLUICtrl>("val_text")->setValue(sd);
}
break;
case TYPE_VEC3:
{
LLVector3 v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(std::string("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_VEC3D:
{
LLVector3d v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Y"));
示例13: onCommitSettings
void LLFloaterSettingsDebug::onCommitSettings()
{
if (!mCurrentControlVariable)
return;
LLVector3 vector;
LLVector3d vectord;
LLRect rect;
LLColor4 col4;
LLColor3 col3;
LLColor4U col4U;
LLColor4 color_with_alpha;
switch(mCurrentControlVariable->type())
{
case TYPE_U32:
mCurrentControlVariable->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
break;
case TYPE_S32:
mCurrentControlVariable->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
break;
case TYPE_F32:
mCurrentControlVariable->set(LLSD(getChild<LLUICtrl>("val_spinner_1")->getValue().asReal()));
break;
case TYPE_BOOLEAN:
mCurrentControlVariable->set(getChild<LLUICtrl>("boolean_combo")->getValue());
break;
case TYPE_STRING:
mCurrentControlVariable->set(LLSD(getChild<LLUICtrl>("val_text")->getValue().asString()));
break;
case TYPE_VEC3:
vector.mV[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
vector.mV[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
vector.mV[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
mCurrentControlVariable->set(vector.getValue());
break;
case TYPE_VEC3D:
vectord.mdV[VX] = getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
vectord.mdV[VY] = getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
vectord.mdV[VZ] = getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
mCurrentControlVariable->set(vectord.getValue());
break;
case TYPE_RECT:
rect.mLeft = getChild<LLUICtrl>("val_spinner_1")->getValue().asInteger();
rect.mRight = getChild<LLUICtrl>("val_spinner_2")->getValue().asInteger();
rect.mBottom = getChild<LLUICtrl>("val_spinner_3")->getValue().asInteger();
rect.mTop = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger();
mCurrentControlVariable->set(rect.getValue());
break;
case TYPE_COL4:
col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue());
col4 = LLColor4(col3, (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal());
mCurrentControlVariable->set(col4.getValue());
break;
case TYPE_COL3:
mCurrentControlVariable->set(getChild<LLUICtrl>("val_color_swatch")->getValue());
//col3.mV[VRED] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asC();
//col3.mV[VGREEN] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
//col3.mV[VBLUE] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
//mCurrentControlVariable->set(col3.getValue());
break;
case TYPE_COL4U:
col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue());
col4U.setVecScaleClamp(col3);
col4U.mV[VALPHA] = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger();
mCurrentControlVariable->set(col4U.getValue());
break;
default:
break;
}
}
示例14:
template <> eControlType get_control_type<LLVector3>(const LLVector3& in, LLSD& out)
{
out = in.getValue();
return TYPE_VEC3;
}
示例15: private_look_at
//-----------------------------------------------------------------------------
// render()
//-----------------------------------------------------------------------------
void LLHUDEffectLookAt::render()
{
static const LLCachedControl<bool> private_look_at("PrivateLookAt",false);
static const LLCachedControl<bool> show_look_at("AscentShowLookAt", false);
if (private_look_at && (gAgentAvatarp == ((LLVOAvatar*)(LLViewerObject*)mSourceObject)))
return;
if (show_look_at && mSourceObject.notNull())
{
LLGLDepthTest gls_depth(GL_TRUE,GL_FALSE);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLVector3 target = mTargetPos + ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->mHeadp->getWorldPosition();
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]);
gGL.scalef(0.3f, 0.3f, 0.3f);
gGL.begin(LLRender::LINES);
{
LLColor3 color = (*mAttentions)[mTargetType].mColor;
gGL.color3f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE]);
gGL.vertex3f(-1.f, 0.f, 0.f);
gGL.vertex3f(1.f, 0.f, 0.f);
gGL.vertex3f(0.f, -1.f, 0.f);
gGL.vertex3f(0.f, 1.f, 0.f);
gGL.vertex3f(0.f, 0.f, -1.f);
gGL.vertex3f(0.f, 0.f, 1.f);
}
gGL.end();
gGL.popMatrix();
// <edit>
const std::string text = ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->getFullname();
LLVector3 offset = gAgentCamera.getCameraPositionAgent() - target;
offset.normalize();
LLVector3 shadow_offset = offset * 0.49f;
offset *= 0.5f;
const LLFontGL* font = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF);
LLGLEnable gl_blend(GL_BLEND);
gGL.pushMatrix();
gViewerWindow->setup2DViewport();
hud_render_utf8text(text,
target + shadow_offset,
*font,
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
-0.5f * font->getWidthF32(text) + 2.0f,
-2.0f,
LLColor4::black,
FALSE);
hud_render_utf8text(text,
target + offset,
*font,
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
-0.5f * font->getWidthF32(text),
0.0f,
(*mAttentions)[mTargetType].mColor,
FALSE);
gGL.popMatrix();
// </edit>
}
}