Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scene" /> class.
        /// </summary>
        public Scene()
        {
            _perFrameData = new CBPerFrame();

            this.TransformMode2D     = Graphics2DTransformMode.Custom;
            this.CustomTransform2D   = Matrix3x2.Identity;
            this.VirtualScreenSize2D = new SizeF();

            _sceneComponents = new SceneComponentFlyweight(this);

            _sceneLayers = new UnsafeList <SceneLayer>();
            _sceneLayers.Add(new SceneLayer(DEFAULT_LAYER_NAME, this));
            this.Layers = new ReadOnlyCollection <SceneLayer>(_sceneLayers);

            _drawing2DLayers = new List <Custom2DDrawingLayer>();

            _asyncInvokesBeforeUpdate          = new ConcurrentQueue <Action>();
            _asyncInvokesUpdateBesideRendering = new ConcurrentQueue <Action>();

            _registeredResourceDicts = new IndexBasedDynamicCollection <ResourceDictionary>();
            _registeredViews         = new IndexBasedDynamicCollection <ViewInformation>();
            _renderParameters        = new IndexBasedDynamicCollection <SceneRenderParameters>();

            this.CachedUpdateState = new SceneRelatedUpdateState();

            // Try to initialize this scene object
            this.InitializeResourceDictionaries();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GenericObject"/> class.
        /// </summary>
        /// <param name="geometryResource">The geometry resource.</param>
        public GenericObject(NamedOrGenericKey geometryResource)
        {
            m_localResources = new IndexBasedDynamicCollection <GeometryResource>();

            m_resGeometryKey = geometryResource;

            //m_opacity = 1f;
            m_passRelevantValuesChanged = true;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FullscreenTextureObject"/> class.
        /// </summary>
        /// <param name="texture">The texture.</param>
        public FullscreenTextureObject(NamedOrGenericKey texture)
        {
            m_resTexture         = texture;
            m_scaling            = 1f;
            m_opacity            = 1f;
            m_accentuationFactor = 0f;
            m_alphaMode          = TexturePainterAlphaBlendMode.AlphaBlend;

            m_texturePainterHelpers = new IndexBasedDynamicCollection <TexturePainterHelper>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FullscreenTexture"/> class.
        /// </summary>
        /// <param name="texture">The texture.</param>
        public FullscreenTexture(NamedOrGenericKey texture)
        {
            _resTexture             = texture;
            this.Scaling            = 1f;
            this.Opacity            = 1f;
            this.AccentuationFactor = 0f;
            this.AlphaBlendMode     = TexturePainterAlphaBlendMode.AlphaBlend;

            _texturePainterHelpers = new IndexBasedDynamicCollection <TexturePainterHelper>();
        }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Mesh"/> class.
        /// </summary>
        /// <param name="geometryResourceKey">The geometry resource.</param>
        /// <param name="materialResourceKeys">The material resources to apply on this Mesh.</param>
        public Mesh(NamedOrGenericKey geometryResourceKey, params NamedOrGenericKey[] materialResourceKeys)
        {
            _localResGeometry  = new IndexBasedDynamicCollection <GeometryResource>();
            _localResMaterials = new IndexBasedDynamicCollection <MaterialResource[]>();
            _localChunks       = new IndexBasedDynamicCollection <RenderingChunk[]>();

            _resGeometryKey          = geometryResourceKey;
            _resMaterialResourceKeys = materialResourceKeys;

            _passRelevantValuesChanged = true;
        }
Beispiel #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scene" /> class.
        /// </summary>
        /// <param name="name">The global name of this scene.</param>
        /// <param name="registerOnMessenger">
        /// Do register this scene for application messaging?
        /// If true, then the caller has to ensure that the name is only used once
        /// across the currently executed application.
        /// </param>
        public Scene(
            string name = "",
            bool registerOnMessenger = false)
        {
            if (string.IsNullOrEmpty(name))
            {
                name = DEFAULT_SCENE_NAME;
            }
            this.Name = name;

            m_perFrameData = new CBPerFrame();

            m_transformMode2D     = Graphics2DTransformMode.Custom;
            m_customTransform2D   = Matrix3x2.Identity;
            m_virtualScreenSize2D = new Size2F();

            m_sceneLayers = new List <SceneLayer>();
            m_sceneLayers.Add(new SceneLayer(DEFAULT_LAYER_NAME, this));
            m_sceneLayersPublic = new ReadOnlyCollection <SceneLayer>(m_sceneLayers);

            m_drawing2DLayers = new List <Custom2DDrawingLayer>();

            m_sceneComponents = new SceneComponentFlyweight(this);

            m_asyncInvokesBeforeUpdate          = new ThreadSaveQueue <Action>();
            m_asyncInvokesUpdateBesideRendering = new ThreadSaveQueue <Action>();

            m_registeredResourceDicts = new IndexBasedDynamicCollection <ResourceDictionary>();
            m_registeredViews         = new IndexBasedDynamicCollection <ViewInformation>();
            m_renderParameters        = new IndexBasedDynamicCollection <SceneRenderParameters>();

            this.CachedUpdateState = new SceneRelatedUpdateState(this);

            // Try to initialize this scene object
            InitializeResourceDictionaries(false);

            // Register the scene for ApplicationMessaging
            if (registerOnMessenger)
            {
                m_syncContext = new SceneSynchronizationContext(this);
                m_messenger   = new SeeingSharpMessenger();
                m_messenger.ApplyForGlobalSynchronization(
                    SeeingSharpMessageThreadingBehavior.EnsureMainSyncContextOnSyncCalls,
                    this.Name,
                    m_syncContext);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SceneObject"/> class.
        /// </summary>
        protected SceneObject()
        {
            m_targetDetailLevel = DetailLevel.All;

            m_children = new List <SceneObject>();
            m_parent   = null;

            m_behaviors        = new List <SceneObjectBehavior>();
            m_animationHandler = new AnimationHandler(this);
            m_visibilityData   = new IndexBasedDynamicCollection <VisibilityCheckData>();

            //Create a dynamic container for custom data
            m_customData = new ExpandoObject();

            this.TransormationChanged = true;
            this.IsPickingTestVisible = true;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SceneSpacialObject"/> class.
        /// </summary>
        public SceneSpacialObject()
        {
            m_renderParameters = new IndexBasedDynamicCollection <ObjectRenderParameters>();

            m_rotationUp      = Vector3.UnitY;
            m_rotationForward = Vector3.UnitZ;

            m_opacity            = 1f;
            m_color              = Color4.White;
            m_accentuationFactor = 0f;
            m_borderPart         = 0.01f;
            m_borderMultiplyer   = 0f;

            m_transformationType     = SpacialTransformationType.ScalingTranslationEulerAngles;
            m_position               = Vector3.Zero;
            m_rotation               = Vector3.Zero;
            m_scaling                = new Vector3(1f, 1f, 1f);
            m_transform              = Matrix4x4.Identity;
            m_rotationQuaternion     = Quaternion.Identity;
            m_transformParamsChanged = true;
        }
Beispiel #9
0
        /// <summary>
        /// Creates a new SceneLayer object for the given scene.
        /// </summary>
        /// <param name="name">The name of the layer.</param>
        /// <param name="parentScene">Parent scene.</param>
        internal SceneLayer(string name, Scene parentScene)
        {
            m_name  = name;
            m_scene = parentScene;

            //Create list holding all information for individual views
            m_viewSubsets = new IndexBasedDynamicCollection <ViewRelatedSceneLayerSubset>();

            //Create standard collections
            m_sceneObjects       = new List <SceneObject>();
            m_sceneObjectsPublic = new ReadOnlyCollection <SceneObject>(m_sceneObjects);

            //Create specialized collections
            m_sceneObjectsSpacial             = new List <SceneSpacialObject>(1024);
            m_sceneObjectsNotSpacial          = new List <SceneObject>(1024);
            m_sceneObjectsNotStatic           = new List <SceneObject>(1024);
            m_sceneObjectsForSingleUpdateCall = new Queue <SceneObject>(1024);

            this.AllowPick                      = true;
            this.IsRenderingEnabled             = true;
            this.ClearDepthBufferAfterRendering = false;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="VisibilityCheckData"/> class.
 /// </summary>
 internal VisibilityCheckData()
 {
     FilterStageData = new IndexBasedDynamicCollection <VisibilityCheckFilterStageData>();
 }
Beispiel #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WireObject" /> class.
 /// </summary>
 public WirePainterHostObject()
 {
     m_localResources = new IndexBasedDynamicCollection <LineRenderResources>();
 }
Beispiel #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WireObject" /> class.
 /// </summary>
 public WireObject()
 {
     m_lineColor      = Color4.Black;
     m_localResources = new IndexBasedDynamicCollection <LocalResourceData>();
 }
Beispiel #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Skybox"/> class.
 /// </summary>
 public Skybox(NamedOrGenericKey cubeTextureKey)
 {
     _localResources     = new IndexBasedDynamicCollection <SkyboxLocalResources>();
     this.CubeTextureKey = cubeTextureKey;
 }
Beispiel #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SkyboxObject"/> class.
 /// </summary>
 public SkyboxObject(NamedOrGenericKey cubeTextureKey)
 {
     m_localResources = new IndexBasedDynamicCollection <SkyboxLocalResources>();
     m_cubeTextureKey = cubeTextureKey;
 }