Esempio n. 1
0
        protected void updateDebugRTTWindow()
        {
            // Clear listbox
            mDebugRTTListbox.resetList();
            // Clear imagesets
            mDebugRTTStaticImage.setImage(null);
            foreach (CeguiDotNet.Imageset imgset in mDebugRTTImageSets)
            {
                CeguiDotNet.ImagesetManager.getSingleton().destroyImageset(imgset);
            }
            mDebugRTTImageSets.Clear();
            // Add an entry for each render texture for all active compositors
            Viewport        vp    = mRenderWindow.GetViewport(0);
            CompositorChain chain = CompositorManager.Instance.getCompositorChain(vp);

            OgreDotNet.CompositorInstancesIteratorWrap it = chain.getCompositors();
            while (it.hasMoreElements())
            {
                CompositorInstance inst = it.getNext();
                if (inst.getEnabled())
                {
                    CTTextureDefinitionsIterator texIt =
                        inst.getTechnique().GetTextureDefinitionIterator();
                    while (texIt.hasMoreElements())
                    {
                        CTTextureDefinition texDef = texIt.getNext();

                        // Get instance name of texture
                        string instName = inst.getTextureInstanceName(texDef.getName());
                        // Create CEGUI texture from name of OGRE texture
                        CeguiDotNet.Texture tex = mGuiRenderer.createTexture(new CeguiDotNet.String(instName));
                        // Create imageset
                        CeguiDotNet.Imageset imgSet =
                            ImagesetManager.getSingleton().createImageset(instName, tex);
                        mDebugRTTImageSets.Add(imgSet);
                        imgSet.defineImage("RttImage",
                                           new CEGUIVector2(0.0f, 0.0f),
                                           new CeguiDotNet.Size(tex.getWidth(), tex.getHeight()),
                                           new CEGUIVector2(0.0f, 0.0f));

                        CeguiDotNet.ListboxTextItem item = new ListboxTextItem(texDef.getName(), 0, Imageset.getCPtr(imgSet).Handle);
                        item.setSelectionBrushImage("TaharezLook", "ListboxSelectionBrush");
                        item.setSelectionColours(new CeguiDotNet.colour(0.0f, 0.0f, 1.0f));
                        //the is so we dont have to keep track of the ListboxTextItem
                        //if we loose the reference to the DotNet object CeguiDotNet.ListboxTextItem(leaving scope of the while statement),
                        //The swig generated code will delete the c++ object, we dont want this.
                        //So calling the static function RemoveOwnership will stop the swig generated
                        // code from deleteing the c++ object and the dotnet object can delete normaly.
                        ListboxTextItem.RemoveOwnership(item);
                        //make sure the c++ object will be deleted with its parent
                        item.setAutoDeleted(true);
                        mDebugRTTListbox.addItem(item);
                    }
                }
            }
        }
Esempio n. 2
0
 protected bool handleRttSelection(CeguiDotNet.WindowEventArgs args)
 {
     if (mDebugRTTListbox.getSelectedCount() > 0)
     {
         // image set is in user data
         CeguiDotNet.Imageset imgSet = new CeguiDotNet.Imageset(
             mDebugRTTListbox.getFirstSelectedItem().getUserData(), false);
         mDebugRTTStaticImage.setImage(imgSet.getImage("RttImage"));
     }
     else
     {
         mDebugRTTStaticImage.setImage(null);
     }
     return(true);
 }