本文整理汇总了C++中LLVector2函数的典型用法代码示例。如果您正苦于以下问题:C++ LLVector2函数的具体用法?C++ LLVector2怎么用?C++ LLVector2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LLVector2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LLColor4
LLPartSysData::LLPartSysData()
{
mCRC = 0;
mFlags = 0;
mPartData.mFlags = 0;
mPartData.mStartColor = LLColor4(1.f, 1.f, 1.f, 1.f);
mPartData.mEndColor = LLColor4(1.f, 1.f, 1.f, 1.f);
mPartData.mStartScale = LLVector2(1.f, 1.f);
mPartData.mEndScale = LLVector2(1.f, 1.f);
mPartData.mMaxAge = 10.0;
mMaxAge = 0.0;
mStartAge = 0.0;
mPattern = LL_PART_SRC_PATTERN_DROP; // Pattern for particle velocity
mInnerAngle = 0.0; // Inner angle of PATTERN_ANGLE_*
mOuterAngle = 0.0; // Outer angle of PATTERN_ANGLE_*
mBurstRate = 0.1f; // How often to do a burst of particles
mBurstPartCount = 1; // How many particles in a burst
mBurstSpeedMin = 1.f; // Minimum particle velocity
mBurstSpeedMax = 1.f; // Maximum particle velocity
mBurstRadius = 0.f;
mNumParticles = 0;
}
示例2: 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()*4, 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]+up;
*(texcoordsp++) = LLVector2(0,0);
*(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]);
}
mStarsVerts->setBuffer(0);
return TRUE;
}
示例3: destroyGL
void LLPostProcess::initialize(unsigned int width, unsigned int height)
{
destroyGL();
mScreenWidth = width;
mScreenHeight = height;
createScreenTextures();
createNoiseTexture();
//Setup our VBO.
{
mVBO = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1,3);
mVBO->allocateBuffer(4,0,TRUE);
LLStrider<LLVector3> v;
LLStrider<LLVector2> uv1;
LLStrider<LLVector2> uv2;
mVBO->getVertexStrider(v);
mVBO->getTexCoord0Strider(uv1);
mVBO->getTexCoord1Strider(uv2);
v[0] = LLVector3( uv2[0] = uv1[0] = LLVector2(0, 0) );
v[1] = LLVector3( uv2[1] = uv1[1] = LLVector2(0, mScreenHeight) );
v[2] = LLVector3( uv2[2] = uv1[2] = LLVector2(mScreenWidth, 0) );
v[3] = LLVector3( uv2[3] = uv1[3] = LLVector2(mScreenWidth, mScreenHeight) );
mVBO->flush();
}
stop_glerror();
}
示例4: LLVertexBuffer
//static
void LLVOPartGroup::restoreGL()
{
//TODO: optimize out binormal mask here. Specular and normal coords as well.
sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2, GL_STREAM_DRAW_ARB);
U32 count = LL_MAX_PARTICLE_COUNT;
sVB->allocateBuffer(count*4, count*6, true);
//indices and texcoords are always the same, set once
LLStrider<U16> indicesp;
LLStrider<LLVector4a> verticesp;
sVB->getIndexStrider(indicesp);
sVB->getVertexStrider(verticesp);
LLVector4a v;
v.set(0,0,0,0);
U16 vert_offset = 0;
for (U32 i = 0; i < LL_MAX_PARTICLE_COUNT; i++)
{
*indicesp++ = vert_offset + 0;
*indicesp++ = vert_offset + 1;
*indicesp++ = vert_offset + 2;
*indicesp++ = vert_offset + 1;
*indicesp++ = vert_offset + 3;
*indicesp++ = vert_offset + 2;
*verticesp++ = v;
vert_offset += 4;
}
LLStrider<LLVector2> texcoordsp;
sVB->getTexCoord0Strider(texcoordsp);
for (U32 i = 0; i < LL_MAX_PARTICLE_COUNT; i++)
{
*texcoordsp++ = LLVector2(0.f, 1.f);
*texcoordsp++ = LLVector2(0.f, 0.f);
*texcoordsp++ = LLVector2(1.f, 1.f);
*texcoordsp++ = LLVector2(1.f, 0.f);
}
sVB->flush();
}
示例5: LLVertexBuffer
//static
void LLVOPartGroup::restoreGL()
{
sVB = new LLVertexBuffer(VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB);
U32 count = LL_MAX_PARTICLE_COUNT;
sVB->allocateBuffer(count*4, count*6, true);
//indices and texcoords are always the same, set once
LLStrider<U16> indicesp;
LLStrider<LLVector4a> verticesp;
sVB->getIndexStrider(indicesp);
sVB->getVertexStrider(verticesp);
LLVector4a v;
v.set(0,0,0,0);
U16 vert_offset = 0;
for (U32 i = 0; i < LL_MAX_PARTICLE_COUNT; i++)
{
*indicesp++ = vert_offset + 0;
*indicesp++ = vert_offset + 1;
*indicesp++ = vert_offset + 2;
*indicesp++ = vert_offset + 1;
*indicesp++ = vert_offset + 3;
*indicesp++ = vert_offset + 2;
*verticesp++ = v;
vert_offset += 4;
}
LLStrider<LLVector2> texcoordsp;
sVB->getTexCoord0Strider(texcoordsp);
for (U32 i = 0; i < LL_MAX_PARTICLE_COUNT; i++)
{
*texcoordsp++ = LLVector2(0.f, 1.f);
*texcoordsp++ = LLVector2(0.f, 0.f);
*texcoordsp++ = LLVector2(1.f, 1.f);
*texcoordsp++ = LLVector2(1.f, 0.f);
}
sVB->flush();
}
示例6: LLVector2
//static
LLVector2 LLUI::getWindowSize()
{
LLCoordWindow window_rect;
sWindow->getSize(&window_rect);
return LLVector2(window_rect.mX / getScaleFactor().mV[VX], window_rect.mY / getScaleFactor().mV[VY]);
}
示例7: handleRightMouseDown
BOOL lggBeamMapFloater::handleRightMouseDown(S32 x,S32 y,MASK mask)
{
std::vector<lggPoint> newDots;
for(int i = 0; i < (int)dots.size();i++)
{
if(dist_vec(LLVector2(x,y),LLVector2(dots[i].x,dots[i].y)) < 7)
{
}else
{
newDots.push_back(dots[i]);
}
}
dots = newDots;
return LLFloater::handleMouseDown(x,y,mask);
}
示例8: rand
void LLPostProcess::drawOrthoQuad(QuadType type)
{
if(type == QUAD_NOISE)
{
//This could also be done through uniforms.
LLStrider<LLVector2> uv2;
mVBO->getTexCoord1Strider(uv2);
float offs[2] = {(float) rand() / (float) RAND_MAX, (float) rand() / (float) RAND_MAX};
float scale[2] = {mScreenWidth * mNoiseTextureScale / mScreenHeight, mNoiseTextureScale};
uv2[0] = LLVector2(offs[0],offs[1]);
uv2[1] = LLVector2(offs[0],offs[1]+scale[1]);
uv2[2] = LLVector2(offs[0]+scale[0],offs[1]);
uv2[3] = LLVector2(uv2[2].mV[0],uv2[1].mV[1]);
mVBO->flush();
}
U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | (type == QUAD_NOISE ? LLVertexBuffer::MAP_TEXCOORD1 : 0);
mVBO->setBuffer(mask);
mVBO->drawArrays(LLRender::TRIANGLE_STRIP, 0, 4);
}
示例9: LLVector2
void LLFontGL::renderQuad(LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, F32 slant_amt) const
{
S32 index = 0;
vertex_out[index].set(screen_rect.mLeft, screen_rect.mTop, 0.f);
uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
colors_out[index] = color;
index++;
vertex_out[index].set(screen_rect.mLeft + slant_amt, screen_rect.mBottom, 0.f);
uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
colors_out[index] = color;
index++;
vertex_out[index].set(screen_rect.mRight, screen_rect.mTop, 0.f);
uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
colors_out[index] = color;
index++;
vertex_out[index].set(screen_rect.mRight, screen_rect.mTop, 0.f);
uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
colors_out[index] = color;
index++;
vertex_out[index].set(screen_rect.mLeft + slant_amt, screen_rect.mBottom, 0.f);
uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
colors_out[index] = color;
index++;
vertex_out[index].set(screen_rect.mRight + slant_amt, screen_rect.mBottom, 0.f);
uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom);
colors_out[index] = color;
}
示例10: getOriginAgent
LLVector2 LLSurfacePatch::getTexCoords(const U32 x, const U32 y) const
{
U32 surface_stride = mSurfacep->getGridsPerEdge();
U32 point_offset = x + y*surface_stride;
LLVector3 pos, rel_pos;
pos = getOriginAgent();
pos.mV[VX] += x * mSurfacep->getMetersPerGrid();
pos.mV[VY] += y * mSurfacep->getMetersPerGrid();
pos.mV[VZ] = *(mDataZ + point_offset);
rel_pos = pos - mSurfacep->getOriginAgent();
rel_pos *= 1.f/surface_stride;
return LLVector2(rel_pos.mV[VX], rel_pos.mV[VY]);
}
示例11: LLVector3
void LLFontGL::renderQuad(LLVector3* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, F32 slant_amt) const
{
S32 index = 0;
vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mRight), llfont_round_y(screen_rect.mTop), 0.f);
uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
colors_out[index] = color;
index++;
vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mLeft), llfont_round_y(screen_rect.mTop), 0.f);
uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
colors_out[index] = color;
index++;
vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mLeft), llfont_round_y(screen_rect.mBottom), 0.f);
uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
colors_out[index] = color;
index++;
vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mRight), llfont_round_y(screen_rect.mBottom), 0.f);
uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom);
colors_out[index] = color;
}
示例12: LLVector2
LLVector2 LLWaterParamSet::getVector2(const std::string& paramName, bool& error)
{
// test to see if right type
int ttest;
ttest = mParamValues.size();
LLSD cur_val = mParamValues.get(paramName);
if (!cur_val.isArray() || cur_val.size() != 2)
{
error = true;
return LLVector2(0,0);
}
LLVector2 val;
val.mV[0] = (F32) cur_val[0].asReal();
val.mV[1] = (F32) cur_val[1].asReal();
error = false;
return val;
}
示例13: LLVector2
/*virtual*/
void LLPullButton::onMouseLeave(S32 x, S32 y, MASK mask)
{
LLButton::onMouseLeave(x, y, mask);
if (mMouseDownTimer.getStarted()) //an user have done a mouse down, if the timer started. see LLButton::handleMouseDown for details
{
const LLVector2 cursor_direction = LLVector2(F32(x), F32(y)) - mLastMouseDown;
/* For now cursor_direction points to the direction of mouse movement
* Need to decide whether should we fire a signal.
* We fire if angle between mDraggingDirection and cursor_direction is less that 45 degree
* Note:
* 0.5 * F_PI_BY_TWO equals to PI/4 radian that equals to angle of 45 degrees
*/
if (angle_between(mDraggingDirection, cursor_direction) < 0.5 * F_PI_BY_TWO)//call if angle < pi/4
{
mClickDraggingSignal(this, LLSD());
}
}
}
示例14: llclamp
LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset)
{
LLCoordGL screen_pos;
LLVector2 screen_pos_vec;
LLVector3 x_pixel_vec;
LLVector3 y_pixel_vec;
LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec);
// if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen)
// {
// // bubble off-screen, so find a spot for it along screen edge
// LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(world_pos, screen_pos);
// }
screen_pos_vec.setVec((F32)screen_pos.mX, (F32)screen_pos.mY);
LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
S32 bottom = world_rect.mBottom + STATUS_BAR_HEIGHT;
LLVector2 screen_center;
screen_center.mV[VX] = llclamp((F32)screen_pos_vec.mV[VX], (F32)world_rect.mLeft + mWidth * 0.5f, (F32)world_rect.mRight - mWidth * 0.5f);
if(mVertAlignment == ALIGN_VERT_TOP)
{
screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY],
(F32)bottom,
(F32)world_rect.mTop - mHeight - (F32)MENU_BAR_HEIGHT);
mSoftScreenRect.setLeftTopAndSize(screen_center.mV[VX] - (mWidth + BUFFER_SIZE) * 0.5f,
screen_center.mV[VY] + (mHeight + BUFFER_SIZE), mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE);
}
else
{
screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY],
(F32)bottom + mHeight * 0.5f,
(F32)world_rect.mTop - mHeight * 0.5f - (F32)MENU_BAR_HEIGHT);
mSoftScreenRect.setCenterAndSize(screen_center.mV[VX], screen_center.mV[VY], mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE);
}
return offset + (screen_center - LLVector2((F32)screen_pos.mX, (F32)screen_pos.mY));
}
示例15: getWorldMatrix
// Returns scale compared to default texgen, and face orientation as calculated
// by planarProjection(). This is needed to match planar texgen parameters.
void LLFace::getPlanarProjectedParams(LLQuaternion* face_rot, LLVector3* face_pos, F32* scale) const
{
const LLMatrix4& vol_mat = getWorldMatrix();
const LLVolumeFace& vf = getViewerObject()->getVolume()->getVolumeFace(mTEOffset);
const LLVector4a& normal4a = vf.mNormals[0];
const LLVector4a& binormal4a = vf.mBinormals[0];
LLVector2 projected_binormal;
planarProjection(projected_binormal, normal4a, *vf.mCenter, binormal4a);
projected_binormal -= LLVector2(0.5f, 0.5f); // this normally happens in xform()
*scale = projected_binormal.length();
// rotate binormal to match what planarProjection() thinks it is,
// then find rotation from that:
projected_binormal.normalize();
F32 ang = acos(projected_binormal.mV[VY]);
ang = (projected_binormal.mV[VX] < 0.f) ? -ang : ang;
//VECTORIZE THIS
LLVector3 binormal(binormal4a.getF32ptr());
LLVector3 normal(normal4a.getF32ptr());
binormal.rotVec(ang, normal);
LLQuaternion local_rot( binormal % normal, binormal, normal );
*face_rot = local_rot * vol_mat.quaternion();
*face_pos = vol_mat.getTranslation();
}