示例#1
0
        //void UpdateSweepHullGeometry( Vector3[] shapeLocalVertices )
        //{
        //	var target = ConvexSweepTarget.Value;

        //	var tr = Transform.Value;
        //	var from = tr.ToMatrix4( true, true, false );
        //	var to = target.Transform.Value.ToMatrix4( true, false, false );

        //	var hullPositions = new Vector3[ shapeLocalVertices.Length * 2 ];
        //	for( int i = 0; i < shapeLocalVertices.Length; i++ )
        //	{
        //		Matrix4.Multiply( ref from, ref shapeLocalVertices[ i ], out hullPositions[ i ] );
        //		Matrix4.Multiply( ref to, ref shapeLocalVertices[ i ], out hullPositions[ i + shapeLocalVertices.Length ] );
        //	}

        //	ConvexHullAlgorithm.Create( hullPositions, out hullVertices, out hullIndices, out hullPlanes );
        //}

        //void UpdateConvexSweepHull()
        //{
        //	var target = ConvexSweepTarget.Value;
        //	if( target != null )
        //	{
        //		var tr = Transform.Value;
        //		var from = tr.ToMatrix4();
        //		var to = target.Transform.Value.ToMatrix4();
        //		var shape = Shape.Value;

        //		var update = hullVertices == null || !hullFrom.Equals( from, .000001 ) || !hullTo.Equals( to, .000001 ) || hullShape != shape;
        //		if( update )
        //		{
        //			hullFrom = from;
        //			hullTo = to;
        //			hullShape = shape;

        //			if( shape == ShapeEnum.Box )
        //			{
        //				var boxLocalVertices = new Bounds( tr.Scale * -.5, tr.Scale * .5 ).ToPoints();
        //				UpdateSweepHullGeometry( boxLocalVertices );
        //			}
        //			else if( shape == ShapeEnum.Sphere )
        //			{
        //				var radius = Math.Max( tr.Scale.X, Math.Max( tr.Scale.Y, tr.Scale.Z ) ) * 0.5;
        //				//!!!!12
        //				SimpleMeshGenerator.GenerateSphere( radius, 12, 12, false, out Vector3[] sphereLocalVertices, out _ );
        //				UpdateSweepHullGeometry( sphereLocalVertices );
        //			}
        //		}
        //	}
        //	else
        //	{
        //		hullVertices = null;
        //		hullIndices = null;
        //		hullPlanes = null;
        //	}
        //}

        ResultItem[] CalculateObjects_ObjectsInSpace()
        {
            var scene = ParentScene;

            if (scene != null)
            {
                switch (Shape.Value)
                {
                case ShapeEnum.Box:
                {
                    var item = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, false, GetBoxExtendedZ());
                    scene.GetObjectsInSpace(item);

                    if (item.Result.Length != 0)
                    {
                        var result = new List <ResultItem>(item.Result.Length);

                        for (int n = 0; n < item.Result.Length; n++)
                        {
                            ref var resultItem2 = ref item.Result[n];

                            var resultItem = new ResultItem(resultItem2.Object, null, 0);

                            bool ignore = false;
                            PerformFilterObject(resultItem, ref ignore);
                            if (ignore)
                            {
                                continue;
                            }

                            result.Add(resultItem);

                            if (Mode.Value == ModeEnum.OneClosestObject)
                            {
                                break;
                            }
                        }

                        return(result.ToArray());
                    }
                }
                break;
示例#2
0
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            //if( WhenUpdate.Value.HasFlag( WhenUpdateEnum.Render ) )
            //	Update();

            if (EnabledInHierarchy && VisibleInHierarchy && mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var context2 = context.objectInSpaceRenderingContext;

                bool show = (ParentScene.GetDisplayDevelopmentDataInThisApplication() && ParentScene.DisplaySensors) || context2.selectedObjects.Contains(this) || context2.canSelectObjects.Contains(this) || context2.objectToCreate == this;
                if (show)
                {
                    if (context2.displaySensorsCounter < context2.displaySensorsMax)
                    {
                        context2.displaySensorsCounter++;

                        ColorValue color;
                        if (context2.selectedObjects.Contains(this))
                        {
                            color = ProjectSettings.Get.SelectedColor;
                        }
                        else if (context2.canSelectObjects.Contains(this))
                        {
                            color = ProjectSettings.Get.CanSelectColor;
                        }
                        else
                        {
                            color = DisplayColor.Value;
                        }

                        if (color.Alpha != 0)
                        {
                            context.Owner.Simple3DRenderer.SetColor(color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier);
                            RenderShape(context2);
                        }
                    }

                    if (DisplayObjects)
                    {
                        var color = DisplayObjectsColor.Value;
                        if (color.Alpha != 0)
                        {
                            context.Owner.Simple3DRenderer.SetColor(color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier);
                            //foreach( var refObject in Objects )
                            //{
                            //	var obj = refObject.Value;
                            //	if( obj != null && obj.EnabledInHierarchy )
                            //		context.viewport.Simple3DRenderer.AddBounds( obj.SpaceBounds.CalculatedBoundingBox );
                            //}

                            foreach (var item in CalculateObjects())
                            {
                                RenderItem(context.Owner.Simple3DRenderer, item);
                            }
                        }
                    }
                }
            }
        }
        //!!!!подобное для Brush режима
        //public delegate void CalculateCreateObjectPositionUnderCursorEventDelegate( Component_ObjectInSpace objectInSpace, ref bool found, ref Vector3 position );
        //public static event CalculateCreateObjectPositionUnderCursorEventDelegate CalculateCreateObjectPositionUnderCursorEvent;

        //public class CalculateCreateObjectPositionByRayResult
        //{
        //	public bool Found;
        //	public Vector3 Position;
        //	public Component_ObjectInSpace CollidedWith;
        //	public Vector3F Normal;
        //}

        public static (bool found, Vector3 position, Component_ObjectInSpace collidedWith) CalculateCreateObjectPositionByRay(Component_Scene scene, Component_ObjectInSpace objectInSpace, Ray ray, bool allowSnap)
        {
            //var viewport = ViewportControl.Viewport;

            //Vector2 mouse;
            //if( overrideMouse.HasValue )
            //	mouse = overrideMouse.Value;
            //else
            //{
            //	mouse = viewport.MousePosition;
            //	if( !new Rectangle( 0, 0, 1, 1 ).Contains( mouse ) )
            //		mouse = new Vector2( 0.5, 0.5 );
            //}

            //Ray ray;
            //if( overrideRay.HasValue )
            //	ray = overrideRay.Value;
            //else
            //	ray = viewport.CameraSettings.GetRayByScreenCoordinates( mouse );
            //!!!!? clamp max distance
            //ray.Direction = ray.Direction.GetNormalize() * 100;

            //!!!!можно конвекс форму делать вместо бокса
            Bounds localBounds = new Bounds();

            if (objectInSpace != null)
            {
                //particle system specific
                if (!(objectInSpace is Component_ParticleSystemInSpace))
                {
                    localBounds = objectInSpace.SpaceBounds.CalculatedBoundingBox - objectInSpace.Transform.Value.Position;
                }
            }
            if (localBounds.GetSize().X < 0.001)
            {
                localBounds.Expand(new Vector3(0.001, 0, 0));
            }
            if (localBounds.GetSize().Y < 0.001)
            {
                localBounds.Expand(new Vector3(0, 0.001, 0));
            }
            if (localBounds.GetSize().Z < 0.001)
            {
                localBounds.Expand(new Vector3(0, 0, 0.001));
            }

            double resultMinScale = 1.01;
            Component_ObjectInSpace resultMinScaleCollidedWith = null;

            if (objectInSpace != null)
            {
                //when objectInSpace != null

                Plane[] planes;
                {
                    var b1     = localBounds + ray.Origin;
                    var b2     = b1 + ray.Direction;
                    var points = CollectionUtility.Merge(b1.ToPoints(), b2.ToPoints());
                    ConvexHullAlgorithm.Create(points, out planes);
                }

                var item = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, true, planes);
                scene.GetObjectsInSpace(item);

                foreach (var resultItem in item.Result)
                {
                    if (objectInSpace != resultItem.Object && !resultItem.Object.GetAllParents(false).Contains(objectInSpace))
                    {
                        //mesh in space
                        if (resultItem.Object is Component_MeshInSpace meshInSpace)
                        {
                            Vector3[] verticesFull;
                            int[]     indices;
                            {
                                var b1     = localBounds + ray.Origin;
                                var b2     = b1 + ray.Direction;
                                var points = CollectionUtility.Merge(b1.ToPoints(), b2.ToPoints());
                                ConvexHullAlgorithm.Create(points, out verticesFull, out indices);
                            }

                            if (meshInSpace._Intersects(verticesFull, indices))
                            {
                                double minScale = 1.01;

                                double currentScale = 0.5;
                                //!!!!?
                                const double threshold = 0.00001;

                                double step = 0.25;
                                while (step > threshold)
                                {
                                    Vector3[] vertices = new Vector3[verticesFull.Length];
                                    for (int n = 0; n < vertices.Length; n++)
                                    {
                                        vertices[n] = verticesFull[n] - ray.Direction + ray.Direction * currentScale;
                                    }
                                    //Vector3[] vertices;
                                    //int[] indices;
                                    //{
                                    //	var b1 = localBounds + ray.Origin;
                                    //	var b2 = b1 + ray.Direction * currentScale;
                                    //	var points = CollectionUtility.Merge( b1.ToPoints(), b2.ToPoints() );
                                    //	ConvexHullAlgorithm.Create( points, out vertices, out indices );
                                    //}

                                    bool intersects = meshInSpace._Intersects(vertices, indices);

                                    if (!intersects)
                                    {
                                        minScale = currentScale;
                                    }

                                    if (intersects)
                                    {
                                        currentScale -= step;
                                    }
                                    else
                                    {
                                        currentScale += step;
                                    }
                                    step /= 2;
                                }

                                if (minScale <= 1 && minScale < resultMinScale)
                                {
                                    resultMinScale             = minScale;
                                    resultMinScaleCollidedWith = meshInSpace;
                                }
                            }
                        }

                        //!!!!какие еще
                    }
                }
            }
            else
            {
                //when objectInSpace == null

                var item = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, true, ray);
                scene.GetObjectsInSpace(item);

                foreach (var resultItem in item.Result)
                {
                    //mesh in space
                    if (resultItem.Object is Component_MeshInSpace meshInSpace)
                    {
                        if (meshInSpace.RayCast(ray, Component_Mesh.CompiledData.RayCastMode.Auto, out var scale, out var triangleIndex))
                        {
                            if (scale <= 1 && scale < resultMinScale)
                            {
                                resultMinScale             = scale;
                                resultMinScaleCollidedWith = meshInSpace;
                                //if( triangleIndex != -1 )
                                //{
                                //}
                            }
                        }
                    }

                    //!!!!какие еще
                }
            }

            bool    found;
            Vector3 pos;

            if (resultMinScale <= 1)
            {
                found = true;
                pos   = ray.GetPointOnRay(resultMinScale);
            }
            else
            {
                found = false;
                pos   = ray.Origin + ray.Direction.GetNormalize() * Math.Max(localBounds.GetBoundingSphere().Radius, 1) * 20;
            }

            //snap for 2D mode
            if (scene.Mode.Value == Component_Scene.ModeEnum._2D)
            {
                pos.Z = Math.Ceiling(pos.Z);
            }

            //snap
            if (allowSnap)
            {
                double snap;

                //if( Form.ModifierKeys.HasFlag( Keys.Control ) )
                snap = ProjectSettings.Get.SceneEditorStepMovement;
                //else
                //	snap = 0;
                if (snap != 0)
                {
                    Vector3 snapVec = new Vector3(snap, snap, snap);
                    pos += snapVec / 2;
                    pos /= snapVec;
                    pos  = new Vector3I((int)pos.X, (int)pos.Y, (int)pos.Z).ToVector3();
                    pos *= snapVec;
                }
            }

            //CalculateCreateObjectPositionUnderCursorEvent?.Invoke( objectInSpace, ref found, ref pos );

            return(found, pos, resultMinScaleCollidedWith);
            //objectToTransform.Transform = new Transform( pos, objectToTransform.Transform.Value.Rotation, objectToTransform.Transform.Value.Scale );
            //}
            //else
            //{
            //	var localBounds = objectInSpace.SpaceBounds.CalculatedBoundingBox - objectInSpace.Transform.Value.Position;

            //	//disable object to disable collisions
            //	var disable = ContainsPhysicsBodies( objectInSpace );
            //	if( disable )
            //		objectInSpace.Enabled = false;

            //	//!!!!contact group
            //	PhysicsConvexSweepTestItem castItem = new PhysicsConvexSweepTestItem( Matrix4.FromTranslate( ray.Origin ),
            //		Matrix4.FromTranslate( ray.Origin + ray.Direction ), 1, -1, PhysicsConvexSweepTestItem.ModeEnum.OneClosest, localBounds );
            //	Scene.PhysicsConvexSweepTest( new PhysicsConvexSweepTestItem[] { castItem } );

            //	//restore disabled object
            //	if( disable )
            //		objectInSpace.Enabled = true;

            //	Vector3 pos;
            //	if( castItem.Result.Length != 0 )
            //		pos = castItem.Result[ 0 ].Position;
            //	else
            //	{
            //		pos = ray.Origin + ray.Direction.GetNormalize() * Math.Max( localBounds.GetBoundingSphere().Radius, 1 ) * 20;
            //	}

            //	objectInSpace.Transform = new Transform( pos, objectInSpace.Transform.Value.Rotation, objectInSpace.Transform.Value.Scale );
            //}
        }
