Example #1
0
    void Start()
    {
        // Find the rectangle where texture will be drawn
        var gui  = GetComponent <NoesisGUIPanel>();
        var root = (Noesis.FrameworkElement)gui.GetContent();
        var rect = (Noesis.Rectangle)root.FindName("rtRect");

        // Create render texture
        UnityEngine.RenderTexture renderTexture = new UnityEngine.RenderTexture(
            512, 512, 1, UnityEngine.RenderTextureFormat.Default);
        UnityEngine.RenderTexture.active = renderTexture;

        // Set render texture as camera target
        this._offscreenCamera.targetTexture = renderTexture;
        this._offscreenCamera.aspect        = 1;

        // Create brush to store render texture and assign it to the rectangle
        rect.Fill = new Noesis.ImageBrush()
        {
            ImageSource = new Noesis.TextureSource(renderTexture),
            Stretch     = Noesis.Stretch.UniformToFill,
            Opacity     = 0.9f
        };

        // Title bar drag to move
        this._titleBar = (Noesis.Border)root.FindName("titleBar");
        this._titleBar.MouseLeftButtonDown += this.OnTitleBarMouseDown;
        this._titleBar.MouseLeftButtonUp   += this.OnTitleBarMouseUp;
        this._titleBar.MouseMove           += this.OnTitleBarMouseMove;

        var panel = (Noesis.Panel)root.FindName("panel");

        this._panelPosition = (Noesis.TranslateTransform)panel.RenderTransform;

        // Model rotation
        var rotateLeft = (Noesis.RepeatButton)root.FindName("rotateLeft");

        rotateLeft.Click += this.OnRotateLeft;

        var rotateRight = (Noesis.RepeatButton)root.FindName("rotateRight");

        rotateRight.Click += this.OnRotateRight;
    }
 internal static HandleRef getCPtr(TranslateTransform obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }