The models are drawing odd. They are either transparent or drawing thing in the wrong order/drawing too much. You are seeing things from the front and the back. Like seeing both sides of a coin at the same time. See attached file for an example. You can see both the front and the back side of the coin
/>
Here is my drawing function. Sorry it is a little messy, I am STILL learning a lot about drawing, and I actually feel like I know nothing yet
/>
The coin has a Y and a 1 on it. Model is copyright 2012 PlazSoft, all rights reserved.
Here is my drawing function. Sorry it is a little messy, I am STILL learning a lot about drawing, and I actually feel like I know nothing yet
/// <summary>
/// Draw the model. A model can have multiple meshes, so loop. //Quaternion quaternionRotation Vector3 rotationVector
/// </summary>
public void drawModel(clsCamera camera, Quaternion quaternionRotation, Vector3 modelPosition, int modelNumber, float scaleRatio, drawType drawMode, bool drawParticles = false)
{
// Copy any parent transforms. Should I be using this here??????
//Matrix[] transforms = new Matrix[myModel.Bones.Count];
//myModel.CopyAbsoluteBoneTransformsTo(transforms);
if (modelSet.ultraResModels[modelNumber] != null)
{
Matrix[] transforms = new Matrix[modelSet.ultraResModels[modelNumber].Bones.Count];
modelSet.ultraResModels[modelNumber].CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh mesh in modelSet.ultraResModels[0].Meshes)
{
// This is where the mesh orientation is set, as well // as our camera and projection.
foreach (BasicEffect effect in mesh.Effects)
{
//effect.EnableDefaultLighting();
effect.LightingEnabled = true; // Turn on the lighting subsystem.
if (drawMode == drawType.wireframe)
{
effect.DiffuseColor = camera.effects.DiffuseColor;
effect.FogEnabled = false;
effect.AmbientLightColor = new Vector3(.6f, .6f, .6f);
}
else
{
effect.DiffuseColor = new Vector3(1, 1, 1); //null;// Color.Transparent.d;// camera.effects.DiffuseColor.;
effect.DirectionalLight0.DiffuseColor = new Vector3(100f, 100f, 100f); // a light color
effect.DirectionalLight0.Direction = new Vector3(1f, 0, .2f); // coming along the x-axis
effect.DirectionalLight0.SpecularColor = new Vector3(1, 1, 1); // with green highlights
effect.AmbientLightColor = new Vector3(0.8f, 0.8f, 0.8f); // Add some overall ambient light.
//effect.EmissiveColor = new Vector3(.5f, 0, 0); // Sets some strange emmissive lighting. This just looks weird.
//effect.FogEnabled = camera.effects.FogEnabled;
//effect.FogStart = camera.effects.FogStart;
//effect.FogEnd = camera.effects.FogEnd;
//effect.FogColor = camera.effects.FogColor;
}
//if (mesh.Tag != null)
//{
// //mesh.MeshParts.
// //effect.Texture = mesh.Tag;
// effect.TextureEnabled = true; //camera.effects.TextureEnabled;
// //effect.Parameters["xTexture"].SetValue(exTextures[i++]);
// //effect.CommitChanges();
//}
//else
//{
// effect.TextureEnabled = true;
//}
//effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(modelRotationY + MathHelper.ToRadians(-90)) * Matrix.CreateRotationX(modelRotationX) * Matrix.CreateTranslation(modelPosition) * Matrix.CreateScale(scaleRatio, scaleRatio, scaleRatio);
//effect.Texture = GridTexture;
effect.World = transforms[mesh.ParentBone.Index] *
Matrix.CreateScale(scaleRatio, scaleRatio, scaleRatio) *
Matrix.CreateFromQuaternion(quaternionRotation) *
Matrix.CreateTranslation(new Vector3(modelPosition.X + adjust.offsetPosition.X, modelPosition.Y + adjust.offsetPosition.Y, modelPosition.Z + adjust.offsetPosition.Z));
//Matrix worldMatrix = * Matrix.CreateRotationY(MathHelper.Pi) * Matrix.CreateTranslation(new Vector3(19, 12, -5));
effect.View = camera.view; //Matrix.CreateLookAt(camera.cameraPosition, Vector3.Zero, Vector3.Up);
effect.Projection = camera.projection; //Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);
}
foreach (ModelMeshPart part in mesh.MeshParts)
{
clsMisc.polygonCount += part.PrimitiveCount;
}
// Draw the mesh, using the effects set above.
mesh.Draw();
}
}
}
The coin has a Y and a 1 on it. Model is copyright 2012 PlazSoft, all rights reserved.