Example #1
0
//Makes a Square by default 
Entity::Entity(int type, std::string label, float width, float height, float depth) :
mPosition(0.0f, 0.0f, 0.0f),
mShadowScale(0.0f, 0.0f, 0.0f),
mRight(1.0f, 0.0f, 0.0f),
mUp(0.0f, 1.0f, 0.0f),
mLook(0.0f, 0.0f, 1.0f),
prevPitch(0.0f),
rotationY(0.0f),
prevRoll(0.0f),
origTexScale(1.0f, 1.0f, 1.0f),
texTrans(0.0f, 0.0f, 0.0f),
texTransMult(0.0f, 0.0f, 0.0f),
mGoToPos(0.0f, 0.0f, 0.0f),
currProgress(0.0f),
rotationZ(0.0f),
mDistanceLeft(0.0f),
mTexWidth(0.0f),
mTexHeight(0.0f),
mUpDown(false),
mGrowing(false),
mSquishX(false),
mSquishY(false),
mSquishZ(false),
mOrigY(0.0f),
mOrigX(0.0f),
mOrigZ(0.0f),
mGrowOut(false),
mHeightToGo(0.0f),
mScale(1.0f),
mWidth(width),
mHeight(height),
mDepth(depth),
hovering(false),
useTexTrans(false),
progressBar(false),
goToPos(false),
billboard(false),
flipUpright(false),
reverseLook(false),
mDead(false),
mSpinning(false),
mExplode(false),
mBasicTexTrans(false),
mUseAnimation(false),
mUseAAB(false),
mUseAABOnce(false),
mGoUp(true),
mBackFaceCull(true),
mGoDown(false),
mSideToSide(false),
mPulse(false),
mOrbit(false),
turnAngle(0.0f),
explosionDist(0.0f),
mAnim(0),
movementMult(0.0f),
mFlipping(false),
mRolling(false),
mBackAndForth(false),
mGrow(true),
mShrink(false),
mGrowIn(false),
mFlipTexture(false),
mTexRotate(false),
mLabel(label)
{
	//SET MATERIAL
	mMat.Ambient	= XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
	mMat.Diffuse	= XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
	mMat.Specular	= XMFLOAT4(1.0f, 1.0f, 1.0f, 48.0f);

	GeometryGenerator geoGen;

	//FLOOR PLANE
	XMMATRIX I = XMMatrixIdentity();
	XMStoreFloat4x4(&mWorld, I); XMStoreFloat4x4(&mShadowTrans, I);

	switch (type)
	{
	case 0: geoGen.CreateGrid(width, height, 2, 2, mGrid);					break;
	case 1: geoGen.CreateSphere(width, height, height, mGrid);/*height is slice count .. width for radius*/ break;
	case 2: geoGen.CreateUprightSquare(width, height, mGrid);				break;
	case 3: geoGen.CreateBox(width, height, depth, mGrid);					break;
	case 4: geoGen.CreateFrontandBackFace(width, height, depth, mGrid);		break;
	case 5: geoGen.CreateCylinder(width, depth, height, 15, 2, mGrid);		break;
	case 6: geoGen.CreateBox2Tex(width, height, depth, mGrid);				break;
	}

	mIndexCount = mGrid.Indices.size();
	mMeshVertices.resize(mGrid.Vertices.size());
}