コード例 #1
0
 public BoundingVolumeHierarchy(IRayTraceable nodeA, IRayTraceable nodeB, int splitingPlane)
 {
     this.splitingPlane = splitingPlane;
     this.nodeA         = nodeA;
     this.nodeB         = nodeB;
     this.Aabb          = nodeA.GetAxisAlignedBoundingBox() + nodeB.GetAxisAlignedBoundingBox(); // we can cache this because it is not allowed to change.
 }
コード例 #2
0
        public AxisAlignedBoundingBox GetAxisAlignedBoundingBox()
        {
            Vector3 localOrigin = Origin;
            AxisAlignedBoundingBox localBounds = child.GetAxisAlignedBoundingBox();
            AxisAlignedBoundingBox bounds      = localBounds.NewTransformed(AxisToWorld);

            return(bounds);
        }
コード例 #3
0
        public override void OnMouseDown(MouseEventArgs mouseEvent)
        {
            base.OnMouseDown(mouseEvent);

            lastMouseMovePoint.x = mouseEvent.X;
            lastMouseMovePoint.y = mouseEvent.Y;

            if (Focused && MouseCaptured)
            {
                if (trackBallController.CurrentTrackingType == TrackBallController.MouseDownType.None)
                {
                    if (Focused && MouseCaptured && mouseEvent.Button == MouseButtons.Left)
                    {
                        trackBallController.OnMouseDown(lastMouseMovePoint, Matrix4X4.Identity);
                    }
                    else if (mouseEvent.Button == MouseButtons.Middle)
                    {
                        trackBallController.OnMouseDown(lastMouseMovePoint, Matrix4X4.Identity, TrackBallController.MouseDownType.Translation);
                    }
                }

                if (MouseCaptured)
                {
                    lastMouseMovePoint.x             = mouseEvent.X;
                    lastMouseMovePoint.y             = mouseEvent.Y;
                    cameraDataAtStartOfMouseTracking = cameraData;
                    cameraDataAtStartOfMouseTracking.cameraMatrix = scene.camera.axisToWorld;

                    Ray rayAtPoint = scene.camera.GetRay(lastMouseMovePoint.x, lastMouseMovePoint.y);

                    IntersectInfo info = raytracer.TracePrimaryRay(rayAtPoint, scene);
                    if (info != null)
                    {
                        focusedObject = (BaseShape)info.closestHitObject;
                        if (focusedObject != null && mouseEvent.Clicks == 2)
                        {
                            cameraData.lookAtPoint = focusedObject.GetAxisAlignedBoundingBox().Center;
                            OrientCamera();
                        }
                    }
                }
            }
        }
コード例 #4
0
ファイル: Difference.cs プロジェクト: asmboom/PixelFarm
 public AxisAlignedBoundingBox GetAxisAlignedBoundingBox()
 {
     return(primary.GetAxisAlignedBoundingBox());
 }