示例#4
0
        /////////////////////////////////////////

        public void GetObjects(IList <GetObjectsItem> items)
        {
            if (items.Count == 0)
            {
                return;
            }

            var scene = FindParent <Component_Scene>();

            if (scene == null)
            {
                for (int nItem = 0; nItem < items.Count; nItem++)
                {
                    items[nItem].Result = Array.Empty <GetObjectsItem.ResultItem>();
                }
                return;
            }

            //!!!!маски использовать для выбора из octree
            //!!!!!!или сделать "Component_ObjectInSpace_GroupOfObjects"
            var objectInSpaceType = MetadataManager.GetTypeOfNetType(typeof(Component_ObjectInSpace));

            //!!!!Parallel

            for (int nItem = 0; nItem < items.Count; nItem++)
            {
                var item = items[nItem];

                var getObjectsInSpaceItem = new Component_Scene.GetObjectsInSpaceItem();
                getObjectsInSpaceItem.CastType         = Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All;
                getObjectsInSpaceItem.SelectedTypeOnly = objectInSpaceType;
                getObjectsInSpaceItem.VisibleOnly      = false;
                getObjectsInSpaceItem.Bounds           = item.Bounds;
                getObjectsInSpaceItem.Sphere           = item.Sphere;
                getObjectsInSpaceItem.Box     = item.Box;
                getObjectsInSpaceItem.Planes  = item.Planes;
                getObjectsInSpaceItem.Frustum = item.Frustum;
                getObjectsInSpaceItem.Ray     = item.Ray;

                scene.GetObjectsInSpace(getObjectsInSpaceItem);

                //!!!!256
                var list = new List <GetObjectsItem.ResultItem>(256);

                for (int nResultItem = 0; nResultItem < getObjectsInSpaceItem.Result.Length; nResultItem++)
                {
                    ref var resultItem = ref getObjectsInSpaceItem.Result[nResultItem];

                    var sector = resultItem.Object.AnyData as Sector;
                    if (sector != null && sector.owner == this)
                    {
                        //!!!!может поделить только на int[] и для луча
                        //!!!!!!для GetObjctsInSpace которые для _ObjectInSpace тоже?

                        foreach (var index in sector.Objects)
                        {
                            var item2 = new GetObjectsItem.ResultItem();
                            item2.Object = index;
                            //item2.Position = xxx;
                            list.Add(item2);

                            if (item.CastType == GetObjectsItem.CastTypeEnum.One)
                            {
                                goto end;
                            }
                        }

                        //!!!!

                        //item.Result

                        //public struct ResultItem
                        //{
                        //	public int Object;
                        //	public Vector3? Position;
                        //	public double DistanceScale;
                        //}
                    }
                }

                end :;
                //!!!!
                item.Result = list.ToArray();
            }
示例#5
0
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            if (EnabledInHierarchy && VisibleInHierarchy)
            {
                var item = new Component_RenderingPipeline.RenderSceneData.CutVolumeItem();
                item.Shape = Shape;

                switch (item.Shape)
                {
                case ShapeEnum.Box:
                    item.Transform = Transform;
                    break;

                case ShapeEnum.Sphere:
                {
                    var sphere = GetSphere();
                    var scl    = sphere.Radius * 2;
                    item.Transform = new Transform(sphere.Origin, Quaternion.Identity, new Vector3(scl, scl, scl));
                }
                break;

                case ShapeEnum.Cylinder:
                {
                    var tr    = Transform.Value;
                    var sclYZ = Math.Max(tr.Scale.Y, tr.Scale.Z);
                    item.Transform = new Transform(tr.Position, tr.Rotation, new Vector3(tr.Scale.X, sclYZ, sclYZ));
                }
                break;

                    //!!!!Plane
                }

                context.FrameData.RenderSceneData.CutVolumes.Add(item);
            }

            if (EnabledInHierarchy && VisibleInHierarchy && mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var context2 = context.objectInSpaceRenderingContext;

                bool show = (ParentScene.GetDisplayDevelopmentDataInThisApplication() && ParentScene.DisplayVolumes) || context2.selectedObjects.Contains(this) || context2.canSelectObjects.Contains(this) || context2.objectToCreate == this;
                if (show)
                {
                    //if( context2.displayVolumesCounter < context2.displayVolumesMax )
                    //{
                    //	context2.displayVolumesCounter++;

                    ColorValue color;
                    if (context2.selectedObjects.Contains(this))
                    {
                        color = ProjectSettings.Get.SelectedColor;
                    }
                    else if (context2.canSelectObjects.Contains(this))
                    {
                        color = ProjectSettings.Get.CanSelectColor;
                    }
                    else
                    {
                        color = ProjectSettings.Get.SceneShowVolumeColor;
                    }

                    if (color.Alpha != 0)
                    {
                        context.Owner.Simple3DRenderer.SetColor(color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier);
                        RenderShape(context2);
                    }

                    //}
                }
            }
        }
