plLayer& plLayer::InitToDefault() { fState->Reset(); *fTexture = nil; SetRuntimeColor(hsColorRGBA().Set(0.5f, 0.5f, 0.5f, 1.f)); SetPreshadeColor(hsColorRGBA().Set(0.5f, 0.5f, 0.5f, 1.f)); SetAmbientColor(hsColorRGBA().Set(0,0,0,1.f)); SetOpacity(1.f); fTransform->Reset(); SetUVWSrc(0); SetLODBias(-1.f); SetSpecularColor( hsColorRGBA().Set(0,0,0,1.f)); SetSpecularPower(1.f); *fVertexShader = nil; *fPixelShader = nil; fBumpEnvXfm->Reset(); return *this; }
void plPipelineViewSettings::MakeOcclusionSnap() { hsTArray<hsPoint3>& pos = fCullTree.GetCaptureVerts(); hsTArray<hsVector3>& norm = fCullTree.GetCaptureNorms(); hsTArray<hsColorRGBA>& color = fCullTree.GetCaptureColors(); hsTArray<uint16_t>& tris = fCullTree.GetCaptureTris(); if (tris.GetCount()) { hsMatrix44 ident; ident.Reset(); hsGMaterial* mat = new hsGMaterial(); hsgResMgr::ResMgr()->NewKey("OcclusionSnapMat", mat, plLocation::kGlobalFixedLoc); plLayer *lay = mat->MakeBaseLayer(); lay->SetZFlags(hsGMatState::kZNoZWrite); lay->SetPreshadeColor(hsColorRGBA().Set(1.f, 0.5f, 0.5f, 1.f)); lay->SetRuntimeColor(hsColorRGBA().Set(1.f, 0.5f, 0.5f, 1.f)); lay->SetAmbientColor(hsColorRGBA().Set(0,0,0,1.f)); lay->SetOpacity(0.5f); lay->SetBlendFlags(lay->GetBlendFlags() | hsGMatState::kBlendAlpha); fCullProxy = plDrawableGenerator::GenerateDrawable(pos.GetCount(), pos.AcquireArray(), norm.AcquireArray(), nullptr, 0, color.AcquireArray(), true, nullptr, tris.GetCount(), tris.AcquireArray(), mat, ident, true, nullptr, nullptr); if (fCullProxy) { fCullProxy->GetKey()->RefObject(); fCullProxy->SetType(plDrawable::kOccSnapProxy); fDrawableTypeMask |= plDrawable::kOccSnapProxy; fCullProxy->PrepForRender(fPipeline); } } fCullTree.ReleaseCapture(); }
plLayerDepth::plLayerDepth() { SetZFlags(hsGMatState::kZNoZRead | hsGMatState::kZNoZWrite); SetBlendFlags(hsGMatState::kBlendAdd); SetMiscFlags(hsGMatState::kMiscRestartPassHere | hsGMatState::kMiscTroubledLoner); SetPreshadeColor(hsColorRGBA().Set(0,0,0,1.f)); SetRuntimeColor(hsColorRGBA().Set(0,0,0,1.f)); SetAmbientColor(hsColorRGBA().Set(0.1f, 0.1f, 0.1f, 1.f)); SetOpacity(1.f); *fTexture = nil; }
virtual void OnShow( void ) { fDescTextBox = pfGUITextBoxMod::ConvertNoRef( fDialog->GetControlFromTag( kKIStaticText ) ); fDescTextBox->SetText( "" ); fRadio = pfGUIRadioGroupCtrl::ConvertNoRef( fDialog->GetControlFromTag( kPBSaveSlotRadio ) ); fRadio->SetValue( 0 ); pfGUIDynDisplayCtrl *disp = pfGUIDynDisplayCtrl::ConvertNoRef( fDialog->GetControlFromTag( kPBSaveSlotPrev1 ) ); plDynamicTextMap *map = disp->GetMap( 0 ); map->ClearToColor( hsColorRGBA().Set( 1, 0, 0, 1 ) ); plMipmap *img = plJPEG::Instance().ReadFromFile( "e:\\plasma20\\data\\localdata\\testfile.jpg" ); if( img == nil ) return; map->DrawImage( 4, 4, img ); }
void plPXPhysical::Read(hsStream* stream, hsResMgr* mgr) { plPhysical::Read(stream, mgr); ClearMatrix(fCachedLocal2World); PhysRecipe recipe; recipe.mass = stream->ReadLEScalar(); recipe.friction = stream->ReadLEScalar(); recipe.restitution = stream->ReadLEScalar(); recipe.bounds = (plSimDefs::Bounds)stream->ReadByte(); recipe.group = (plSimDefs::Group)stream->ReadByte(); recipe.reportsOn = stream->ReadLE32(); fLOSDBs = stream->ReadLE16(); //hack for swim regions currently they are labeled as static av blockers if(fLOSDBs==plSimDefs::kLOSDBSwimRegion) { recipe.group=plSimDefs::kGroupMax; } // recipe.objectKey = mgr->ReadKey(stream); recipe.sceneNode = mgr->ReadKey(stream); recipe.worldKey = mgr->ReadKey(stream); mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPhysRefSndGroup), plRefFlags::kActiveRef); hsPoint3 pos; hsQuat rot; pos.Read(stream); rot.Read(stream); rot.MakeMatrix(&recipe.l2s); recipe.l2s.SetTranslate(&pos); fProps.Read(stream); if (recipe.bounds == plSimDefs::kSphereBounds) { recipe.radius = stream->ReadLEScalar(); recipe.offset.Read(stream); } else if (recipe.bounds == plSimDefs::kBoxBounds) { recipe.bDimensions.Read(stream); recipe.bOffset.Read(stream); } else { // Read in the cooked mesh plPXStream pxs(stream); if (recipe.bounds == plSimDefs::kHullBounds) recipe.convexMesh = plSimulationMgr::GetInstance()->GetSDK()->createConvexMesh(pxs); else recipe.triMesh = plSimulationMgr::GetInstance()->GetSDK()->createTriangleMesh(pxs); } Init(recipe); hsAssert(!fProxyGen, "Already have proxy gen, double read?"); hsColorRGBA physColor; float opac = 1.0f; if (fGroup == plSimDefs::kGroupAvatar) { // local avatar is light purple and transparent physColor.Set(.2f, .1f, .2f, 1.f); opac = 0.4f; } else if (fGroup == plSimDefs::kGroupDynamic) { // Dynamics are red physColor.Set(1.f,0.f,0.f,1.f); } else if (fGroup == plSimDefs::kGroupDetector) { if(!fWorldKey) { // Detectors are blue, and transparent physColor.Set(0.f,0.f,1.f,1.f); opac = 0.3f; } else { // subworld Detectors are green physColor.Set(0.f,1.f,0.f,1.f); opac = 0.3f; } } else if (fGroup == plSimDefs::kGroupStatic) { if (GetProperty(plSimulationInterface::kPhysAnim)) // Statics that are animated are more reddish? physColor.Set(1.f,0.6f,0.2f,1.f); else // Statics are yellow physColor.Set(1.f,0.8f,0.2f,1.f); // if in a subworld... slightly transparent if(fWorldKey) opac = 0.6f; } else { // don't knows are grey physColor.Set(0.6f,0.6f,0.6f,1.f); } fProxyGen = new plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac); fProxyGen->Init(this); }
plLayer* plLayerConverter::ICreateAttenuationLayer(const plString& name, plMaxNode *node, int uvwSrc, float tr0, float op0, float tr1, float op1, int loClamp, int hiClamp) { hsMatrix44 uvwXfm; uvwXfm.Reset(); uvwXfm.fMap[0][0] = uvwXfm.fMap[1][1] = uvwXfm.fMap[2][2] = 0; uvwXfm.NotIdentity(); if( op0 != tr0 ) { uvwXfm.fMap[0][2] = -1.f / (tr0 - op0); uvwXfm.fMap[0][3] = uvwXfm.fMap[0][2] * -tr0; } else { uvwXfm.fMap[0][3] = 1.f; } if( op1 != tr1 ) { uvwXfm.fMap[1][2] = -1.f / (tr1 - op1); uvwXfm.fMap[1][3] = uvwXfm.fMap[1][2] * -tr1; } else { uvwXfm.fMap[1][3] = 1.f; } BOOL chanAdd = false; if( op0 < tr0 ) { if( (op0 < op1) && (tr1 < op1) ) chanAdd = true; } else if( op0 > tr0 ) { if( (op0 > op1) && (tr1 > op1) ) chanAdd = true; } plBitmap* funkRamp = IGetAttenRamp(node, chanAdd, loClamp, hiClamp); plLayer* layer = new plLayer; layer->InitToDefault(); hsgResMgr::ResMgr()->NewKey(name, layer, node->GetLocation()); hsgResMgr::ResMgr()->AddViaNotify(funkRamp->GetKey(), new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); layer->SetAmbientColor(hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f)); layer->SetPreshadeColor(hsColorRGBA().Set(0, 0, 0, 1.f)); layer->SetRuntimeColor(hsColorRGBA().Set(0, 0, 0, 1.f)); layer->SetZFlags(hsGMatState::kZNoZWrite); uint32_t blendFlags = hsGMatState::kBlendAlpha | hsGMatState::kBlendNoTexColor | hsGMatState::kBlendAlphaMult; layer->SetBlendFlags(blendFlags); layer->SetClampFlags(hsGMatState::kClampTexture); layer->SetTransform(uvwXfm); layer->SetUVWSrc(uvwSrc); return layer; }
hsColorRGBA hsGColorizer::GetCurrentColor() { return fPipeline ? fPipeline->GetColorOverride().fColor : hsColorRGBA().Set(1.f,1.f,1.f,1.f); }
int16_t pyGUIControlListBox::AddTextWColorWSizeW( std::wstring str, pyColor& textcolor, uint32_t inheritalpha, int32_t fontsize) { if ( fGCkey ) { // get the pointer to the modifier pfGUIListBoxMod* plbmod = pfGUIListBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( plbmod ) { pfColorListElement *element = new pfColorListElement( str.c_str(), textcolor.getColor(),nil,hsColorRGBA(),inheritalpha, fontsize ); if( fBuildRoots.GetCount() > 0 ) fBuildRoots[ fBuildRoots.GetCount() - 1 ]->AddChild( element ); return plbmod->AddElement( element ); } } return -1; }
* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HSPlasma is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HSPlasma. If not, see <http://www.gnu.org/licenses/>. */ #include "hsColor.h" /* hsColorRGBA */ const hsColorRGBA hsColorRGBA::kBlack = hsColorRGBA(0.0f, 0.0f, 0.0f, 1.0f); const hsColorRGBA hsColorRGBA::kWhite = hsColorRGBA(1.0f, 1.0f, 1.0f, 1.0f); const hsColorRGBA hsColorRGBA::kRed = hsColorRGBA(1.0f, 0.0f, 0.0f, 1.0f); const hsColorRGBA hsColorRGBA::kGreen = hsColorRGBA(0.0f, 1.0f, 0.0f, 1.0f); const hsColorRGBA hsColorRGBA::kBlue = hsColorRGBA(0.0f, 0.0f, 1.0f, 1.0f); const hsColorRGBA hsColorRGBA::kYellow = hsColorRGBA(1.0f, 1.0f, 0.0f, 1.0f); const hsColorRGBA hsColorRGBA::kMagenta = hsColorRGBA(1.0f, 0.0f, 1.0f, 1.0f); const hsColorRGBA hsColorRGBA::kCyan = hsColorRGBA(0.0f, 1.0f, 1.0f, 1.0f); const hsColorRGBA hsColorRGBA::kGray = hsColorRGBA(0.5f, 0.5f, 0.5f, 1.0f); const hsColorRGBA hsColorRGBA::kNone = hsColorRGBA(0.0f, 0.0f, 0.0f, 0.0f); void hsColorRGBA::set(float red, float green, float blue, float alpha) { r = red; g = green; b = blue; a = alpha;
plCameraProxy::plCameraProxy() : plProxyGen(hsColorRGBA().Set(0.2f,0.2f,0.8f,1.f), hsColorRGBA().Set(1.f,0.5f,0.5f,1.f), 0.2f), fOwner(nil), node(nil) { }
plLightProxy::plLightProxy() : plProxyGen(hsColorRGBA().Set(0,0,0,1.f), hsColorRGBA().Set(0.5f,1.0,0.5f,1.f), 0.2f), fOwner(nil) { }