Beispiel #1
0
/// Replaces copy-constructor.
bool Mesh::LoadDataFrom(const Mesh * otherMesh, bool nullify /*= false*/)
{
	// std::cout<<"\nLoadDataFrom mesh constructor begun...";
	if (!aabb)
		aabb = new AABB();
	assert(otherMesh->aabb);
	*aabb = *otherMesh->aabb;
	// Update update time.
	lastUpdate = otherMesh->lastUpdate;

	// Why.. nullify.... _T_
	if (nullify)
	    Nullify();
//	return true;

	assert(otherMesh->numVertices);
//	std::cout<<"\nMesh numVertices: "<<otherMesh->numVertices;
	name = otherMesh->name;
	source = otherMesh->source;
	numVertices = otherMesh->numVertices;
	numUVs = otherMesh->numUVs;
	numNormals = otherMesh->numNormals;
	numFaces = otherMesh->numFaces;
	loadedFromCompactObj = otherMesh->loadedFromCompactObj;
	this->skeleton = otherMesh->skeleton;
	vertexWeights = otherMesh->vertexWeights;
	
	vertices = otherMesh->vertices;
	originalVertexPositions = otherMesh->originalVertexPositions;
	uvs = otherMesh->uvs;
	normals = otherMesh->normals;
	faces = otherMesh->faces;
	return true;
}
Beispiel #2
0
ScriptLevel::ScriptLevel(int i_type, int i_startLine) 
{
	Nullify();
	type = i_type;
	startLine = i_startLine;
	endLine = 0;
};
Beispiel #3
0
PhysicsProperty::PhysicsProperty(const CompactPhysics * compactPhysics)
{
	Nullify();
	type = compactPhysics->type;
	shapeType = compactPhysics->physicsShape;
//	usesCollisionShapeOctree = false;
	/// Shape will be generated right after this is created!
/*	shape = NULL;
	physicsMesh = NULL;
	*/
	state = compactPhysics->state;
	physicalRadius = compactPhysics->physicalRadius;
	velocity = compactPhysics->velocity;
	acceleration = compactPhysics->acceleration;
#ifdef USE_MASS
	mass = compactPhysics->mass;
	volume = compactPhysics->volume;
	density = compactPhysics->density;
#endif
//	octreeNode = NULL; // Node will assigned after being registered.
	restitution = compactPhysics->restitution;
	friction = compactPhysics->friction;
	collisionCallback = compactPhysics->collisionCallback;
	collisionCallbackRequirementValue = compactPhysics->collisionCallbackRequirementValue;
	collisionsEnabled = compactPhysics->collisionsEnabled;
	noCollisionResolutions = compactPhysics->noCollisionResolutions;
}
Beispiel #4
0
GMSetResolution::GMSetResolution(Vector2i newRes, bool reqLock)
	: GraphicsMessage(GM_SET_RESOLUTION)
{
	Nullify();
	res = newRes; 
	lock = reqLock;
}
Beispiel #5
0
Ground::Ground()
{
	Background = Iw2DCreateImage("_ground/grass.jpg");	// Load background
	mWidth = Iw2DGetSurfaceWidth();		// Fetch screen dimensions
	mHeight = Iw2DGetSurfaceHeight();
	Nullify();

}
Beispiel #6
0
FrameBuffer::FrameBuffer(Viewport * vp, Vector2i initialSize)
{
	Nullify();
	this->size = initialSize;
	this->viewport = vp;
	frameBufferObject = -1;
	good = false;
}
Beispiel #7
0
Enemy::Enemy(ResourceManager* res, PhysXEngine* phys, GUI* gu)
{
	Nullify();
	health = &gu->health;
	armour = &gu->armour;
	resources = res;
	physics = phys;
	gui = gu;
	srand(timeGetTime());
	srand(timeGetTime() + rand() + *health + *armour);
	//dCube = new DebugCube(D3DXVECTOR3(0,0,0),D3DXVECTOR3(0,0,0),-D3DXVECTOR3(0.5f,0.5f,0.5f),D3DXVECTOR3(0.5f,0.5f,0.5f),res);
}
Beispiel #8
0
Script::Script(String name, Script * parent /* = NULL */ )
{
	Nullify();
	this->name = name;
	this->parent = parent;
//	source = "Test.e";
	// Assume child scripts are inherent C++ classes which do not require further loading.
	if (parent){
		loaded = true;
	}
	if (parent)
	{
		parent->childScripts.Add(this);
	}
	functionEvaluators = defaultFunctionEvaluators;
};
Beispiel #9
0
Script::Script(const Script & base)
{
	Nullify();
	name = base.name;
	source = base.source;
	triggerCondition = base.triggerCondition;
	loaded = base.loaded;
	executed = base.executed;
	repeatable = base.repeatable;
	currentLine = base.currentLine;
	scriptState = base.scriptState;
	lineFinished = base.lineFinished;
	flags = base.flags;
	/// Copy loaded data too.
	lines = base.lines;
	pausesExecution = base.pausesExecution;
}
bool dCILInstrMove::ApplyCopyPropagationSSA (dWorkList& workList, dStatementBlockDictionary& usedVariablesDictionary)
{
	bool ret = false;
	if (!((m_arg1.GetType().m_intrinsicType == dCILInstr::m_constInt) || (m_arg1.GetType().m_intrinsicType == dCILInstr::m_constFloat))) {
		dStatementBlockDictionary::dTreeNode* const node = usedVariablesDictionary.Find(m_arg0.m_label);
		if (node) {
//Trace();
			dStatementBlockBucket::Iterator iter(node->GetInfo());
			for (iter.Begin(); iter; iter++) {
				dCILInstr* const instrution = iter.GetKey()->GetInfo();
//instrution->Trace();
				instrution->ReplaceArgument(m_arg0, m_arg1);
//instrution->Trace();
				workList.Insert(instrution->GetNode());
			}
		}
		Nullify();
		ret = true;
	}
	return ret;
}
Beispiel #11
0
/// Copy constructor
PhysicsProperty::PhysicsProperty(const PhysicsProperty& other) 
{
	Nullify();
	type = other.type;
	shapeType = other.shapeType;
	usesCollisionShapeOctree = other.usesCollisionShapeOctree;
	shape = other.shape;
#ifdef USE_MASS
	mass = other.mass;
	volume = other.volume;
	density = other.density;
#endif
//	octreeNode = NULL;
//	physicalRadius = 0;
	restitution = other.restitution;
	friction = other.friction;
	collisionCallback = other.collisionCallback;
	collisionCallbackRequirementValue = other.collisionCallbackRequirementValue;
	collisionsEnabled = other.collisionsEnabled;
	noCollisionResolutions = other.noCollisionResolutions;
	physicsMesh = other.physicsMesh;
}
Beispiel #12
0
// o.o
File::File()
{
	Nullify();
}
Beispiel #13
0
Movement::Movement()
{
	Nullify();
}
Beispiel #14
0
ScriptLevel::ScriptLevel()
{
	Nullify();
}
Beispiel #15
0
/// For creating an optimized version of the more complex/pointer-oriented E(ditable)-Mesh.
bool Mesh::LoadDataFrom(const EMesh * otherMesh)
{
	std::cout<<"\nLoadDataFrom mesh constructor begun...";
    /// Deallocate as needed first?
	DeallocateArrays();
	/// Nullify stuff.
	Nullify();

	// Fetch numbers
	name = otherMesh->name;
	source = otherMesh->source;
	numVertices = otherMesh->vertices.Size();
	numUVs = otherMesh->uvs.Size();
	numNormals = otherMesh->normals.Size();
	numFaces = otherMesh->faces.Size();

	// If no normals, generate 1.
	bool generateNormals = false;
	if (numNormals == 0)
	{
		generateNormals = true;
	}

	// Allocate
	AllocateArrays();
	
	/// Extract all actual data.
	for (int i = 0; i < otherMesh->vertices.Size(); ++i)
	{
		Vector3f data = *(Vector3f*)otherMesh->vertices[i];
		vertices[i] = data;
	}
	// Load UVs
	for (int i = 0; i < otherMesh->uvs.Size(); ++i)
	{
		Vector2f data = *(Vector2f*)otherMesh->uvs[i];
		uvs[i] = data;
	}
	for (int i = 0; i < otherMesh->normals.Size(); ++i)
	{
		Vector3f data = *(Vector3f*)otherMesh->normals[i];
		normals[i] = data;
	}
	if (generateNormals)
	{
		numNormals = 1;
		normals[0] = Vector3f(0,1,0);
	}

	for (int i = 0; i < otherMesh->faces.Size(); ++i)
	{
		MeshFace & face = faces[i];
		EFace * eFace = otherMesh->faces[i];
		face.numVertices = eFace->vertices.Size();
		face.AllocateArrays();
		for (int j = 0; j < face.numVertices; ++j)
		{
			EVertex * vertex = eFace->vertices[j];
			// Now the bothersome part, fetch the indices of the vertices..
			int index = otherMesh->vertices.GetIndexOf(vertex);
			// Fetch UV if possible.
			EUV * uv = 0;
			uv = vertex->uvCoord;

			int uvIndex = 0;
			if (uv)
			{
				uvIndex = otherMesh->uvs.GetIndexOf(uv);
			}
			// .. and decrement it? or increment..? Nah. Should be 0-based!
			face.vertices[j] = index;
			int normalIndex = 0;
			ENormal * normal = eFace->normal;
			if (normal)
				normalIndex = otherMesh->normals.GetIndexOf(normal);
			face.normals[j] = normalIndex;
			face.uvs[j] = uvIndex;
		}
	}
	std::cout<<" loaded.";
	return true;
}
Beispiel #16
0
Movement::Movement(int withType)
{	
	Nullify();
	type = withType;
}
Beispiel #17
0
Mesh::Mesh()
{
	Nullify();
}
Beispiel #18
0
/// Assignment operator. Similar to constructor.
void File::operator = (String assignedPath)
{
	Nullify();
	this->path = assignedPath;
}
Beispiel #19
0
FrameBuffer::FrameBuffer(String name)
: name(name)
{
	Nullify();
}
Beispiel #20
0
GMSetResolution::GMSetResolution()
	: GraphicsMessage(GM_SET_RESOLUTION)
{
	Nullify();
}
Beispiel #21
0
// Constructor
File::File(String cPath)
{
	Nullify();
	this->path = cPath;
}
Beispiel #22
0
PhysicsProperty::PhysicsProperty()
{
	Nullify();
};