示例#6
0
        public virtual IComponent_InteractiveObject PickInteractiveObject(UIControl playScreen, Viewport viewport)
        {
            IComponent_InteractiveObject result = null;

            PickInteractiveObjectEvent?.Invoke(this, playScreen, viewport, ref result);

            if (!FreeCamera)
            {
                //pick for 3D
                if (Scene.Mode.Value == Component_Scene.ModeEnum._3D)
                {
                    if (UseBuiltInCamera.Value == BuiltInCameraEnum.FirstPerson || UseBuiltInCamera.Value == BuiltInCameraEnum.ThirdPerson)
                    {
                        Ray ray;
                        {
                            double rayDistance = UseBuiltInCamera.Value == BuiltInCameraEnum.FirstPerson ? 2.5 : 10;
                            //scaling
                            {
                                var obj = ObjectControlledByPlayer.Value as Component_ObjectInSpace;
                                if (obj != null)
                                {
                                    rayDistance *= obj.TransformV.Scale.MaxComponent();
                                }
                            }

                            ray           = viewport.CameraSettings.GetRayByScreenCoordinates(new Vector2(0.5, 0.5));
                            ray.Direction = ray.Direction.GetNormalize() * rayDistance;
                        }

                        var getObjectsItem = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, true, ray);
                        Scene.GetObjectsInSpace(getObjectsItem);

                        foreach (var item in getObjectsItem.Result)
                        {
                            var obj = item.Object.FindThisOrParent <IComponent_InteractiveObject>();
                            if (obj != null)
                            {
                                if (GetInteractiveObjectInfo(playScreen, obj).AllowInteract)
                                {
                                    result = obj;
                                }
                            }
                        }
                    }
                }

                //pick for 2D
                if (Scene.Mode.Value == Component_Scene.ModeEnum._2D)
                {
                    if (UseBuiltInCamera.Value == BuiltInCameraEnum.None || UseBuiltInCamera.Value == BuiltInCameraEnum.ThirdPerson)
                    {
                        var character = ObjectControlledByPlayer.Value as Component_Character2D;
                        if (character != null)
                        {
                            double maxDistance = 2.0;
                            //scaling
                            {
                                var obj = ObjectControlledByPlayer.Value as Component_ObjectInSpace;
                                if (obj != null)
                                {
                                    maxDistance *= obj.TransformV.Scale.MaxComponent();
                                }
                            }

                            var bounds = new Bounds(character.TransformV.Position);
                            bounds.Expand(new Vector3(maxDistance, maxDistance, 10000));

                            var getObjectsItem = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, true, bounds);
                            Scene.GetObjectsInSpace(getObjectsItem);

                            foreach (var item in getObjectsItem.Result)
                            {
                                var obj = item.Object.FindThisOrParent <IComponent_InteractiveObject>();
                                if (obj != null)
                                {
                                    var objectInSpace = obj as Component_ObjectInSpace;
                                    if (objectInSpace != null)
                                    {
                                        var distance = (objectInSpace.TransformV.Position - character.TransformV.Position).Length();
                                        if (distance <= maxDistance)
                                        {
                                            if (GetInteractiveObjectInfo(playScreen, obj).AllowInteract)
                                            {
                                                result = obj;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            //Component_CameraManagement
            var m = GetCurrentCameraManagement();

            if (m != null)
            {
                result = m.PickInteractiveObject(this, playScreen, viewport);
            }

            return(result);
        }
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            if (mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var context2 = context.objectInSpaceRenderingContext;

                if (!ParentScene.GetDisplayDevelopmentDataInThisApplication())
                {
                    context2.disableShowingLabelForThisObject = true;
                }
            }
        }
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            if (EnabledInHierarchy && VisibleInHierarchy && mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var context2 = context.objectInSpaceRenderingContext;

                bool show = (context2.selectedObjects.Contains(this) || context2.canSelectObjects.Contains(this) || context2.objectToCreate == this) || AlwaysDisplayBulletInitialPosition;
                if (show)
                {
                    var renderer = context.Owner.Simple3DRenderer;

                    var tr  = GetBulletWorldInitialTransform();
                    var ray = new Ray(tr.Position, tr.Rotation.GetForward() * 0.1);

                    renderer.SetColor(new ColorValue(1, 0, 0));
                    renderer.AddArrow(ray.Origin, ray.GetEndPoint());
                }
            }
        }
示例#9
0
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            //if( EnabledInHierarchy && VisibleInHierarchy && mode == GetRenderSceneDataMode.InsideFrustum )
            {
                //display editor selection
                {
                    var context2 = context.objectInSpaceRenderingContext;

                    //bool show = ( ParentScene.GetDisplayDevelopmentDataInThisApplication() && ParentScene.DisplayAreas ) || context2.selectedObjects.Contains( this ) || context2.canSelectObjects.Contains( this ) || context2.dragDropCreateObject == this;
                    //if( show )
                    if (CheckNeedShowDevelopmentDataOfAreaAndPoints(context, mode))
                    {
                        var pointPositions = GetPointPositions();

                        //!!!!count limit

                        var viewport = context.Owner;
                        var renderer = viewport.Simple3DRenderer;
                        if (renderer != null)
                        {
                            ColorValue color;
                            if (context2.selectedObjects.Contains(this))
                            {
                                color = ProjectSettings.Get.SelectedColor;
                            }
                            else if (context2.canSelectObjects.Contains(this))
                            {
                                color = ProjectSettings.Get.CanSelectColor;
                            }
                            else
                            {
                                color = ProjectSettings.Get.SceneShowAreaColor;
                            }

                            renderer.SetColor(color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier);

                            for (int n = 0; n < pointPositions.Length; n++)
                            {
                                var from = pointPositions[n];
                                var to   = pointPositions[(n + 1) % pointPositions.Length];
                                renderer.AddLine(from, to);
                            }
                        }
                    }
                }
            }
        }
示例#10
0
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            if (EnabledInHierarchy && VisibleInHierarchy && mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var cameraSettings = context.Owner.CameraSettings;
                var tr             = Transform.Value;

                bool skip        = false;
                var  maxDistance = VisibilityDistance.Value;
                if (maxDistance < cameraSettings.FarClipDistance && (cameraSettings.Position - tr.Position).LengthSquared() > maxDistance * maxDistance)
                {
                    skip = true;
                }

                if (!skip)
                {
                    {
                        var item = new Component_RenderingPipeline.RenderSceneData.DecalItem();
                        item.Creator     = this;
                        item.BoundingBox = SpaceBounds.CalculatedBoundingBox;
                        //item.BoundingSphere = SpaceBounds.CalculatedBoundingSphere;

                        item.Position = tr.Position;
                        item.Rotation = tr.Rotation.ToQuaternionF();
                        item.Scale    = tr.Scale.ToVector3F();

                        item.Material    = Material;
                        item.Color       = Color;
                        item.NormalsMode = NormalsMode.Value;
                        item.SortOrder   = SortOrder;

                        item.VisibilityDistance = (float)maxDistance;

                        context.FrameData.RenderSceneData.Decals.Add(ref item);
                    }

                    //display editor selection
                    {
                        var context2 = context.objectInSpaceRenderingContext;

                        bool show = (ParentScene.GetDisplayDevelopmentDataInThisApplication() && ParentScene.DisplayDecals) || context2.selectedObjects.Contains(this) || context2.canSelectObjects.Contains(this) || context2.objectToCreate == this;
                        if (show)
                        {
                            if (context2.displayDecalsCounter < context2.displayDecalsMax)
                            {
                                context2.displayDecalsCounter++;

                                ColorValue color;
                                if (context2.selectedObjects.Contains(this))
                                {
                                    color = ProjectSettings.Get.SelectedColor;
                                }
                                else if (context2.canSelectObjects.Contains(this))
                                {
                                    color = ProjectSettings.Get.CanSelectColor;
                                }
                                else
                                {
                                    color = ProjectSettings.Get.SceneShowDecalColor;
                                }

                                var viewport = context.Owner;
                                if (viewport.Simple3DRenderer != null)
                                {
                                    viewport.Simple3DRenderer.SetColor(color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier);
                                    DebugDraw(viewport);
                                }
                            }
                        }
                        //if( !show )
                        //	context.disableShowingLabelForThisObject = true;
                    }
                }
            }
        }
示例#11
0
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            if (mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var context2 = context.objectInSpaceRenderingContext;

                if (EngineApp.ApplicationType != EngineApp.ApplicationTypeEnum.Simulation ||
                    EngineApp.ApplicationType == EngineApp.ApplicationTypeEnum.Simulation && DisplayInSimulation)
                {
                    var cameraPosition = context.Owner.CameraSettings.Position;
                    var sphere         = new Sphere(cameraPosition, VisibilityDistance);

                    if (SpaceBounds.CalculatedBoundingSphere.Intersects(ref sphere))
                    {
                        if (Step.Value >= 0)
                        {
                            Render(context2);
                        }
                    }
                }
            }
        }
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            //if( EnabledInHierarchyAndIsNotResource )
            //	Update();

            if (mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var context2 = context.objectInSpaceRenderingContext;

                bool show = (ParentScene.GetDisplayDevelopmentDataInThisApplication() && ParentScene.DisplaySoundSources) ||
                            context2.selectedObjects.Contains(this) || context2.canSelectObjects.Contains(this) || context2.objectToCreate == this;
                if (show)
                {
                    if (context2.displaySoundSourcesCounter < context2.displaySoundSourcesMax)
                    {
                        context2.displaySoundSourcesCounter++;

                        ColorValue color;
                        if (context2.selectedObjects.Contains(this))
                        {
                            color = ProjectSettings.Get.SelectedColor;
                        }
                        else if (context2.canSelectObjects.Contains(this))
                        {
                            color = ProjectSettings.Get.CanSelectColor;
                        }
                        else
                        {
                            color = ProjectSettings.Get.SceneShowSoundSourceColor;
                        }

                        var viewport = context.Owner;
                        viewport.Simple3DRenderer.SetColor(color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier);
                        DebugDraw(viewport);
                    }
                }
            }
        }
示例#13
0
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            if (mode == GetRenderSceneDataMode.InsideFrustum && context.Owner.CanvasRenderer != null && context.Owner.Simple3DRenderer != null)
            {
                var context2 = context.objectInSpaceRenderingContext;

                //render after PrepareListsOfObjects with sorting by camera distance from far to near
                var item = new Component_RenderingPipeline.RenderSceneData.ActionToDoAfterPrepareListsOfObjectsSortedByDistance();
                item.DistanceToCamera = (float)(Transform.Value.Position - context.Owner.CameraSettings.Position).Length();
                item.Action           = Render;
                context.FrameData.RenderSceneData.ActionsToDoAfterPrepareListsOfObjectsSortedByDistance.Add(item);
            }
        }
