コード例 #1
0
 /// <summary>Creates a static model out of the parameters.</summary>
 /// <param name="staticModelId">The id of this model for look up purposes.</param>
 /// <param name="meshes">A list of mesh ids, textures, and buffer references that make up this model.</param>
 internal StaticModel(string staticModelId, AvlTree<StaticMesh, string> meshes)
 {
     _id = staticModelId;
       _shaderOverride = null;
       _meshes = meshes;
       _position = new Vector(0, 0, 0);
       _scale = new Vector(1, 1, 1);
       _orientation = Quaternion.FactoryIdentity;
 }
コード例 #2
0
 /// <summary>Creates a blank template for a static model (you will have to construct the model yourself).</summary>
 public StaticModel(string id)
 {
     _id = id;
       _shaderOverride = null;
       _meshes = new AvlTreeLinked<StaticMesh, string>(StaticMesh.CompareTo, StaticMesh.CompareTo);
       _position = new Vector(0, 0, 0);
       _scale = new Vector(1, 1, 1);
       _orientation = Quaternion.FactoryIdentity;
 }
コード例 #3
0
ファイル: StaticModel.cs プロジェクト: killsto/SevenEngine
 /// <summary>Creates a static model out of the parameters.</summary>
 /// <param name="staticModelId">The id of this model for look up purposes.</param>
 /// <param name="meshes">A list of mesh ids, textures, and buffer references that make up this model.</param>
 internal StaticModel(string staticModelId, List<Link3<string, Texture, StaticMesh>> meshes)
 {
     _id = staticModelId;
       _shaderOverride = null;
       _meshes = meshes;
       _position = new Vector(0, 0, 0);
       _scale = new Vector(1, 1, 1);
       _rotationAxis = new Vector(0, 0, 0);
       _rotationAngle = 0;
 }
コード例 #4
0
ファイル: StaticModel.cs プロジェクト: killsto/SevenEngine
 /// <summary>Creates a blank template for a static model (you will have to construct the model yourself).</summary>
 public StaticModel()
 {
     _id = "From Scratch";
       _shaderOverride = null;
       _meshes = new List<Link3<string, Texture, StaticMesh>>();
       _position = new Vector(0, 0, 0);
       _scale = new Vector(1, 1, 1);
       _rotationAxis = new Vector(0, 0, 0);
       _rotationAngle = 0;
 }
コード例 #5
0
ファイル: ShaderProgram.cs プロジェクト: fakkoweb/AsTKoids
 public static Comparison CompareTo(ShaderProgram left, string right)
 {
   int comparison = left.Id.CompareTo(right);
   if (comparison > 0)
     return Comparison.Greater;
   else if (comparison < 0)
     return Comparison.Less;
   else
     return Comparison.Equal;
 }
コード例 #6
0
 /// <summary>Creates a static model from the ids provided.</summary>
 /// <param name="staticModelId">The id to represent this model as.</param>
 /// <param name="textures">An array of the texture ids for each sub-mesh of this model.</param>
 /// <param name="meshes">An array of each mesh id for this model.</param>
 /// <param name="meshNames">An array of mesh names for this specific instanc3e of a static model.</param>
 internal StaticModel(string staticModelId, string[] meshNames, string[] meshes, string[] textures)
 {
     if (textures.Length != meshes.Length && textures.Length != meshNames.Length)
     throw new Exception("Attempting to create a static model with non-matching number of components.");
       _id = staticModelId;
       _meshes = new AvlTreeLinked<StaticMesh, string>(StaticMesh.CompareTo, StaticMesh.CompareTo);
       for (int i = 0; i < textures.Length; i++)
     _meshes.Add(new StaticMesh(meshNames[i], TextureManager.Get(textures[i]), StaticModelManager.GetMesh(meshes[i]).StaticMeshInstance));
       _shaderOverride = null;
       _position = new Vector(0, 0, 0);
       _scale = new Vector(1, 1, 1);
       _orientation = Quaternion.FactoryIdentity;
 }
