Exemplo n.º 1
0
        public PreviewRenderer(BezierCurveCollection sideCurves, BezierCurveCollection topCurves, BezierCurveCollection backCurves)
            : base(new Rectangle(
                     ScreenData.GetScreenValueX(0.5f),
                     ScreenData.GetScreenValueY(0.5f),
                     ScreenData.GetScreenValueX(0.5f),
                     ScreenData.GetScreenValueY(0.5f)
                     ))
        {
            _renderTarget = new RenderPanel(
                ScreenData.GetScreenValueX(0.5f),
                ScreenData.GetScreenValueY(0.5f),
                ScreenData.GetScreenValueX(0.5f),
                ScreenData.GetScreenValueY(0.5f)
                );
            RenderPanel.BindRenderTarget(_renderTarget);

            _indicies = MeshHelper.CreateIndiceArray((_meshVertexWidth) * (_meshVertexWidth));
            _verticies = MeshHelper.CreateTexcoordedVertexList((_meshVertexWidth) * (_meshVertexWidth));

            _geometryBuffer = new ShipGeometryBuffer(_indicies.Count(), _verticies.Count(), (_meshVertexWidth) * (_meshVertexWidth) * 2, "HullEditorHullTex");
            _geometryBuffer.DiffuseDirection = new Vector3(0, -1, 1);

            _mesh = new Vector3[_meshVertexWidth, _meshVertexWidth];

            _sideCurves = sideCurves;
            _topCurves = topCurves;
            _backCurves = backCurves;

            _geometryBuffer.Indexbuffer.SetData(_indicies);
        }
Exemplo n.º 2
0
        public Line2D(Line parent, Color color)
        {
            _isDisposed = false;

            _texture = new Texture2D(Singleton.Device, 1, 1, false, SurfaceFormat.Color);
            _texture.SetData(new[]{color});
            _parent = parent;
            _renderPanel = RenderPanel.Add(this);
            //_color = color;
        }
Exemplo n.º 3
0
 /// <summary>
 ///   constructor for a normal sprite
 /// </summary>
 public Sprite2D(string textureName, int x, int y, int width, int height, float depth = 0.5f, float opacity = 1, float spriteRepeatX = 1, float spriteRepeatY = 1)
 {
     _texture = Singleton.ContentManager.Load<Texture2D>(Singleton.ContentStrLookup[textureName]);
     _srcRect = new FloatingRectangle(0f, 0f, _texture.Height*spriteRepeatX, _texture.Width*spriteRepeatY);
     _destRect = new Rectangle();
     _isDisposed = false;
     _renderPanel = RenderPanel.Add(this);
     X = x;
     Y = y;
     Width = width;
     Height = height;
     Depth = depth;
     Opacity = opacity;
     Enabled = true;
 }
Exemplo n.º 4
0
        public DoodadEditor(List<BezierInfo> backCurveInfo, List<BezierInfo> sideCurveInfo, List<BezierInfo> topCurveInfo)
        {
            _renderTarget = new RenderPanel(0, 0, ScreenData.ScreenWidth, ScreenData.ScreenHeight);
            _uiElementCollection = new UIElementCollection();
            _cameraController = new BodyCenteredCamera();

            #region construct UI and any UI-related tools

            RenderPanel.BindRenderTarget(_renderTarget);
            UIElementCollection.BindCollection(_uiElementCollection);

            var geometryInfo = HullGeometryGenerator.GenerateShip(backCurveInfo, sideCurveInfo, topCurveInfo, _primsPerDeck);
            _hullData = new HullDataManager(geometryInfo);

            _doodadUI = new DoodadUI(_hullData);

            RenderPanel.UnbindRenderTarget();
            UIElementCollection.UnbindCollection();

            #endregion

            _cameraController.SetCameraTarget(_hullData.CenterPoint);
        }
Exemplo n.º 5
0
        protected HullEditorPanel(int x, int y, int width, int height, string defaultCurveConfiguration, PanelAlias panelType)
        {
            BoundingBox = new FloatingRectangle(x, y, width, height);
            PanelRenderTarget = new RenderPanel(x, y, width, height, DepthLevel.Medium);
            RenderPanel.BindRenderTarget(PanelRenderTarget);

            Curves = new BezierCurveCollection(
                defaultConfig: defaultCurveConfiguration,
                areaToFill: new FloatingRectangle(
                    x + width*0.1f,
                    y + height*0.1f,
                    width - width*0.2f,
                    height - height*0.2f
                    ),
                panelType: panelType
                );
            UIElementCollection.Collection.AddDragConstraintCallback(ClampChildElements);
            Background =
                new Button(
                    x: x,
                    y: y,
                    width: width,
                    height: height,
                    depth: DepthLevel.Background,
                    textureName: "HullEditorBgTex",
                    spriteTexRepeatX: width/(Curves.PixelsPerMeter*1),
                    spriteTexRepeatY: height/(Curves.PixelsPerMeter*1),
                    components: new IUIComponent[]{new PanelComponent()}
                    );
            Update();
        }
Exemplo n.º 6
0
 public static void Clear()
 {
     _renderPanels.Clear();
     _curRenderPanel = null;
 }
Exemplo n.º 7
0
 public static void BindRenderTarget(RenderPanel panel)
 {
     _curRenderPanel = panel;
 }
Exemplo n.º 8
0
 public static void UnbindRenderTarget()
 {
     _curRenderPanel = null;
 }