示例#14
0
 public static void PerformGetRenderSceneData(Component_ObjectInSpace obj, ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
 {
     obj.PerformGetRenderSceneData(context, mode, modeGetObjectsItem);
 }
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            var time = context.Owner.LastUpdateTime;

            if (time != transformPositionByTime1_Time)
            {
                transformPositionByTime2_Time     = transformPositionByTime1_Time;
                transformPositionByTime2_Position = transformPositionByTime1_Position;
                transformPositionByTime1_Time     = time;
                transformPositionByTime1_Position = TransformV.Position;
            }

            if (mode == GetRenderSceneDataMode.InsideFrustum || (mode == GetRenderSceneDataMode.ShadowCasterOutsideFrustum && CastShadows))
            {
                var size = Size.Value;
                //var color = Color.Value;
                //var opacity = Opacity.Value;
                //if( size != Vector2.Zero )//&& color.Alpha != 0 && opacity != 0 )
                //{

                var context2 = context.objectInSpaceRenderingContext;
                context2.disableShowingLabelForThisObject = true;

                var tr             = Transform.Value;
                var cameraSettings = context.Owner.CameraSettings;

                var cameraDistanceMinSquared = SceneLODUtility.GetCameraDistanceMinSquared(cameraSettings, SpaceBounds);
                var visibilityDistance       = VisibilityDistance.Value;

                if (cameraDistanceMinSquared < visibilityDistance * visibilityDistance || mode == GetRenderSceneDataMode.ShadowCasterOutsideFrustum)
                {
                    var allowOutlineSelect = context.renderingPipeline.UseRenderTargets && ProjectSettings.Get.SceneEditorSelectOutlineEffectEnabled;

                    var item = new Component_RenderingPipeline.RenderSceneData.BillboardItem();
                    item.Creator = this;
                    SpaceBounds.CalculatedBoundingBox.GetCenter(out item.BoundingBoxCenter);
                    item.BoundingSphere     = SpaceBounds.CalculatedBoundingSphere;
                    item.CastShadows        = CastShadows;
                    item.ShadowOffset       = (float)ShadowOffset.Value;
                    item.ReceiveDecals      = ReceiveDecals;
                    item.Material           = Material;
                    item.VisibilityDistance = (float)visibilityDistance;
                    item.CutVolumes         = CutVolumes;

                    var specialEffects = SpecialEffects.Value;
                    if (specialEffects != null && specialEffects.Count != 0)
                    {
                        item.SpecialEffects = specialEffects;
                    }

                    //display outline effect of editor selection
                    if (mode == GetRenderSceneDataMode.InsideFrustum && allowOutlineSelect && context2.selectedObjects.Contains(this))
                    {
                        if (context2.displayBillboardsCounter < context2.displayBillboardsMax)
                        {
                            context2.displayBillboardsCounter++;

                            var color = ProjectSettings.Get.SelectedColor.Value;
                            //color.Alpha *= .5f;

                            var effect = new ObjectSpecialRenderingEffect_Outline();
                            effect.Group = int.MaxValue;
                            effect.Color = color;

                            if (item.SpecialEffects != null)
                            {
                                item.SpecialEffects = new List <ObjectSpecialRenderingEffect>(item.SpecialEffects);
                            }
                            else
                            {
                                item.SpecialEffects = new List <ObjectSpecialRenderingEffect>();
                            }
                            item.SpecialEffects.Add(effect);
                        }
                    }

                    //!!!!double
                    item.Position = tr.Position.ToVector3F();
                    item.Size     = new Vector2(size.X * Math.Max(tr.Scale.X, tr.Scale.Y), size.Y * tr.Scale.Z).ToVector2F();
                    item.Rotation = Rotation.Value.InRadians().ToRadianF();
                    item.Color    = Color;

                    //PositionPreviousFrame
                    var previousTime = time - context.Owner.LastUpdateTimeStep;
                    if (!GetTransformPositionByTime(previousTime, out var previousPosition))
                    {
                        previousPosition = tr.Position;
                    }
                    item.PositionPreviousFrame = previousPosition.ToVector3F();

                    context.FrameData.RenderSceneData.Billboards.Add(ref item);


                    //display editor selection
                    if (mode == GetRenderSceneDataMode.InsideFrustum)
                    {
                        if ((!allowOutlineSelect && context2.selectedObjects.Contains(this)) || context2.canSelectObjects.Contains(this))                               // || context.dragDropCreateObject == this )
                        {
                            if (context2.displayBillboardsCounter < context2.displayBillboardsMax)
                            {
                                context2.displayBillboardsCounter++;

                                ColorValue color;
                                if (context2.selectedObjects.Contains(this))
                                {
                                    color = ProjectSettings.Get.SelectedColor;
                                }
                                else
                                {
                                    color = ProjectSettings.Get.CanSelectColor;
                                }
                                color.Alpha *= .5f;

                                var viewport = context.Owner;
                                if (viewport.Simple3DRenderer != null)
                                {
                                    viewport.Simple3DRenderer.SetColor(color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier);

                                    item.GetWorldMatrix(out var worldMatrix);

                                    //!!!!double
                                    worldMatrix.ToMatrix4(out var worldMatrix2);
                                    viewport.Simple3DRenderer.AddMesh(GetBillboardMesh().Result, ref worldMatrix2, false, false);
                                }
                            }
                        }
                    }
                }

                //}
            }
        }
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            if (mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var context2 = context.objectInSpaceRenderingContext;

                var showLabels = /*show &&*/ rigidBody == null;
                if (!showLabels)
                {
                    context2.disableShowingLabelForThisObject = true;
                }
            }
        }