コード例 #7
0
ファイル: StaticModel.cs プロジェクト: killsto/SevenEngine
        /// <summary>Creates a static model from the ids provided.</summary>
        /// <param name="staticModelId">The id to represent this model as.</param>
        /// <param name="textures">An array of the texture ids for each sub-mesh of this model.</param>
        /// <param name="meshes">An array of each mesh id for this model.</param>
        /// <param name="meshNames">An array of mesh names for this specific instanc3e of a static model.</param>
        internal StaticModel(string staticModelId, string[] textures, string[] meshes, string[] meshNames)
        {
            if (textures.Length != meshes.Length && textures.Length != meshNames.Length)
            throw new Exception("Attempting to create a static model with non-matching number of components.");

              _id = staticModelId;
              //_meshes = new ListArray<Link<Texture, StaticMesh>>(10);
              _meshes = new List<Link3<string, Texture, StaticMesh>>();

              for (int i = 0; i < textures.Length; i++)
            _meshes.Add(meshNames[i], new Link3<string, Texture, StaticMesh>(meshNames[i], TextureManager.Get(textures[i]), StaticModelManager.GetMesh(meshes[i])));

              _shaderOverride = null;
              _position = new Vector(0, 0, 0);
              _scale = new Vector(1, 1, 1);
              _rotationAxis = new Vector(0, 0, 0);
              _rotationAngle = 0;
        }
コード例 #8
0
 public static int CompareTo(ShaderProgram left, string right)
 {
     return left.Id.CompareTo(right);
 }
コード例 #9
0
 public static int CompareTo(ShaderProgram left, ShaderProgram right)
 {
     return left.Id.CompareTo(right.Id);
 }
コード例 #10
0
        internal static void SetUpBuiltInShaders()
        {
            // Basic Vertex Shader
              int basicVertexShaderHandle = GL.CreateShader(ShaderType.VertexShader);
              GL.ShaderSource(basicVertexShaderHandle, VertexShader.Texture);
              GL.CompileShader(basicVertexShaderHandle);
              VertexShader basicVertexShader =
            new VertexShader("VertexShaderBasic", "Built-In", basicVertexShaderHandle);

              // Transform Vertex Shader
              int transformVertexShaderHandle = GL.CreateShader(ShaderType.VertexShader);
              GL.ShaderSource(transformVertexShaderHandle, VertexShader.Transform);
              GL.CompileShader(transformVertexShaderHandle);
              VertexShader transformVertexShader =
            new VertexShader("VertexShaderTransform", "Built-In", transformVertexShaderHandle);

              // Basic Fragment Shader
              int basicFragmentShaderHandle = GL.CreateShader(ShaderType.FragmentShader);
              GL.ShaderSource(basicFragmentShaderHandle, FragmentShader.Texture);
              GL.CompileShader(basicFragmentShaderHandle);
              FragmentShader basicFragmentShader =
            new FragmentShader("FragmentShaderBasic", "Built-In", basicFragmentShaderHandle);

              // Color Fragment Shader
              int colorFragmentShaderHandle = GL.CreateShader(ShaderType.FragmentShader);
              GL.ShaderSource(colorFragmentShaderHandle, FragmentShader.Color);
              GL.CompileShader(colorFragmentShaderHandle);
              FragmentShader colorFragmentShader =
            new FragmentShader("FragmentShaderBasic", "Built-In", colorFragmentShaderHandle);

              // Text Fragment Shader
              int textFragmentShaderHandle = GL.CreateShader(ShaderType.FragmentShader);
              GL.ShaderSource(textFragmentShaderHandle, FragmentShader.Text);
              GL.CompileShader(textFragmentShaderHandle);
              FragmentShader textFragmentShader =
            new FragmentShader("FragmentShaderBasic", "Built-In", textFragmentShaderHandle);

              // Make the default shader program
              int basicProgramHandle = GL.CreateProgram();
              GL.AttachShader(basicProgramHandle, basicVertexShader.GpuHandle);
              GL.AttachShader(basicProgramHandle, basicFragmentShader.GpuHandle);
              GL.LinkProgram(basicProgramHandle);
              _defaultShader = new ShaderProgram("ShaderProgramBasic", basicProgramHandle);
              Renderer.DefaultShaderProgram = _defaultShader;

              // Make the color shader program
              int colorProgramHandle = GL.CreateProgram();
              GL.AttachShader(colorProgramHandle, transformVertexShader.GpuHandle);
              GL.AttachShader(colorProgramHandle, colorFragmentShader.GpuHandle);
              GL.LinkProgram(colorProgramHandle);
              _colorShader = new ShaderProgram("ShaderProgramColor", colorProgramHandle);

              // Make the default shader program
              int textProgramHandle = GL.CreateProgram();
              GL.AttachShader(textProgramHandle, basicVertexShader.GpuHandle);
              GL.AttachShader(textProgramHandle, textFragmentShader.GpuHandle);
              GL.LinkProgram(textProgramHandle);
              _textShader = new ShaderProgram("ShaderProgramText", textProgramHandle);

              // Vertex Shader Light
              int vertexShaderLightHandle = GL.CreateShader(ShaderType.VertexShader);
              GL.ShaderSource(vertexShaderLightHandle, VertexShader.Light);
              GL.CompileShader(vertexShaderLightHandle);
              VertexShader vertexShaderLight =
            new VertexShader("VertexShaderLight", "Built-In", vertexShaderLightHandle);

              // Fragment Shader Light
              int fragmentShaderLightHandle = GL.CreateShader(ShaderType.FragmentShader);
              GL.ShaderSource(fragmentShaderLightHandle, FragmentShader.Light);
              GL.CompileShader(fragmentShaderLightHandle);
              FragmentShader fragmentShaderLight =
            new FragmentShader("FragmentShaderBasic", "Built-In", fragmentShaderLightHandle);

              // Shader Program Light
              int shaderProgramLightHandle = GL.CreateProgram();
              GL.AttachShader(shaderProgramLightHandle, vertexShaderLight.GpuHandle);
              GL.AttachShader(shaderProgramLightHandle, fragmentShaderLight.GpuHandle);
              GL.LinkProgram(shaderProgramLightHandle);
              _lightShader = new ShaderProgram("ShaderProgramLight", shaderProgramLightHandle);
        }
