Exemplo n.º 1
0
        public static byte[] getTransparency(SceneItem i)
        {
            List <byte> l = new List <byte>();

            l.AddRange(BitConverter.GetBytes((double)i.refObject.Transparency));

            return(l.ToArray());
        }
Exemplo n.º 2
0
        public static byte[] getBrightness(SceneItem i)
        {
            List <byte> l = new List <byte>();

            l.AddRange(BitConverter.GetBytes((double)i.refObject.Brightness));

            return(l.ToArray());
        }
Exemplo n.º 3
0
        public static byte[] getRotation(SceneItem i)
        {
            List <byte> l = new List <byte>();

            l.AddRange(BitConverter.GetBytes((double)i.refObject.dRotX));
            l.AddRange(BitConverter.GetBytes((double)i.refObject.dRotY));
            l.AddRange(BitConverter.GetBytes((double)i.refObject.dRotZ));

            return(l.ToArray());
        }
Exemplo n.º 4
0
        public virtual SceneItem getSceneItem(bool final_render = false)
        {
            var sc = new SceneItem(this);

            sc.Module    = (byte)getModule();
            sc.SubModule = (byte)getSubModule();
            sc.addRange(this.getBytes());

            var translation = new SceneItem(this);

            translation.Module    = (byte)Modules.eModules.BASIC_TRANSFORM;
            translation.SubModule = (byte)Modules.Submodules[Modules.eModules.BASIC_TRANSFORM]["TRANSLATION"];
            translation.addRange(BasicTransformations.getTranslation(translation));
            sc.addItem(translation);

            var rotate = new SceneItem(this);

            rotate.Module    = (byte)Modules.eModules.BASIC_TRANSFORM;
            rotate.SubModule = (byte)Modules.Submodules[Modules.eModules.BASIC_TRANSFORM]["ROTATION"];
            rotate.addRange(BasicTransformations.getRotation(rotate));
            sc.addItem(rotate);

            if (final_render)
            {
                if (Transparency != 0)
                {
                    var transparency = new SceneItem(this);
                    transparency.Module    = (byte)Modules.eModules.ADVANCED_LIGHT;
                    transparency.SubModule = (byte)Modules.Submodules[Modules.eModules.ADVANCED_LIGHT]["TRANSPARENCY"];
                    transparency.addRange(BasicTransformations.getTransparency(transparency));
                    sc.addItem(transparency);
                }

                if (Reflection != 0)
                {
                    var reflection = new SceneItem(this);
                    reflection.Module    = (byte)Modules.eModules.ADVANCED_LIGHT;
                    reflection.SubModule = (byte)Modules.Submodules[Modules.eModules.ADVANCED_LIGHT]["REFLECTION"];
                    reflection.addRange(BasicTransformations.getReflection(reflection));
                    sc.addItem(reflection);
                }

                if (Brightness != 0)
                {
                    var brightness = new SceneItem(this);
                    brightness.Module    = (byte)Modules.eModules.ADVANCED_LIGHT;
                    brightness.SubModule = (byte)Modules.Submodules[Modules.eModules.ADVANCED_LIGHT]["BRIGHTNESS"];
                    brightness.addRange(BasicTransformations.getBrightness(brightness));
                    sc.addItem(brightness);
                }
            }

            return(sc);
        }
Exemplo n.º 5
0
        private void _write_item(Scene s, SceneItem i, List <byte> buf)
        {
            // Convert module ID with its position in the array
            byte nmodule = 0;

            foreach (var m in s.RequestedModules)
            {
                if (m == (Modules.eModules)(i.Module))
                {
                    break;
                }
                nmodule++;
            }
            i.Module = nmodule;

            buf.AddRange(i.getBytes());
            foreach (var si in i.Items)
            {
                _write_item(s, si, buf);
            }
        }
Exemplo n.º 6
0
 public void addItem(SceneItem i)
 {
     this.NbSubItems++;
     Items.Add(i);
 }