예제 #1
0
        public List <PropDesc> get_props_descs(PropType prop_type, string group = "")
        {
            List <PropDesc> descs  = new List <PropDesc>();
            string          result = "";
            string          args   = "";

            switch (prop_type)
            {
            case PropType.Options:
                args   = "options," + group;
                result = PyUtils.ExectueObjMethod(this.ID, "get_props_descs", args);
                break;

            case PropType.ToneMapping:
                args   = "tone," + group;
                result = PyUtils.ExectueObjMethod(this.ID, "get_props_descs", args);
                break;

            default:
                result = "";
                break;
            }

            string[] words = result.Split(',');
            for (int i = 0; i < words.Length; i = i + 2)
            {
                descs.Add(new PropDesc(words[i], words[i + 1]));
            }
            return(descs);
        }
예제 #2
0
        public bool render()
        {
            string ret = PyUtils.ExectueObjMethod(this.ID, "render", "");

            if (ret == "True")
            {
                return(true);
            }
            else if (ret == "False")
            {
                return(false);
            }
            else
            {
                throw new Exception("True or False is expeted to be returned from render function!");
            }
        }
예제 #3
0
        public BitmapSource output_image()
        {
            // NOTE bgra format is expected
            // "width, height, pixels, pitch"
            string ret = PyUtils.ExectueObjMethod(this.ID, "output_image", "");

            string[] tokens = ret.Split(',');
            int      width  = int.Parse(tokens[0]);
            int      height = int.Parse(tokens[1]);
            int      pitch  = int.Parse(tokens[3]);
            long     adr    = long.Parse(tokens[2]);
            IntPtr   pixels = new IntPtr(adr);

            PixelFormat  pixformat = PixelFormats.Bgra32;
            BitmapSource image     = BitmapSource.Create(width, height, 96, 96, pixformat,
                                                         null, pixels, height * pitch, pitch);

            return(image);
        }
예제 #4
0
파일: Class1.cs 프로젝트: mario007/renmas
        public static PyImage CreateImage(int width, int height, ImageType type)
        {
            string size = width.ToString() + "," + height.ToString();
            string id   = "";

            switch (type)
            {
            case ImageType.RGBA:
                id = PyUtils.ExecuteMethod("create_image", "RGBA," + size);
                break;

            case ImageType.BGRA:
                id = PyUtils.ExecuteMethod("create_image", "BGRA," + size);
                break;

            case ImageType.PRGBA:
                id = PyUtils.ExecuteMethod("create_image", "PRGBA," + size);
                break;
            }
            return(new PyImage(id, type));
        }
예제 #5
0
파일: Class1.cs 프로젝트: mario007/renmas
        public PyBGRAImage convert_to_bgra()
        {
            string id = PyUtils.ExecuteMethod("conv_to_bgra", this.ID);

            return(new PyBGRAImage(id));
        }
예제 #6
0
파일: Class1.cs 프로젝트: mario007/renmas
        protected IntPtr get_pointer(string name)
        {
            long adr = long.Parse(PyUtils.GetProp(this._id, name, "int"));

            return(new IntPtr(adr));
        }
예제 #7
0
파일: Class1.cs 프로젝트: mario007/renmas
 protected int get_int(string name)
 {
     return(int.Parse(PyUtils.GetProp(this._id, name, "int")));
 }
예제 #8
0
 public void save_project(string filename)
 {
     // TODO check if file exists or null raise exception
     PyUtils.ExectueObjMethod(this.ID, "save_project", filename);
 }
예제 #9
0
 public void import_scene(string filename)
 {
     // TODO check if file exists or null raise exception
     PyUtils.ExectueObjMethod(this.ID, "parse_scene_file", filename);
 }
예제 #10
0
        public static Renmas create()
        {
            string id = PyUtils.ExecuteMethod("create_renderer", "");

            return(new Renmas(id));
        }