示例#17
0
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            if (mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var context2 = context.objectInSpaceRenderingContext;

                //context.

                bool show = (ParentScene.GetDisplayDevelopmentDataInThisApplication() && ParentScene.DisplayCameras) ||
                            context2.selectedObjects.Contains(this) || context2.canSelectObjects.Contains(this) || context2.objectToCreate == this;
                if (show)
                {
                    var skip = false;

                    var cameraSettings = context.Owner.CameraSettings;
                    //!!!!
                    if ((cameraSettings.Position - TransformV.Position).Length() < 0.5)
                    {
                        skip = true;
                    }

                    if (!skip && context2.displayCamerasCounter < context2.displayCamerasMax)
                    {
                        context2.displayCamerasCounter++;

                        ColorValue color;
                        if (context2.selectedObjects.Contains(this))
                        {
                            color = ProjectSettings.Get.SelectedColor;
                        }
                        else if (context2.canSelectObjects.Contains(this))
                        {
                            color = ProjectSettings.Get.CanSelectColor;
                        }
                        else
                        {
                            color = ProjectSettings.Get.SceneShowLightColor;
                        }

                        var viewport = context.Owner;
                        viewport.Simple3DRenderer.SetColor(color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier);
                        DebugDraw(viewport);
                    }
                }
                //if( !show )
                //	context.disableShowingLabelForThisObject = true;
            }
        }
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            if (mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var context2 = context.objectInSpaceRenderingContext;

                if (!ParentScene.GetDisplayDevelopmentDataInThisApplication())
                {
                    context2.disableShowingLabelForThisObject = true;
                }

                var renderer = context.Owner.Simple3DRenderer;
                if (renderer != null)
                {
                    var start      = GetStartPosition();
                    var startScale = GetStartScale();
                    var end        = GetEndPosition();
                    var endScale   = GetEndScale();

                    if (end != start)
                    {
                        var center = (start + end) * 0.5;
                        var dir    = (end - start).GetNormalize();

                        //!!!!transparent rendering

                        renderer.SetColor(Color);

                        switch (StartCapStyle.Value)
                        {
                        case CapStyleEnum.Arrow:
                            renderer.AddArrow(center, start, Thickness * 5 * startScale, Thickness * 1.5 * startScale, true, Thickness);
                            break;

                        case CapStyleEnum.Flat:
                            renderer.AddLine(center - dir * Thickness * 0.5, start + dir * Thickness * 0.5, Thickness);
                            break;

                        case CapStyleEnum.Sphere:
                            renderer.AddLine(center - dir * Thickness * 0.5, start + dir * Thickness * 0.5, Thickness);
                            renderer.AddSphere(start, Thickness * 2 * startScale, solid: true);
                            break;
                        }

                        switch (EndCapStyle.Value)
                        {
                        case CapStyleEnum.Arrow:
                            renderer.AddArrow(center, end, Thickness * 5 * endScale, Thickness * 1.5 * endScale, true, Thickness);
                            break;

                        case CapStyleEnum.Flat:
                            renderer.AddLine(center + dir * Thickness * 0.5, end - dir * Thickness * 0.5, Thickness);
                            break;

                        case CapStyleEnum.Sphere:
                            renderer.AddLine(center + dir * Thickness * 0.5, end - dir * Thickness * 0.5, Thickness);
                            renderer.AddSphere(end, Thickness * 2 * endScale, solid: true);
                            break;
                        }
                    }
                }
            }
        }
