示例#1
0
    static void init()
    {
        TextureEditor window = (TextureEditor)EditorWindow.GetWindow(typeof(TextureEditor));

        window.Show();
        //window.linemat = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Line.mat");
    }
示例#2
0
    void Start()
    {
        RaycastHit hit;

        if (Physics.Raycast(transform.position, -Vector3.up, out hit))
        {
            Canvas    = hit.transform.gameObject;
            textCoord = hit.textureCoord;
        }
        else
        {
            print("F**K");
        }
        texE     = Canvas.GetComponent <TextureEditor>();
        alphaTex = (Texture2D)Canvas.GetComponent <Renderer>().material.GetTexture("_SplatTex");

        textCoord = textCoord * alphaTex.width;

        texE.FillTexture();
        texE.PaintCircle(textCoord, 50);
    }
示例#3
0
        public RenderManager(ContentManager ContentManager, GraphicsDevice GraphicsDevice)
        {
            Content  = ContentManager;
            Graphics = GraphicsDevice;
            LoadTextures();
            LoadShaders();
            LoadModels();

            TextureEditor    = new TextureEditor(Graphics, Shaders["TextureEditor"]);
            Batch2D          = new SpriteBatch(Graphics);
            RootNode         = new Node3D("RootNode");
            GuiNode          = new Node2D("GuiNode");
            RenderTargetNode = new Node3D("RenderTargetNode");

            ResolutionX = (int)(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width * 0.75f);
            ResolutionY = (int)(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height * 0.75f);

            VirtualResolutionX = (int)ResolutionX;
            VirtualResolutionY = (int)ResolutionY;

            //ScreenCapture = new RenderTarget2D(Graphics, (int)ResolutionX, (int)ResolutionY, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);

            ScreenDepthCapture = new RenderTarget2D(Graphics, GraphicsDevice.PresentationParameters.BackBufferWidth,
                                                    GraphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Single, DepthFormat.Depth24);

            ScreenColorCapture = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth,
                                                    GraphicsDevice.PresentationParameters.BackBufferHeight,
                                                    false,
                                                    GraphicsDevice.PresentationParameters.BackBufferFormat,
                                                    DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);

            ScreenCapture = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth,
                                               GraphicsDevice.PresentationParameters.BackBufferHeight,
                                               false,
                                               GraphicsDevice.PresentationParameters.BackBufferFormat,
                                               DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);

            FOV = MathHelper.PiOver4;
        }