void psCharAppearance::HairMesh(csString& subMesh) { hairMesh = subMesh; if ( hairMesh.Length() == 0 ) { hairMesh = "Hair"; } csString newPartParsed = ParseStrings("Hair", hairMesh); if(state && stateFactory) { int newMeshAvailable = stateFactory->FindMeshName(newPartParsed); if ( newMeshAvailable == -1 ) { return; } else { for ( int idx=0; idx < stateFactory->GetMeshCount(); idx++) { const char* meshName = stateFactory->GetMeshName(idx); if ( strstr(meshName, "Hair") ) { state->DetachCoreMesh(meshName); } } state->AttachCoreMesh(newPartParsed); hairAttached = true; hairMesh = newPartParsed; } } else if(animeshObject && animeshFactory) { for ( size_t idx=0; idx < animeshFactory->GetSubMeshCount(); idx++) { const char* meshName = animeshFactory->GetSubMesh(idx)->GetName(); if(meshName) { if (strstr(meshName, "Hair")) { animeshObject->GetSubMesh(idx)->SetRendering(false); } if (!strcmp(meshName, newPartParsed)) { animeshObject->GetSubMesh(idx)->SetRendering(true); hairAttached = true; beardMesh = newPartParsed; } } } } if ( hairColorSet ) HairColor(hairShader); }
bool psCharAppearance::SetTrait(Trait * trait) { bool result = true; while (trait) { switch (trait->location) { case PSTRAIT_LOCATION_SKIN_TONE: { SetSkinTone(trait->mesh, trait->material); break; } case PSTRAIT_LOCATION_FACE: { FaceTexture(trait->material); break; } case PSTRAIT_LOCATION_HAIR_STYLE: { HairMesh(trait->mesh); break; } case PSTRAIT_LOCATION_BEARD_STYLE: { BeardMesh(trait->mesh); break; } case PSTRAIT_LOCATION_HAIR_COLOR: { HairColor(trait->shader); break; } case PSTRAIT_LOCATION_EYE_COLOR: { EyeColor(trait->shader); break; } default: { Error3("Trait(%d) unknown trait location %d",trait->uid,trait->location); result = false; break; } } trait = trait->next_trait; } return true; }
bool MobileDisplayInfo::IsValid() const throw() { // the commented out tests are never true due to the bit range in storage // if (BaseFigure() > 3) return false; if (SkinColor() > 2) return false; // if (FaceStyle() > 7) return false; if (HairColor() > 4) return false; // if (PilosityHairStyle() > 4) return false; if (PilosityBrowStyle() > 11) return false; return true; }
void psCharAppearance::ShowHair(bool show) { if (show) { if (hairAttached) return; if(state) { state->AttachCoreMesh(hairMesh); } else if(animeshObject && animeshFactory) { size_t idx = animeshFactory->FindSubMesh(hairMesh); if(idx != (size_t)-1) { animeshObject->GetSubMesh(idx)->SetRendering(true); } } if (hairColorSet) HairColor(hairShader); hairAttached = true; } else { if(state) { state->DetachCoreMesh(hairMesh); } else if(animeshObject && animeshFactory) { size_t idx = animeshFactory->FindSubMesh(hairMesh); if(idx != (size_t)-1) { animeshObject->GetSubMesh(idx)->SetRendering(false); } } hairAttached = false; } }