AxiomSceneBuilder.cs :  » Game » RealmForge » RealmForge » Scene » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Game » RealmForge 
RealmForge » RealmForge » Scene » AxiomSceneBuilder.cs
using System;
using RealmForge.Definitions.Templates;
using AxAxiom.Core;
using Axiom.MathLib;
using System.Drawing;
using RealmForge.SceneObjects;
using RealmForge.Primitives;
using RealmForge.Definitions.Infos;
using RealmForge.Definitions;
using RealmForge.Definitions.References;

namespace RealmForge.Scene{
  /// <summary>
  /// Scene object factory and state-driven builder for the progmatic construction of scenes for the Axiom rendering engine.
  /// </summary>
  public class AxiomSceneBuilder : SceneBuilder
  {
    #region Fields and Properties
    protected Ax.SceneManager axiomScene;
    public Ax.SceneManager AxiomScene { get { return axiomScene; } set{ axiomScene = value; } }
    #endregion

    #region Constructors
    public AxiomSceneBuilder()
    {
    }
    #endregion

    #region Methods
    
    protected override ICamera CreateCamera(string id) {
      return new AxiomCamera(id);
    }

    protected override ISceneNode CreateSceneNode(string id) {
      return new AxiomSceneNode(id);
    }
    
    protected override IRealm CreateRealm(string id) {
      return new AxiomRealm(id);
    }
    
    protected override IRegion CreateRegion(string id) {
      return new AxiomRegion(id);
    }


    protected override SceneNodeTemplate CreateSceneNodeTemplate() {
      return new AxiomSceneNodeTemplate();
    }

    protected override SpriteTemplate CreateSpriteTemplate() {
      return new AxiomSpriteTemplate();
    }

    protected override LightTemplate CreateLightTemplate() {
      return new AxiomLightTemplate();
    }
    protected override EntityTemplate CreateEntityTemplate() {
      return new AxiomEntityTemplate();
    }

    #endregion

    #region Shapes
    public override IPlaneEntity NewPlane(string id, PlaneInfo plane, string material) {
      IPlaneEntity planeEnt = new AxiomPlane(id, plane);
      if(material != null)
        planeEnt.Material = material;
      if(parentNode != null)
        parentNode.AddChild(planeEnt);
      return planeEnt;
    }
    public override ISceneNode NewTriangle(string id, Vector3 point1, Vector3 point2, Vector3 point3, Color color1, Color color2, Color color3, string material) {
      AxiomPolygon poly = CreatePolygon(id, material);
      poly.InitTriangle(point1, point2, point3, color1, color2, color3);
      return poly;
    }

    public override ISceneNode NewPolygon(string id, AxisAlignedBox boundingBox, PolygonType renderType, Vector3[] vertices, Color[] colors, string material) {
      AxiomPolygon poly = CreatePolygon(id, material);
      poly.InitPolygon(renderType, boundingBox, vertices, colors);
      return poly;
    }

    public override ISceneNode NewLine(string id, Vector3 startPoint, Vector3 endPoint, Color startColor, Color endColor, string material) {
      AxiomPolygon poly = CreatePolygon(id, material);
      poly.InitLine(startPoint, endPoint, startColor, endColor);
      return poly;
    }

    protected AxiomPolygon CreatePolygon(string id, string material) {
      string newMaterialName = material + "_" + id;  //the name of the cloned material which is customized for use with a polygon
      AxiomPolygon poly = new AxiomPolygon(id, material, newMaterialName);
      if(parentNode != null)
        parentNode.AddChild(poly);
      return poly;
    }
    #endregion

    #region Special Effects
    
    protected override IParticleSystem CreateParticleSystem(string id, string sourceFile) {
      return new AxiomParticleSystem(id, 0f, sourceFile);
    }
    #endregion
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.