Пример #1
0
        public List <uint> getDrawingTextures()
        {
            m_drawingTextures.Clear();

            KPProgram prog = this.CurrentProgramObject;

            if (prog == null)
            {
                return(m_drawingTextures);
            }

            for (int i = 0; i < prog.UniformsCount; i++)
            {
                KPVar uni = prog.Uniforms[i];
                if (uni.Type == gl2.GL_SAMPLER_2D || uni.Type == gl2.GL_SAMPLER_CUBE)
                {
                    uint[] listTu = uni.Type == gl2.GL_SAMPLER_2D ? m_listTexUnits_2D : m_listTexUnits_CubeMap;

                    string[] texUnits = uni.Value.Split(m_sValueSeparate, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string texIdStr in texUnits)
                    {
                        uint tu = uint.Parse(texIdStr.Trim());
                        Utils.assert(tu >= 0 && tu < KPClient.MAX_TEX_UNITS_NUMBER);
                        m_drawingTextures.Add(listTu[tu]);
                    }
                }
            }
            return(m_drawingTextures);
        }
Пример #2
0
        private void listViewPrograms_ItemActivate(object sender, EventArgs e)
        {
            string progId = listViewPrograms.FocusedItem.Text;
            //Utils.gc();

            KPClient client = KPClient.getInstance();

            FormObjectDetail form   = new FormObjectDetail();
            UCProgram        ucProg = new UCProgram();

            form.Controls.Add(ucProg);

            KPProgram prog = client.CurrentStateMachine.getProgramById(uint.Parse(progId));

            if (prog != null)
            {
                KPShader vs       = client.CurrentStateMachine.getShaderById(prog.VsId);
                string   vsSource = vs == null ? "" : vs.Source;

                KPShader fs       = client.CurrentStateMachine.getShaderById(prog.FsId);
                string   fsSource = fs == null ? "" : fs.Source;

                ucProg.applyProg(prog, vsSource, fsSource);
            }

            form.Show(this);
        }
Пример #3
0
        public UCProgram()
        {
            InitializeComponent();

            this.Dock = DockStyle.Fill;

            m_prog = new KPProgram();

            alignLeftPanel();
        }
Пример #4
0
        public void copyFrom(KPProgram prog)
        {
            m_id   = prog.Id;
            m_vsId = prog.VsId;
            m_fsId = prog.FsId;

            m_attributesCount = prog.AttributesCount;
            m_uniformsCount   = prog.UniformsCount;

            for (int i = 0; i < m_attributesCount; i++)
            {
                m_attributes[i].copyFrom(prog.Attributes[i]);
            }

            for (int i = 0; i < m_uniformsCount; i++)
            {
                m_uniforms[i].copyFrom(prog.Uniforms[i]);
            }
        }
Пример #5
0
        public void applyProg(KPProgram prog, string vsSource, string fsSource)
        {
            m_prog.copyFrom(prog);
            m_vsSource = vsSource;
            m_fsSource = fsSource;

            m_backupVsSource = vsSource;
            m_backupFsSource = fsSource;

            fastColoredTextBoxVS.Text = m_vsSource;
            fastColoredTextBoxFS.Text = m_fsSource;

            string txt = "";

            KPVar[] vars  = m_prog.Attributes;
            int     count = m_prog.AttributesCount;

            for (int i = 0; i < count; i++)
            {
                txt += vars[i].toString() + ";" + Environment.NewLine + Environment.NewLine;
            }
            richTextBoxATT.Text = txt;

            txt = "";

            vars  = m_prog.Uniforms;
            count = m_prog.UniformsCount;
            for (int i = 0; i < count; i++)
            {
                txt += vars[i].toString() + ";" + Environment.NewLine + Environment.NewLine;
            }
            richTextBoxUNI.Text = txt;

            this.Parent.Text = "Program :: id = " + m_prog.Id;
            tabPageVS.Text  += " (" + m_prog.VsId + ")";
            tabPageFS.Text  += " (" + m_prog.FsId + ")";
        }