Esempio n. 1
0
    public static UIID Generate(CullSettings cullSettings = CullSettings.NoCullNoClear)
    {
        UIID created = new UIID(NEXT, cullSettings);

        ++NEXT;

        return(created);
    }
Esempio n. 2
0
        protected override void CreateOSGWindow()
        {
            base.CreateOSGWindow();

            //ScreenCaptureHandler screenCaptureHandler = new ScreenCaptureHandler(new ScreenCaptureHandler.WriteToFile("Frame", "png", ScreenCaptureHandler.WriteToFile.SavePolicy.SEQUENTIAL_NUMBER), -1);
            //StatsHandler statsHandler = new StatsHandler();
            WindowSizeHandler windowSizeHandler = new WindowSizeHandler();

            osgViewer_View view   = this.Viewer.asOsgViewerView();
            Camera         camera = view.getCamera();

            view.addEventHandler(windowSizeHandler);

            this.osgObjects.Add(windowSizeHandler);

            camera.setClearColor(new Vec4f(0f, 0f, 0f, 1));

            CullSettings cullSettings = camera.asCullSettings();

            cullSettings.setComputeNearFarMode(CullSettings.ComputeNearFarMode.DO_NOT_COMPUTE_NEAR_FAR);
            //cullSettings.setNearFarRatio(0.00002);
            //cullSettings.setNearFarRatio(0.0001);
            //cullSettings.setSmallFeatureCullingPixelSize(-1.0f);

            DepthPartitionSettings dps = new DepthPartitionSettings(DepthPartitionSettings.DepthMode.FIXED_RANGE);

            dps._zNear = 1.0; // 0.1
            dps._zMid  = 1e4; // 500 / 10
            dps._zFar  = 2e8; // 20000 / 5000
            view.setUpDepthPartition(dps);

            // NOTA: no funciona correctamente con los shaders.
            if (!OSGUtils.UseShaders)
            {
                LogarithmicDepthBuffer buf = new LogarithmicDepthBuffer();
                buf.install(camera);
            }

            // Se eliminan todas las luces.
            view.setLightingMode(osg.View.LightingMode.NO_LIGHT);
            view.setLight(null);

            //EarthManipulator manipulator = new EarthManipulator();
            //manipulator.setViewpoint(new Viewpoint(-71.0763, 42.34425, 0, 24.261, -21.6, 3450.0), 5.0);
            //this.Vista.OsgManipulator = manipulator;

            /*// Se establece el manipulador por defecto: tipo trackball.
             * TrackballManipulator manipulator = new MyTrackballManipulator();
             * manipulator.setHomePosition(new Vec3d(-50, 0, 2), new Vec3d(0, 0, 0), new Vec3d(0, 0, 1));
             * manipulator.setTransformation(new Vec3d(-50, 0, 2), new Vec3d(0, 0, 0), new Vec3d(0, 0, 1));
             * //manipulator.home(0);
             * //manipulator.setAutoComputeHomePosition(true);
             * manipulator.setAllowThrow(false);
             * manipulator.setVerticalAxisFixed(true);
             * manipulator.setTrackballSize(1);
             *
             * this.Manipulator = manipulator;*/
        }
Esempio n. 3
0
    void DoCullingMode()
    {
        MaterialProperty type = FindProperty("_Cull");
        CullingMode      mode = (CullingMode)type.floatValue;

        EditorGUI.BeginChangeCheck();
        mode = (CullingMode)EditorGUILayout.EnumPopup(
            MakeLabel("Culling Mode"), mode);
        if (EditorGUI.EndChangeCheck())
        {
            RecordAction("Culling Mode");

            CullSettings settings = CullSettings.modes[(int)mode];
            foreach (Material m in editor.targets)
            {
                m.SetInt("_Cull", (int)settings.cull);
            }
        }
    }
Esempio n. 4
0
 private UIID(long id, CullSettings cullSettings)
 {
     _id           = id;
     _cullSettings = cullSettings;
 }
Esempio n. 5
0
        public UIHandler <UI> Attach <UI>(Loader <UI> loader, int requiredSortOrders, ParamSet setupParams = null, CullSettings cullSettings = CullSettings.NoCullNoClear) where UI : UIView
        {
            ActivateLayerIfNeed();

            UIID newId = UIID.Generate(cullSettings);

            _uiHeap.Add(newId);

            int nextSort = _currentSort + requiredSortOrders;

            return(new UIHandler <UI>(loader, this, newId, _currentSort, nextSort, setupParams)
                   .Exec(ActivateCanvasIfNeeded)
                   .Exec(AttachToCanvas));
        }
Esempio n. 6
0
        public UIHandler <UI> Attach <UI>(Loader <UI> loader, int requiredSortOrders, ParamSet setupParams = null, CullSettings cullSettings = CullSettings.NoCullNoClear) where UI : UIView
        {
            CheckAndInitializeChildUIManagement();

            UIID newId = UIID.Generate(cullSettings);

            _managedUIsSetupParams.Add(newId, setupParams);

            int minSort = GetMinSortForChildUI();
            int maxSort = minSort + requiredSortOrders;

            UpdateMinSortForNextChildUI(maxSort);

            UIHandler <UI> handler = new UIHandler <UI>(loader, this, newId, minSort, maxSort, setupParams)
                                     .Exec(SetParent);

            _managedUIs.Add(newId, handler);

            return(handler);
        }
Esempio n. 7
0
        public UIHandler <UI> Attach <UI>(Loader <UI> loader, UISortingLayer.Layers uiLayer, int requiredSortOrders, ParamSet setupParams = null, CullSettings cullSettings = CullSettings.NoCullNoClear) where UI : UIView
        {
            if (_layers.ContainsKey(uiLayer))
            {
                UIHandler <UI> handler = _layers[uiLayer].Attach <UI>(loader, requiredSortOrders, setupParams, cullSettings);

                _uiToLayerMap.Add(handler.id, uiLayer);

                UpdateCameraRenderSettings(handler.id);
                CheckAndCullLowerUIs(handler.id);

                if (IsOnTopActiveLayer(handler.id))
                {
                    _layers[_uiToLayerMap[handler.id]].ShowLayer();
                }

                return(handler);
            }
            else
            {
                throw new UILayerNotFoundException(string.Format("UIManager: Couldn't find UI layer {0}", uiLayer));
            }
        }
Esempio n. 8
0
 public UIHandler <UI> Attach <UI>(Loader <UI> loader, int requiredSortOrders, ParamSet setupParams = null, CullSettings cullSettings = CullSettings.NoCullNoClear) where UI : UIView
 {
     return(Attach <UI>(loader, UISortingLayer.Layers.Default, requiredSortOrders, setupParams, cullSettings));
 }
Esempio n. 9
0
 public SkyboxMaterial(UnityEngine.Material source) :
     base(source)
 {
     texture      = ResourceCache.Instance.GetTexture(source.GetTexture("_Tex"));
     cullSettings = new CullSettings();
 }