/*
* PinaModel.cs
* Authors: August Zinsser
*
* Copyright August Zinsser 2007
* This program is distributed under the terms of the GNU General Public License
*/
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
namespace Pina3D
{
///
/// THIS CLASS HAS NO RELATION TO Microsoft.Xna.Framework.Graphics.Model! IT IS DESIGNED TO REPLACE IT.
/// A Renderable based on Mesh and Material data from a ColladaFile object. The Material data can be reassigned, but takes its DefaultMaterial
/// from the ColladaFile.
///
public class PinaModel : Renderable
{
///
/// The underlying model data loaded from a ColladaFile object
///
public new ColladaFile SourceData
{
set { ((RenderableState)mState).SourceData = value; }
get { return ((ColladaFile)((RenderableState)mState).SourceData); }
}
public PinaModel(PinaState spawnState, ColladaFile sourceData)
: base (spawnState, sourceData)
{
}
internal override void Render()
{
// Use this instance's shader if material is defined, otherwise use the source's shader based on the defaultmaterial
if (((RenderableState)mState).Material != null)
((ColladaFile)_Type).Render(((RenderableState)mState).SourceData, ((RenderableState)mState).Shader, mState);
else
((ColladaFile)_Type).Render(((RenderableState)mState).SourceData, ((ColladaFile)((RenderableState)mState).SourceData).DefaultShader, mState);
}
protected class PinaModelState : RenderableState
{
public PinaModelState(PinaState pinaState, ColladaFile model)
: base(pinaState, model)
{
}
}
}
}