Im trying to create a very simple game, and am working with HLSL. i got this error in my draw method:
"The current vertex declaration does not include all the elements required by the current vertex shader. TextureCoordinate0 is missing."
and here is my draw method:
public void Draw(Matrix View, Matrix Projection,Vector3 CameraPosition)
{
Matrix baseWorld = Matrix.CreateScale(Scale) *
Matrix.CreateFromYawPitchRoll(Rotation.X, Rotation.Y, Rotation.Z) *
Matrix.CreateTranslation(Position);
foreach (ModelMesh mesh in Model.Meshes)
{
Matrix localWorld = modelTransforms[mesh.ParentBone.Index] * baseWorld;
foreach (ModelMeshPart part in mesh.MeshParts)
{
Effect effect = part.Effect;
if (part.Effect is BasicEffect)
{
((BasicEffect)effect).World = localWorld;
((BasicEffect)effect).View = View;
((BasicEffect)effect).Projection = Projection;
((BasicEffect)effect).EnableDefaultLighting();
}
else
{
setEffectParameter(effect, "World", localWorld);
setEffectParameter(effect, "View", View);
setEffectParameter(effect, "Projection", Projection);
setEffectParameter(effect, "CameraPosition", CameraPosition);
Material.SetEffectParameters(effect);
}
}
mesh.Draw();
}
but if in VertexShaderFunction (in LightingEffect), instead of "output.UV = input.UV" i put "output.UV=float2(somefloat,somefloat)" i got no error.
and there is a another thing, i got this error when i try to load my "Cathedral" model and others, but for "teapot" model i got no error!
i'm realy confused!
here is my complete code and models. http://www.uploadmb.com/dw.php?id=1336639273
thank you for your helping.