示例#19
0
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            if (EnabledInHierarchy && VisibleInHierarchy)
            {
                var item = new Component_RenderingPipeline.RenderSceneData.TransparentRenderingAddOffsetWhenSortByDistanceVolumeItem();
                item.Box = GetBox();
                context.FrameData.RenderSceneData.TransparentRenderingAddOffsetWhenSortByDistanceVolumes.Add(item);
            }

            if (EnabledInHierarchy && VisibleInHierarchy && mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var context2 = context.objectInSpaceRenderingContext;

                bool show = (ParentScene.GetDisplayDevelopmentDataInThisApplication() && ParentScene.DisplayVolumes) || context2.selectedObjects.Contains(this) || context2.canSelectObjects.Contains(this) || context2.objectToCreate == this;
                if (show)
                {
                    //if( context2.displayVolumesCounter < context2.displayVolumesMax )
                    //{
                    //	context2.displayVolumesCounter++;

                    ColorValue color;
                    if (context2.selectedObjects.Contains(this))
                    {
                        color = ProjectSettings.Get.SelectedColor;
                    }
                    else if (context2.canSelectObjects.Contains(this))
                    {
                        color = ProjectSettings.Get.CanSelectColor;
                    }
                    else
                    {
                        color = ProjectSettings.Get.SceneShowVolumeColor;
                    }

                    if (color.Alpha != 0)
                    {
                        context.Owner.Simple3DRenderer.SetColor(color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier);
                        RenderShape(context2);
                    }

                    //}
                }
            }
        }
