本文整理汇总了C++中LLColor4U类的典型用法代码示例。如果您正苦于以下问题:C++ LLColor4U类的具体用法?C++ LLColor4U怎么用?C++ LLColor4U使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLColor4U类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: beamColorFromData
LLColor4U lggBeamMaps::beamColorFromData(lggBeamsColors data)
{
F32 r, g, b;
LLColor4 output;
LLColor4U toReturn;
F32 timeinc = timer.getElapsedTimeF32()*0.3f*((data.rotateSpeed+.01f)) * (360/(data.endHue-data.startHue));
S32 diference = llround(data.endHue - data.startHue);
if(diference == 360 || diference == 720)
{
//full rainbow
//liner one
hslToRgb(fmod(timeinc,1.0f), 1.0f, 0.5f, r, g, b);
}else
{
F32 variance = ((data.endHue/360.0f)-(data.startHue/360.0f))/2.0f;
hslToRgb((data.startHue/360.0f) + variance + (sinf(timeinc)*(variance)), 1.0f, 0.5f, r, g, b);
}
output.set(r, g, b);
toReturn.setVecScaleClamp(output);
return toReturn;
}
示例2: pack
BOOL LLPartData::pack(LLDataPacker &dp)
{
LLColor4U coloru;
dp.packU32(mFlags, "pdflags");
dp.packFixed(mMaxAge, "pdmaxage", FALSE, 8, 8);
coloru.setVec(mStartColor);
dp.packColor4U(coloru, "pdstartcolor");
coloru.setVec(mEndColor);
dp.packColor4U(coloru, "pdendcolor");
dp.packFixed(mStartScale.mV[0], "pdstartscalex", FALSE, 3, 5);
dp.packFixed(mStartScale.mV[1], "pdstartscaley", FALSE, 3, 5);
dp.packFixed(mEndScale.mV[0], "pdendscalex", FALSE, 3, 5);
dp.packFixed(mEndScale.mV[1], "pdendscaley", FALSE, 3, 5);
return TRUE;
}
示例3: getControl
void LLControlGroup::setColor4U(const LLString& name, const LLColor4U &val)
{
LLControlBase* control = getControl(name);
if (control && control->isType(TYPE_COL4U))
{
control->set(val.getValue());
}
else
{
CONTROL_ERRS << "Invalid LLColor4 control " << name << llendl;
}
}
示例4: getControl
void LLControlGroup::setColor4U(const std::string& name, const LLColor4U &val)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_COL4U))
{
control->set(val.getValue());
if(mChangeCallback)
mChangeCallback(name,llformat("<%f,%f,%f,%f>",val.mV[VX],val.mV[VY],val.mV[VZ],val.mV[VW]));
}
else
{
CONTROL_ERRS << "Invalid LLColor4 control " << name << llendl;
}
}
示例5: fill
// Fill the buffer with a constant color
void LLImageRaw::fill( const LLColor4U& color )
{
S32 pixels = getWidth() * getHeight();
if( 4 == getComponents() )
{
U32* data = (U32*) getData();
U32 mColor = color.asRGBA();
for( S32 i = 0; i < pixels; i++ )
data[i] = mColor;
}
else
if( 3 == getComponents() )
{
U8* data = getData();
for( S32 i = 0; i < pixels; i++ )
{
data[0] = color.mV[0];
data[1] = color.mV[1];
data[2] = color.mV[2];
data += 3;
}
}
}
示例6: childSetVisible
//.........这里部分代码省略.........
spinner3->setLabel(std::string("Bottom"));
spinner4->setVisible(TRUE);
spinner4->setLabel(std::string("Top"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(0);
spinner1->setValue(r.mLeft);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(0);
spinner2->setValue(r.mRight);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(0);
spinner3->setValue(r.mBottom);
}
if (!spinner4->hasFocus())
{
spinner4->setPrecision(0);
spinner4->setValue(r.mTop);
}
spinner1->setMinValue((F32)S32_MIN);
spinner1->setMaxValue((F32)S32_MAX);
spinner1->setIncrement(1.f);
spinner2->setMinValue((F32)S32_MIN);
spinner2->setMaxValue((F32)S32_MAX);
spinner2->setIncrement(1.f);
spinner3->setMinValue((F32)S32_MIN);
spinner3->setMaxValue((F32)S32_MAX);
spinner3->setIncrement(1.f);
spinner4->setMinValue((F32)S32_MIN);
spinner4->setMaxValue((F32)S32_MAX);
spinner4->setIncrement(1.f);
break;
}
case TYPE_COL4:
{
LLColor4 clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
// only set if changed so color picker doesn't update
if(clr != LLColor4(color_swatch->getValue()))
{
color_swatch->set(LLColor4(sd), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
spinner4->setLabel(std::string("Alpha"));
if (!spinner4->hasFocus())
{
spinner4->setPrecision(3);
spinner4->setMinValue(0.0);
spinner4->setMaxValue(1.f);
spinner4->setValue(clr.mV[VALPHA]);
}
break;
}
case TYPE_COL3:
{
LLColor3 clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
color_swatch->setValue(sd);
break;
}
case TYPE_COL4U:
{
LLColor4U clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
if(LLColor4(clr) != LLColor4(color_swatch->getValue()))
{
color_swatch->set(LLColor4(clr), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
spinner4->setLabel(std::string("Alpha"));
if(!spinner4->hasFocus())
{
spinner4->setPrecision(0);
spinner4->setValue(clr.mV[VALPHA]);
}
spinner4->setMinValue(0);
spinner4->setMaxValue(255);
spinner4->setIncrement(1.f);
break;
}
default:
mComment->setText(std::string("unknown"));
break;
}
}
}
示例7: float_color
void LLVOClouds::getGeometry(S32 idx,
LLStrider<LLVector4a>& verticesp,
LLStrider<LLVector3>& normalsp,
LLStrider<LLVector2>& texcoordsp,
LLStrider<LLColor4U>& colorsp,
LLStrider<U16>& indicesp)
{
if (idx >= mCloudGroupp->getNumPuffs())
{
return;
}
LLDrawable* drawable = mDrawable;
LLFace *facep = drawable->getFace(idx);
if (!facep->hasGeometry())
{
return;
}
const LLCloudPuff &puff = mCloudGroupp->getPuff(idx);
LLColor4 float_color(LLColor3(gSky.getSunDiffuseColor() + gSky.getSunAmbientColor()),puff.getAlpha());
LLColor4U color;
color.setVec(float_color);
facep->setFaceColor(float_color);
U32 vert_offset = facep->getGeomIndex();
LLVector4a part_pos_agent;
part_pos_agent.load3(facep->mCenterLocal.mV);
LLVector4a at;
at.load3(LLViewerCamera::getInstance()->getAtAxis().mV);
LLVector4a up(0, 0, 1);
LLVector4a right;
right.setCross3(at, up);
right.normalize3fast();
up.setCross3(right, at);
up.normalize3fast();
right.mul(0.5f*CLOUD_PUFF_WIDTH);
up.mul(0.5f*CLOUD_PUFF_HEIGHT);
LLVector3 normal(0.f,0.f,-1.f);
//HACK -- the verticesp->mV[3] = 0.f here are to set the texture index to 0 (particles don't use texture batching, maybe they should)
// this works because there is actually a 4th float stored after the vertex position which is used as a texture index
// also, somebody please VECTORIZE THIS
LLVector4a ppapu;
LLVector4a ppamu;
ppapu.setAdd(part_pos_agent, up);
ppamu.setSub(part_pos_agent, up);
verticesp->setSub(ppapu, right);
(*verticesp++).getF32ptr()[3] = 0.f;
verticesp->setSub(ppamu, right);
(*verticesp++).getF32ptr()[3] = 0.f;
verticesp->setAdd(ppapu, right);
(*verticesp++).getF32ptr()[3] = 0.f;
verticesp->setAdd(ppamu, right);
(*verticesp++).getF32ptr()[3] = 0.f;
// *verticesp++ = puff_pos_agent - right + up;
// *verticesp++ = puff_pos_agent - right - up;
// *verticesp++ = puff_pos_agent + right + up;
// *verticesp++ = puff_pos_agent + right - up;
*colorsp++ = color;
*colorsp++ = color;
*colorsp++ = color;
*colorsp++ = color;
*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: normal
void LLVOClouds::getGeometry(S32 te,
LLStrider<LLVector3>& verticesp,
LLStrider<LLVector3>& normalsp,
LLStrider<LLVector2>& texcoordsp,
LLStrider<LLColor4U>& colorsp,
LLStrider<U16>& indicesp)
{
if (te >= mCloudGroupp->getNumPuffs())
{
return;
}
LLDrawable* drawable = mDrawable;
LLFace *facep = drawable->getFace(te);
if (!facep->hasGeometry())
{
return;
}
LLVector3 normal(0.f,0.f,-1.f);
const LLCloudPuff &puff = mCloudGroupp->getPuff(te);
S32 index_offset = facep->getGeomIndex();
LLColor4 float_color(LLColor3(gSky.getSunDiffuseColor() + gSky.getSunAmbientColor()),puff.getAlpha());
LLColor4U color;
color.setVec(float_color);
facep->setFaceColor(float_color);
LLVector3 up;
LLVector3 right;
LLVector3 at;
const LLVector3& puff_pos_agent = facep->mCenterLocal;
LLVector2 uvs[4];
uvs[0].setVec(0.f, 1.f);
uvs[1].setVec(0.f, 0.f);
uvs[2].setVec(1.f, 1.f);
uvs[3].setVec(1.f, 0.f);
LLVector3 vtx[4];
at = LLViewerCamera::getInstance()->getAtAxis();
right = at % LLVector3(0.f, 0.f, 1.f);
right.normVec();
up = right % at;
up.normVec();
right *= 0.5f*CLOUD_PUFF_WIDTH;
up *= 0.5f*CLOUD_PUFF_HEIGHT;;
*colorsp++ = color;
*colorsp++ = color;
*colorsp++ = color;
*colorsp++ = color;
vtx[0] = puff_pos_agent - right + up;
vtx[1] = puff_pos_agent - right - up;
vtx[2] = puff_pos_agent + right + up;
vtx[3] = puff_pos_agent + right - up;
verticesp->mV[3] = 0.f;
*verticesp++ = vtx[0];
verticesp->mV[3] = 0.f;
*verticesp++ = vtx[1];
verticesp->mV[3] = 0.f;
*verticesp++ = vtx[2];
verticesp->mV[3] = 0.f;
*verticesp++ = vtx[3];
*texcoordsp++ = uvs[0];
*texcoordsp++ = uvs[1];
*texcoordsp++ = uvs[2];
*texcoordsp++ = uvs[3];
*normalsp++ = normal;
*normalsp++ = normal;
*normalsp++ = normal;
*normalsp++ = normal;
*indicesp++ = index_offset + 0;
*indicesp++ = index_offset + 1;
*indicesp++ = index_offset + 2;
*indicesp++ = index_offset + 1;
*indicesp++ = index_offset + 3;
*indicesp++ = index_offset + 2;
}
示例9: while
// Returns number of controls loaded, so 0 if failure
U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declaration, eControlType declare_as)
{
LLString name;
LLXmlTree xml_controls;
if (!xml_controls.parseFile(filename))
{
llwarns << "Unable to open control file " << filename << llendl;
return 0;
}
LLXmlTreeNode* rootp = xml_controls.getRoot();
if (!rootp || !rootp->hasAttribute("version"))
{
llwarns << "No valid settings header found in control file " << filename << llendl;
return 0;
}
U32 item = 0;
U32 validitems = 0;
S32 version;
rootp->getAttributeS32("version", version);
// Check file version
if (version != CURRENT_VERSION)
{
llinfos << filename << " does not appear to be a version " << CURRENT_VERSION << " controls file" << llendl;
return 0;
}
LLXmlTreeNode* child_nodep = rootp->getFirstChild();
while(child_nodep)
{
name = child_nodep->getName();
BOOL declared = controlExists(name);
if (require_declaration && !declared)
{
// Declaration required, but this name not declared.
// Complain about non-empty names.
if (!name.empty())
{
//read in to end of line
llwarns << "LLControlGroup::loadFromFile() : Trying to set \"" << name << "\", setting doesn't exist." << llendl;
}
child_nodep = rootp->getNextChild();
continue;
}
// Got an item. Load it up.
item++;
// If not declared, assume it's a string
if (!declared)
{
switch(declare_as)
{
case TYPE_COL4:
declareColor4(name, LLColor4::white, "", NO_PERSIST);
break;
case TYPE_COL4U:
declareColor4U(name, LLColor4U::white, "", NO_PERSIST);
break;
case TYPE_STRING:
default:
declareString(name, LLString::null, "", NO_PERSIST);
break;
}
}
// Control name has been declared in code.
LLControlBase *control = getControl(name);
llassert(control);
mLoadedSettings.insert(name);
switch(control->mType)
{
case TYPE_F32:
{
F32 initial = 0.f;
child_nodep->getAttributeF32("value", initial);
control->set(initial);
validitems++;
}
break;
case TYPE_S32:
{
S32 initial = 0;
child_nodep->getAttributeS32("value", initial);
control->set(initial);
//.........这里部分代码省略.........
示例10: declareControl
BOOL LLControlGroup::declareColor4U(const LLString& name, const LLColor4U &initial_val, const LLString& comment, BOOL persist )
{
return declareControl(name, TYPE_COL4U, initial_val.getValue(), comment, persist);
}
示例11: childSetVisible
//.........这里部分代码省略.........
spinner3->setLabel(std::string("Bottom"));
spinner4->setVisible(TRUE);
spinner4->setLabel(std::string("Top"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(0);
spinner1->setValue(r.mLeft);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(0);
spinner2->setValue(r.mRight);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(0);
spinner3->setValue(r.mBottom);
}
if (!spinner4->hasFocus())
{
spinner4->setPrecision(0);
spinner4->setValue(r.mTop);
}
spinner1->setMinValue((F32)S32_MIN);
spinner1->setMaxValue((F32)S32_MAX);
spinner1->setIncrement(1.f);
spinner2->setMinValue((F32)S32_MIN);
spinner2->setMaxValue((F32)S32_MAX);
spinner2->setIncrement(1.f);
spinner3->setMinValue((F32)S32_MIN);
spinner3->setMaxValue((F32)S32_MAX);
spinner3->setIncrement(1.f);
spinner4->setMinValue((F32)S32_MIN);
spinner4->setMaxValue((F32)S32_MAX);
spinner4->setIncrement(1.f);
break;
}
case TYPE_COL4:
{
LLColor4 clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
// only set if changed so color picker doesn't update
if(clr != LLColor4(color_swatch->getValue()))
{
color_swatch->set(LLColor4(sd), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
spinner4->setLabel(std::string("Alpha"));
if (!spinner4->hasFocus())
{
spinner4->setPrecision(3);
spinner4->setMinValue(0.0);
spinner4->setMaxValue(1.f);
spinner4->setValue(clr.mV[VALPHA]);
}
break;
}
case TYPE_COL3:
{
LLColor3 clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
color_swatch->setValue(sd);
break;
}
case TYPE_COL4U:
{
LLColor4U clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
if(LLColor4(clr) != LLColor4(color_swatch->getValue()))
{
color_swatch->set(LLColor4(clr), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
spinner4->setLabel(std::string("Alpha"));
if(!spinner4->hasFocus())
{
spinner4->setPrecision(0);
spinner4->setValue(clr.mV[VALPHA]);
}
spinner4->setMinValue(0);
spinner4->setMaxValue(255);
spinner4->setIncrement(1.f);
break;
}
default:
mComment->setText(std::string("unknown"));
break;
}
}
}
示例12:
template <> eControlType get_control_type<LLColor4U>(const LLColor4U& in, LLSD& out)
{
out = in.getValue();
return TYPE_COL4U;
}
示例13: getChildView
//.........这里部分代码省略.........
spinner3->setLabel(std::string("Bottom"));
spinner4->setVisible(TRUE);
spinner4->setLabel(std::string("Top"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(0);
spinner1->setValue(r.mLeft);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(0);
spinner2->setValue(r.mRight);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(0);
spinner3->setValue(r.mBottom);
}
if (!spinner4->hasFocus())
{
spinner4->setPrecision(0);
spinner4->setValue(r.mTop);
}
spinner1->setMinValue((F32)S32_MIN);
spinner1->setMaxValue((F32)S32_MAX);
spinner1->setIncrement(1.f);
spinner2->setMinValue((F32)S32_MIN);
spinner2->setMaxValue((F32)S32_MAX);
spinner2->setIncrement(1.f);
spinner3->setMinValue((F32)S32_MIN);
spinner3->setMaxValue((F32)S32_MAX);
spinner3->setIncrement(1.f);
spinner4->setMinValue((F32)S32_MIN);
spinner4->setMaxValue((F32)S32_MAX);
spinner4->setIncrement(1.f);
break;
}
case TYPE_COL4:
{
LLColor4 clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
// only set if changed so color picker doesn't update
if(clr != LLColor4(color_swatch->getValue()))
{
color_swatch->set(LLColor4(sd), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
spinner4->setLabel(std::string("Alpha"));
if (!spinner4->hasFocus())
{
spinner4->setPrecision(3);
spinner4->setMinValue(0.0);
spinner4->setMaxValue(1.f);
spinner4->setValue(clr.mV[VALPHA]);
}
break;
}
case TYPE_COL3:
{
LLColor3 clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
color_swatch->setValue(sd);
break;
}
case TYPE_COL4U:
{
LLColor4U clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
if(LLColor4(clr) != LLColor4(color_swatch->getValue()))
{
color_swatch->set(LLColor4(clr), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
spinner4->setLabel(std::string("Alpha"));
if(!spinner4->hasFocus())
{
spinner4->setPrecision(0);
spinner4->setValue(clr.mV[VALPHA]);
}
spinner4->setMinValue(0);
spinner4->setMaxValue(255);
spinner4->setIncrement(1.f);
break;
}
default:
mComment->setText(std::string("unknown"));
break;
}
}
}