Esempio n. 1
0
 /// <summary>
 /// Constructor initialising the persistent and transient caches.
 /// </summary>
 public ShapeHandler(CategoryCheckDelegate categoryCheck)
     : base(categoryCheck)
 {
     _transientCache = new TransientShapeCache();
     _shapeCache     = new ShapeCache();
     _root           = new GameObject();
 }
Esempio n. 2
0
 /// <summary>
 /// Create a message handler with the given delegate to assign to <see cref="CategoryCheck"/>.
 /// </summary>
 /// <param name="categoryCheck">The delegate to invoke for category enable checks.</param>
 public MessageHandler(CategoryCheckDelegate categoryCheck)
 {
     CategoryCheck = categoryCheck;
     if (CategoryCheck == null)
     {
         CategoryCheck = CheckTrue;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Create a new handler.
 /// </summary>
 /// <param name="categoryCheck"></param>
 public Text2DHandler(CategoryCheckDelegate categoryCheck)
     : base(categoryCheck)
 {
     Root       = new GameObject(Name);
     Persistent = new GameObject("Persistent " + Name);
     Persistent.AddComponent <Text2DManager>();
     Persistent.transform.SetParent(Root.transform, false);
     Transient = new GameObject("Transient " + Name);
     Transient.AddComponent <Text2DManager>();
     Transient.transform.SetParent(Root.transform, false);
 }
Esempio n. 4
0
    protected override void Start()
    {
        base.Start();

        Materials.Register(MaterialLibrary.VertexColourLit, VertexColourLitMaterial);
        Materials.Register(MaterialLibrary.VertexColourUnlit, VertexColourUnlitMaterial);
        Materials.Register(MaterialLibrary.VertexColourLitTwoSided, VertexColourLitTwoSidedMaterial);
        Materials.Register(MaterialLibrary.VertexColourUnlitTwoSided, VertexColourUnlitTwoSidedMaterial);
        Materials.Register(MaterialLibrary.WireframeTriangles, WireframeTriangles);
        Materials.Register(MaterialLibrary.VertexColourTransparent, VertexColourTransparent);
        Materials.Register(MaterialLibrary.PointsLit, PointsLitMaterial);
        Materials.Register(MaterialLibrary.PointsUnlit, PointsUnlitMaterial);
        Materials.Register(MaterialLibrary.Voxels, VoxelsMaterial);

        if (Scene != null && Scene.Root != null)
        {
            Scene.Root.transform.parent = this.transform;
        }

        CategoriesHandler categories = new CategoriesHandler();
        MeshCache         meshCache  = new MeshCache();

        Handlers.Register(meshCache);
        Handlers.Register(categories);

        Handlers.Register(new CameraHandler(categories.IsActive));

        Handlers.Register(new ArrowHandler(categories.IsActive));
        Handlers.Register(new BoxHandler(categories.IsActive));
        Handlers.Register(new CapsuleHandler(categories.IsActive));
        Handlers.Register(new ConeHandler(categories.IsActive));
        Handlers.Register(new CylinderHandler(categories.IsActive));
        Handlers.Register(new PlaneHandler(categories.IsActive));
        Handlers.Register(new SphereHandler(categories.IsActive));
        Handlers.Register(new StarHandler(categories.IsActive));
        Handlers.Register(new MeshHandler(categories.IsActive));
        Handlers.Register(new MeshSetHandler(categories.IsActive, meshCache));
        Handlers.Register(new PointCloudHandler(categories.IsActive, meshCache));
        Handlers.Register(new Text2DHandler(categories.IsActive));
        Handlers.Register(new Text3DHandler(categories.IsActive));

        // Register handlers from plugins.
        string[] loadPaths = new string[]
        {
#if UNITY_EDITOR
            Path.Combine("Assets", "plugins")
#else  // UNITY_EDITOR
            "plugins",
            Path.Combine("3rd-Eye-Scene_Data", "Managed")
#endif // UNITY_EDITOR
        };

        CategoryCheckDelegate catDelegate = categories.IsActive;
        foreach (string loadPath in loadPaths)
        {
            Handlers.LoadPlugins(loadPath, Plugins, "3esRuntime.dll", new object[] { catDelegate });
        }

        InitialiseHandlers();

        categories.OnActivationChange += (ushort categoryId, bool active) =>
        {
            foreach (MessageHandler handler in Handlers.Handlers)
            {
                handler.OnCategoryChange(categoryId, active);
            }
        };

        LoadCommandLineFile();
    }
Esempio n. 5
0
 /// <summary>
 /// Constructor initialising the persistent and transient caches.
 /// </summary>
 public CameraHandler(CategoryCheckDelegate categoryCheck)
     : base(categoryCheck)
 {
     _root.name = Name;
 }