示例#20
0
        ResultItem[] CalculateObjects_ObjectsInSpace()
        {
            var scene = ParentScene;

            if (scene != null)
            {
                Component_Scene.GetObjectsInSpaceItem item = null;

                if (ConvexSweepTarget.ReferenceSpecified && (Shape.Value == ShapeEnum.Box || Shape.Value == ShapeEnum.Sphere))
                {
                    //Convex sweep test
                    var target = ConvexSweepTarget.Value;
                    if (target != null)
                    {
                        UpdateConvexSweepHull();

                        if (hullPlanes != null)
                        {
                            item = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, false, hullPlanes);
                        }
                    }
                }
                else
                {
                    switch (Shape.Value)
                    {
                    case ShapeEnum.Box:
                        item = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, false, GetBox());
                        break;

                    case ShapeEnum.Sphere:
                        item = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, false, GetSphere());
                        break;

                    case ShapeEnum.Ray:
                        item = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, false, GetRay());
                        break;
                    }
                }

                if (item != null)
                {
                    scene.GetObjectsInSpace(item);

                    if (item.Result.Length != 0)
                    {
                        var result = new List <ResultItem>(item.Result.Length);
                        for (int n = 0; n < item.Result.Length; n++)
                        {
                            ref var resultItem2 = ref item.Result[n];

                            var resultItem = new ResultItem(resultItem2.Object, resultItem2.Position, resultItem2.DistanceScale);

                            bool ignore = false;
                            PerformFilterObject(resultItem, ref ignore);
                            if (ignore)
                            {
                                continue;
                            }

                            result.Add(resultItem);

                            if (Mode.Value == ModeEnum.OneClosestObject)
                            {
                                break;
                            }
                        }

                        return(result.ToArray());
                    }
                }
            }
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            if (mode == GetRenderSceneDataMode.InsideFrustum)
            {
                //UpdateProcessedCubemaps();

                var sphere = Sphere;
                if (sphere.Radius > 0)
                {
                    var item = new Component_RenderingPipeline.RenderSceneData.ReflectionProbeItem();
                    item.Creator     = this;
                    item.BoundingBox = SpaceBounds.CalculatedBoundingBox;
                    //item.BoundingSphere = SpaceBounds.CalculatedBoundingSphere;
                    item.Sphere = sphere;

                    //if( Mode.Value == ModeEnum.Resource )
                    //{
                    if (processedEnvironmentCubemap != null)
                    {
                        item.CubemapEnvironment = processedEnvironmentCubemap;
                    }
                    else
                    {
                        item.CubemapEnvironment = Cubemap;
                    }

                    item.CubemapIrradiance = processedIrradianceCubemap;

                    GetRotationMatrix(out item.Rotation);
                    item.Multiplier = Multiplier.Value.ToVector3F();

                    //item.CubemapEnvironment = Cubemap;
                    //item.CubemapIrradiance = CubemapIrradiance;
                    //}
                    //else
                    //{
                    //	//!!!!IBL
                    //	item.CubemapEnvironment = CaptureTexture;
                    //}

                    context.FrameData.RenderSceneData.ReflectionProbes.Add(item);
                }

                {
                    var context2 = context.objectInSpaceRenderingContext;

                    bool show = (ParentScene.GetDisplayDevelopmentDataInThisApplication() && ParentScene.DisplayReflectionProbes) || context2.selectedObjects.Contains(this) || context2.canSelectObjects.Contains(this) || context2.objectToCreate == this;
                    if (show)
                    {
                        if (context2.displayReflectionProbesCounter < context2.displayReflectionProbesMax)
                        {
                            context2.displayReflectionProbesCounter++;

                            ColorValue color;
                            if (context2.selectedObjects.Contains(this))
                            {
                                color = ProjectSettings.Get.SelectedColor;
                            }
                            else if (context2.canSelectObjects.Contains(this))
                            {
                                color = ProjectSettings.Get.CanSelectColor;
                            }
                            else
                            {
                                color = ProjectSettings.Get.SceneShowReflectionProbeColor;
                            }

                            var viewport = context.Owner;
                            if (viewport.Simple3DRenderer != null)
                            {
                                viewport.Simple3DRenderer.SetColor(color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier);
                                DebugDraw(viewport);
                                //viewport.Simple3DRenderer.AddSphere( Transform.Value.ToMat4(), 0.5, 32 );
                            }
                        }
                    }
                    //if( !show )
                    //	context.disableShowingLabelForThisObject = true;
                }
            }
        }
示例#22
0
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            var area = Parent as Component_Area;

            if (area != null)
            {
                if (!area.CheckNeedShowDevelopmentDataOfAreaAndPoints(context, mode))
                {
                    var context2 = context.objectInSpaceRenderingContext;
                    context2.disableShowingLabelForThisObject = true;
                }
            }
        }
示例#23
0
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode, Component_Scene.GetObjectsInSpaceItem modeGetObjectsItem)
        {
            base.OnGetRenderSceneData(context, mode, modeGetObjectsItem);

            if (mode == GetRenderSceneDataMode.InsideFrustum && AutoUpdate)
            {
                lastVisibleTime = Time.Current;
            }
        }