コード例 #11
0
ファイル: StaticModel.cs プロジェクト: fakkoweb/AsTKoids
 /// <summary>Creates a static model out of the parameters.</summary>
 /// <param name="staticModelId">The id of this model for look up purposes.</param>
 /// <param name="meshes">A list of mesh ids, textures, and buffer references that make up this model.</param>
 internal StaticModel(string staticModelId, AvlTree<StaticMesh> meshes)
 {
   _id = staticModelId;
   _hasChildren = false;
   _isChild = false;
   _shaderOverride = null;
   _meshes = meshes;
   _childrenModels = new AvlTree_Linked<StaticModel>(StaticModel.CompareTo);
   _parentModel = null;
   _position = new Vector3(0, 0, 0);
   _scale = new Vector3(1, 1, 1);
   _orientation = Quaternion.Identity;
 }
コード例 #12
0
ファイル: StaticModel.cs プロジェクト: fakkoweb/AsTKoids
    /// <summary>Creates a static model from the ids provided.</summary>
    /// <param name="staticModelId">The id to represent this model as.</param>
    /// <param name="textures">An array of the texture ids for each sub-mesh of this model.</param>
    /// <param name="meshes">An array of each mesh id for this model.</param>
    /// <param name="meshNames">An array of mesh names for this specific instanc3e of a static model.</param>
    internal StaticModel(string staticModelId, string[] meshNames, string[] meshes, string[] textures)
    {
      if (textures.Length != meshes.Length && textures.Length != meshNames.Length)
        throw new System.Exception("Attempting to create a static model with non-matching number of components.");
      _id = staticModelId;
      _hasChildren = false;
      _isChild = false;
      _meshes = new AvlTree_Linked<StaticMesh>(StaticMesh.CompareTo);
      _childrenModels = new AvlTree_Linked<StaticModel>(StaticModel.CompareTo);
      _parentModel = null;
      for (int i = 0; i < textures.Length; i++)
      {
        StaticMesh mesh = StaticModelManager.GetMesh(meshes[i]);
        mesh.Texture = TextureManager.Get(textures[i]);
        _meshes.Add(mesh);

      }
      _shaderOverride = null;
      _position = new Vector3(0, 0, 0);
      _scale = new Vector3(1, 1, 1);
      _orientation = Quaternion.Identity;
    }