예제 #1
0
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;
}
예제 #2
0
// Adds a new shader to the pass.
FCDEffectPassShader* FCDEffectPass::AddShader()
{
	FCDEffectPassShader* shader = new FCDEffectPassShader(GetDocument(), this);
	shaders.push_back(shader);
	SetNewChildFlag();
	return shader;
}
예제 #3
0
void FCDPhysicsShape::SetPhysicsMaterial(FCDPhysicsMaterial* _physicsMaterial)
{
	if (ownsPhysicsMaterial) SAFE_RELEASE(physicsMaterial);
	ownsPhysicsMaterial = false;
	physicsMaterial = _physicsMaterial;
	SetNewChildFlag();
}
예제 #4
0
FCDEffectParameterAnnotation* FCDEffectParameter::AddAnnotation()
{
	FCDEffectParameterAnnotation* annotation = new FCDEffectParameterAnnotation();
	annotations.push_back(annotation);
	SetNewChildFlag();
	return annotation;
}
예제 #5
0
FCDENode* FCDENode::AddChildNode()
{
	FCDENode* node = new FCDENode(GetDocument(), this);
	children.push_back(node);
	SetNewChildFlag(); 
	return node; 
}
예제 #6
0
// Adds a new code inclusion to this effect profile.
FCDEffectCode* FCDEffectTechnique::AddCode()
{
	FCDEffectCode* code = new FCDEffectCode(GetDocument());
	codes.push_back(code);
	SetNewChildFlag();
	return code;
}
예제 #7
0
FCDAnimationCurve* FCDAnimationChannel::AddCurve()
{
	FCDAnimationCurve* curve = new FCDAnimationCurve(GetDocument(), this);
	curves.push_back(curve);
	SetNewChildFlag();
	return curve;
}
예제 #8
0
FCDPhysicsAnalyticalGeometry* FCDPhysicsShape::CreateAnalyticalGeometry(FCDPhysicsAnalyticalGeometry::GeomType type)
{
	SAFE_RELEASE(geometry);
	analGeom = FCDPASFactory::CreatePAS(GetDocument(), type);
	SetNewChildFlag();
	return analGeom;
}
예제 #9
0
FCDEffectParameter* FCDEffectTechnique::AddEffectParameter(uint32 type)
{
	FCDEffectParameter* parameter = FCDEffectParameterFactory::Create(GetDocument(), type);
	parameters.push_back(parameter);
	SetNewChildFlag();
	return parameter;
}
예제 #10
0
// 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();
}
예제 #11
0
// Sets the type of this controller to a morph controller.
FCDMorphController* FCDController::CreateMorphController()
{
	skinController = NULL;
	morphController = new FCDMorphController(GetDocument(), this);
	SetNewChildFlag();
	return morphController;
}
예제 #12
0
FCDMaterialInstance* FCDGeometryInstance::AddMaterialInstance()
{
	FCDMaterialInstance* instance = new FCDMaterialInstance(GetDocument(), this);
	materials.push_back(instance);
	SetNewChildFlag();
	return instance;
}
예제 #13
0
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();
}
예제 #14
0
FCDENode* FCDENode::AddChildNode(const char* name) 
{
	FCDENode* node = new FCDENode(GetDocument(), this);
	children.push_back(node);
	node->SetName(name); 
	SetNewChildFlag();
	return node;
}
예제 #15
0
FCDENode* FCDENode::AddParameter(const char* name, const fchar* value)
{
	FCDENode* parameter = AddChildNode();
	parameter->SetName(name);
	parameter->SetContent(value);
	SetNewChildFlag();
	return parameter;
}
예제 #16
0
FCDPhysicsMaterial* FCDPhysicsShape::AddOwnPhysicsMaterial()
{
	if (ownsPhysicsMaterial) SAFE_RELEASE(physicsMaterial);

	physicsMaterial = new FCDPhysicsMaterial(GetDocument());
	ownsPhysicsMaterial = true;
	SetNewChildFlag();
	return physicsMaterial;
}
예제 #17
0
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;
}
예제 #18
0
// 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;
}
예제 #19
0
// 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();
		}
	}
}
예제 #21
0
// 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;
}
예제 #22
0
// 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;
}
예제 #23
0
// 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;
}
예제 #24
0
// 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;
}
예제 #25
0
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;
}
예제 #26
0
파일: FCDEffect.cpp 프로젝트: Marlinc/0ad
// 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;
}
예제 #27
0
// Sets a new target
void FCDTargetedEntity::SetTargetNode(FCDSceneNode* target)
{
	if (targetNode != NULL)
	{
		targetNode->DecrementTargetCount();
	}

	targetNode = target;

	if (targetNode != NULL)
	{
		targetNode->IncrementTargetCount();
	}

	SetNewChildFlag();
}
예제 #28
0
// 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;
}
예제 #29
0
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();
	}
}
예제 #30
0
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();
}