FCDGeometryInstance* FCDPhysicsShape::CreateGeometryInstance(FCDGeometry* geom, bool createConvexMesh) { analGeom = NULL; SAFE_RELEASE(geometry); geometry = (FCDGeometryInstance*)FCDEntityInstanceFactory::CreateInstance(GetDocument(), NULL, FCDEntity::GEOMETRY); if (createConvexMesh) { FCDGeometry* convexHullGeom = GetDocument()->GetGeometryLibrary()->AddEntity(); fm::string convexId = geom->GetDaeId()+"-convex"; convexHullGeom->SetDaeId(convexId); convexHullGeom->SetName(FUStringConversion::ToFString(convexId)); FCDGeometryMesh* convexHullGeomMesh = convexHullGeom->CreateMesh(); convexHullGeomMesh->SetConvexHullOf(geom); convexHullGeomMesh->SetConvex(true); geometry->SetEntity(convexHullGeom); } else { geometry->SetEntity(geom); } SetNewChildFlag(); return geometry; }
// Adds a new shader to the pass. FCDEffectPassShader* FCDEffectPass::AddShader() { FCDEffectPassShader* shader = new FCDEffectPassShader(GetDocument(), this); shaders.push_back(shader); SetNewChildFlag(); return shader; }
void FCDPhysicsShape::SetPhysicsMaterial(FCDPhysicsMaterial* _physicsMaterial) { if (ownsPhysicsMaterial) SAFE_RELEASE(physicsMaterial); ownsPhysicsMaterial = false; physicsMaterial = _physicsMaterial; SetNewChildFlag(); }
FCDEffectParameterAnnotation* FCDEffectParameter::AddAnnotation() { FCDEffectParameterAnnotation* annotation = new FCDEffectParameterAnnotation(); annotations.push_back(annotation); SetNewChildFlag(); return annotation; }
FCDENode* FCDENode::AddChildNode() { FCDENode* node = new FCDENode(GetDocument(), this); children.push_back(node); SetNewChildFlag(); return node; }
// Adds a new code inclusion to this effect profile. FCDEffectCode* FCDEffectTechnique::AddCode() { FCDEffectCode* code = new FCDEffectCode(GetDocument()); codes.push_back(code); SetNewChildFlag(); return code; }
FCDAnimationCurve* FCDAnimationChannel::AddCurve() { FCDAnimationCurve* curve = new FCDAnimationCurve(GetDocument(), this); curves.push_back(curve); SetNewChildFlag(); return curve; }
FCDPhysicsAnalyticalGeometry* FCDPhysicsShape::CreateAnalyticalGeometry(FCDPhysicsAnalyticalGeometry::GeomType type) { SAFE_RELEASE(geometry); analGeom = FCDPASFactory::CreatePAS(GetDocument(), type); SetNewChildFlag(); return analGeom; }
FCDEffectParameter* FCDEffectTechnique::AddEffectParameter(uint32 type) { FCDEffectParameter* parameter = FCDEffectParameterFactory::Create(GetDocument(), type); parameters.push_back(parameter); SetNewChildFlag(); return parameter; }
// Adds a new pass to this effect technique. FCDEffectPass* FCDEffectTechnique::AddPass() { FCDEffectPass* pass = new FCDEffectPass(GetDocument(), this); passes.push_back(pass); SetNewChildFlag(); return passes.back(); }
// Sets the type of this controller to a morph controller. FCDMorphController* FCDController::CreateMorphController() { skinController = NULL; morphController = new FCDMorphController(GetDocument(), this); SetNewChildFlag(); return morphController; }
FCDMaterialInstance* FCDGeometryInstance::AddMaterialInstance() { FCDMaterialInstance* instance = new FCDMaterialInstance(GetDocument(), this); materials.push_back(instance); SetNewChildFlag(); return instance; }
void FCDEffectParameter::AddAnnotation(const fchar* name, FCDEffectParameter::Type type, const fchar* value) { FCDEffectParameterAnnotation* annotation = AddAnnotation(); annotation->name = name; annotation->type = type; annotation->value = value; SetNewChildFlag(); }
FCDENode* FCDENode::AddChildNode(const char* name) { FCDENode* node = new FCDENode(GetDocument(), this); children.push_back(node); node->SetName(name); SetNewChildFlag(); return node; }
FCDENode* FCDENode::AddParameter(const char* name, const fchar* value) { FCDENode* parameter = AddChildNode(); parameter->SetName(name); parameter->SetContent(value); SetNewChildFlag(); return parameter; }
FCDPhysicsMaterial* FCDPhysicsShape::AddOwnPhysicsMaterial() { if (ownsPhysicsMaterial) SAFE_RELEASE(physicsMaterial); physicsMaterial = new FCDPhysicsMaterial(GetDocument()); ownsPhysicsMaterial = true; SetNewChildFlag(); return physicsMaterial; }
FCDTransform* FCDPhysicsShape::AddTransform(FCDTransform::Type type, size_t index) { FCDTransform* transform = FCDTFactory::CreateTransform(GetDocument(), NULL, type); if (transform != NULL) { if (index > transforms.size()) transforms.push_back(transform); else transforms.insert(transforms.begin() + index, transform); } SetNewChildFlag(); return transform; }
// Adds a technique of the given profile (or return the existing technique with this profile). FCDETechnique* FCDEType::AddTechnique(const char* profile) { FCDETechnique* technique = FindTechnique(profile); if (technique == NULL) { technique = new FCDETechnique(GetDocument(), this, profile); techniques.push_back(technique); SetNewChildFlag(); } return technique; }
// Adds a type of the given name (or return the existing type with this name). FCDEType* FCDExtra::AddType(const char* name) { FCDEType* type = FindType(name); if (type == NULL) { type = new FCDEType(GetDocument(), this, emptyCharString); types.push_back(type); type->SetName(name); SetNewChildFlag(); } return type; }
// Flattening: overwrite the target parameter with this parameter void FCDEffectParameterSampler::Overwrite(FCDEffectParameter* target) { if (target->GetType() == SAMPLER) { FCDEffectParameterSampler* s = (FCDEffectParameterSampler*) target; if (samplerType == s->samplerType) { s->surface = surface; SetNewChildFlag(); } } }
// Adds a new vertex shader to the pass. // If a vertex shader already exists within the pass, it will be released. FCDEffectPassShader* FCDEffectPass::AddVertexShader() { FCDEffectPassShader* vertexShader; for (vertexShader = GetVertexShader(); vertexShader != NULL; vertexShader = GetVertexShader()) { SAFE_RELEASE(vertexShader); } vertexShader = AddShader(); vertexShader->AffectsVertices(); SetNewChildFlag(); return vertexShader; }
// Adds a new fragment shader to the pass. // If a fragment shader already exists within the pass, it will be released. FCDEffectPassShader* FCDEffectPass::AddFragmentShader() { FCDEffectPassShader* fragmentShader; for (fragmentShader = GetFragmentShader(); fragmentShader != NULL; fragmentShader = GetFragmentShader()) { SAFE_RELEASE(fragmentShader); } fragmentShader = AddShader(); fragmentShader->AffectsFragments(); SetNewChildFlag(); return fragmentShader; }
// Adds a new attribute to this extra tree node. FCDEAttribute* FCDENode::AddAttribute(fm::string& _name, const fchar* _value) { CleanName(_name); FCDEAttribute* attribute = FindAttribute(_name.c_str()); if (attribute == NULL) { attribute = new FCDEAttribute(); attributes.push_back(attribute); attribute->SetName(_name); } attribute->SetValue(_value); SetNewChildFlag(); return attribute; }
// Creates a new per-vertex data source FCDGeometrySource* FCDGeometryMesh::AddVertexSource(FUDaeGeometryInput::Semantic type) { FCDGeometrySource* vertexSource = AddSource(type); vertexSources.push_back(vertexSource); // Add this new per-vertex data source to all the existing polygon groups, at offset 0. size_t polygonsCount = polygons.size(); for (size_t p = 0; p < polygonsCount; ++p) { polygons[p]->AddInput(vertexSource, 0); } SetNewChildFlag(); return vertexSource; }
FCDEffectPassState* FCDEffectPass::AddRenderState(FUDaePassState::State type) { FCDEffectPassState* state = new FCDEffectPassState(GetDocument(), type); // Ordered-insertion into the states container. size_t stateCount = states.size(); size_t insertIndex; for (insertIndex = 0; insertIndex < stateCount; ++insertIndex) { if (type < states[insertIndex]->GetType()) break; } states.insert(insertIndex, state); SetNewChildFlag(); return state; }
// Create a new effect profile. FCDEffectProfile* FCDEffect::AddProfile(FUDaeProfileType::Type type) { FCDEffectProfile* profile = NULL; // Create the correct profile for this type. if (type == FUDaeProfileType::COMMON) profile = new FCDEffectStandard(GetDocument(), this); else { profile = new FCDEffectProfileFX(GetDocument(), this); ((FCDEffectProfileFX*) profile)->SetType(type); } profiles.push_back(profile); SetNewChildFlag(); return profile; }
// Sets a new target void FCDTargetedEntity::SetTargetNode(FCDSceneNode* target) { if (targetNode != NULL) { targetNode->DecrementTargetCount(); } targetNode = target; if (targetNode != NULL) { targetNode->IncrementTargetCount(); } SetNewChildFlag(); }
// Creates a new polygon group. FCDGeometryPolygons* FCDGeometryMesh::AddPolygons() { FCDGeometryPolygons* polys = new FCDGeometryPolygons(GetDocument(), this); polygons.push_back(polys); // Add to this new polygons all the per-vertex sources. size_t vertexSourceCount = vertexSources.size(); for (size_t v = 0; v < vertexSourceCount; ++v) { polys->AddInput(vertexSources[v], 0); } SetNewChildFlag(); if (parent != NULL) parent->SetNewChildFlag(); return polys; }
void FCDEntityReference::SetPlaceHolder(FCDPlaceHolder* _placeHolder) { if (_placeHolder != placeHolder) { if (placeHolder != NULL) { placeHolder->RemoveExternalReference(this); UntrackObject(placeHolder); if (placeHolder->GetExternalReferenceCount() == 0) { SAFE_RELEASE(placeHolder); } } placeHolder = _placeHolder; if (placeHolder != NULL) { placeHolder->AddExternalReference(this); TrackObject(placeHolder); } SetNewChildFlag(); } }
void FCDEntityReference::SetEntity(FCDEntity* _entity) { // Stop tracking the old entity if (entity != NULL) UntrackObject(entity); // Track the new entity entity = _entity; if (_entity != NULL) { TrackObject(_entity); entityId = _entity->GetDaeId(); // Update the external references (this takes care of the placeHolder reference) SetEntityDocument(_entity->GetDocument()); } else { SetEntityDocument(NULL); } SetNewChildFlag(); }