コード例 #1
0
ファイル: DummyWorld.cs プロジェクト: thormme/Chimera
        public void ModifyTextureMap(
            Vector3 position, 
            string texture, 
            Vector2 UVOffset, 
            Vector2 UVScale, 
            float radius, 
            float alpha,
            EditorForm.Brushes brush,
            EditorForm.Tools tool, 
            HeightMapMesh.TextureLayer layer)
        {
            bool isFeathered = brush == EditorForm.Brushes.CIRCLE_FEATHERED || brush == EditorForm.Brushes.BLOCK_FEATHERED;
            bool isBlock = brush == EditorForm.Brushes.BLOCK || brush == EditorForm.Brushes.BLOCK_FEATHERED;

            ModifiableLevel.BlockModifier textureModifier = null;
            switch (tool)
            {
                case EditorForm.Tools.PAINT:
                    textureModifier = PaintTexture;
                    break;
                case EditorForm.Tools.ERASE:
                    textureModifier = EraseTexture;
                    break;
                case EditorForm.Tools.BLEND:
                    textureModifier = BlendTexture;
                    break;
            }

            mLevel.IterateOverBlocksInContainerInRadius(
                mSelectedBlocks.Count == 0 ? null : mSelectedBlocks,
                position,
                radius,
                textureModifier,
                new object[] { (bool?)isFeathered, (bool?)isBlock, (float?)alpha, (HeightMapMesh.TextureLayer?)layer, texture, (Vector2?)UVOffset, (Vector2?)UVScale});
        }
コード例 #2
0
ファイル: MapEditor.cs プロジェクト: thormme/Chimera
        private void UpdateLayerPaneImages(EditorForm.Layers layer, string textureName)
        {
            MemoryStream ms = new MemoryStream();
            Texture2D texture = AssetLibrary.LookupTexture(textureName);

            texture.SaveAsPng(ms, 30, 30);

            ms.Seek(0, SeekOrigin.Begin);

            System.Drawing.Image bmp = System.Drawing.Bitmap.FromStream(ms);

            ms.Close();
            ms = null;

            switch (layer)
            {
                case Dialogs.EditorForm.Layers.BACKGROUND:
                    TextureLayerPane.BackgroundLayer.LayerTexturePreview.Image = bmp;
                    break;
                case Dialogs.EditorForm.Layers.LAYER1:
                    TextureLayerPane.Layer1.LayerTexturePreview.Image = bmp;
                    break;
                case Dialogs.EditorForm.Layers.LAYER2:
                    TextureLayerPane.Layer2.LayerTexturePreview.Image = bmp;
                    break;
                case Dialogs.EditorForm.Layers.LAYER3:
                    TextureLayerPane.Layer3.LayerTexturePreview.Image = bmp;
                    break;
                case Dialogs.EditorForm.Layers.LAYER4:
                    TextureLayerPane.Layer4.LayerTexturePreview.Image = bmp;
                    break;
            }
        }
コード例 #3
0
ファイル: DummyWorld.cs プロジェクト: thormme/Chimera
        public void ModifyHeightMap(
            Vector3 position, 
            float radius, 
            float intensity,
            EditorForm.Brushes brush,
            EditorForm.Tools tool)
        {
            intensity /= 1000.0f;
            bool isFeathered = brush == EditorForm.Brushes.CIRCLE_FEATHERED || brush == EditorForm.Brushes.BLOCK_FEATHERED;
            bool isBlock = brush == EditorForm.Brushes.BLOCK || brush == EditorForm.Brushes.BLOCK_FEATHERED;

            switch (tool)
            {
                case EditorForm.Tools.SET:
                    mLevel.SetTerrain(mSelectedBlocks, position, radius, intensity);
                    break;
                case EditorForm.Tools.SMOOTH:
                    mLevel.SmoothTerrain(mSelectedBlocks, position, radius, intensity);
                    break;
                case EditorForm.Tools.FLATTEN:
                    mLevel.RaiseTerrain(mSelectedBlocks, position, radius, intensity);
                    break;
                case EditorForm.Tools.LOWER:
                    mLevel.LowerTerrain(mSelectedBlocks, position, radius, intensity);
                    break;
                case EditorForm.Tools.RAISE:
                    mLevel.RaiseTerrain(mSelectedBlocks, position, radius, intensity);
                    break;
            }
        }
コード例 #4
0
ファイル: MapEditor.cs プロジェクト: thormme/Chimera
        public MapEditor(GraphicsDevice graphicsDevice, FPSCamera camera, ContentManager content, GameDeviceControl gameControl, EditorForm editorForm)
        {
            this.EditorForm = editorForm;
            this.HeightMapBrushPropertiesPane = editorForm.HeightMapBrushPropertiesForm;
            this.ObjectParameterPane = editorForm.ObjectParametersForm;
            this.ObjectPlacementPane = editorForm.ObjectPlacementPanel;
            this.TextureBrushPropertiesPane = editorForm.TextureBrushPropertiesForm;
            this.TextureLayerPane = editorForm.TextureLayerForm;
            this.TextureSelectionPane = editorForm.TextureSelectionForm;
            this.GizmoForm = editorForm.GizmoForm;
            mGraphics = graphicsDevice;
            mGameControl = gameControl;
            mCamera = camera;
            mDummyWorld = new DummyWorld(mControls);
            mEntity = new Entity(graphicsDevice, mControls, mCamera);
            mGizmo = new ObjectModificationGizmo(mControls, mCamera);
            InitializePanes();

            mTextureTransformShader = content.Load<Effect>("shaders/TextureTransform");

            NewHandler(this, EventArgs.Empty);
        }