예제 #1
0
        public void read(Reader reader)
        {
            title = reader.readRSDKString();

            activeLayer0  = (ActiveLayers)reader.ReadByte();
            activeLayer1  = (ActiveLayers)reader.ReadByte();
            activeLayer2  = (ActiveLayers)reader.ReadByte();
            activeLayer3  = (ActiveLayers)reader.ReadByte();
            layerMidpoint = (LayerMidpoints)reader.ReadByte();

            // Map width/height in 128 pixel units
            // In RSDKv2 it's one byte long

            width  = reader.ReadByte();
            height = reader.ReadByte();

            layout = new ushort[height][];
            for (int i = 0; i < height; i++)
            {
                layout[i] = new ushort[width];
            }

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    // 128x128 Block number is 16-bit
                    // Big-Endian in RSDKv2
                    layout[y][x]  = (ushort)(reader.ReadByte() << 8);
                    layout[y][x] |= reader.ReadByte();
                }
            }

            // Read number of object types
            int objectTypeCount = reader.ReadByte();

            objectTypeNames.Clear();
            for (int n = 0; n < objectTypeCount; n++)
            {
                objectTypeNames.Add(reader.readRSDKString());
            }

            // Read entities

            // 2 bytes, big-endian, unsigned
            int entityCount = reader.ReadByte() << 8;

            entityCount |= reader.ReadByte();

            entities.Clear();
            for (int n = 0; n < entityCount; n++)
            {
                entities.Add(new Entity(reader));
            }

            reader.Close();
        }
예제 #2
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            bool valid = int.TryParse(LayerCountTxt.Text, out int result);

            if (!valid && LayerTypeCB.Text != "Sum")
            {
                return;
            }
            string type = null;

            if (LayerTypeCB.Text == "Fully Connected")
            {
                type = "f";
            }
            if (LayerTypeCB.Text == "Convolution")
            {
                type = "c";
                type.Append(UpDownCB.Checked ? 'u' : 'd');
                if (result > 10)
                {
                    MessageBox.Show("Convolution's layer count is squared, must still be between 0 and 100");
                    return;
                }
            }
            if (LayerTypeCB.Text == "Sum")
            {
                type = "s";
            }
            if (LayerTypeCB.Text == "Pool")
            {
                type = "p";
            }

            string residual = null, batchnorm = null, tanh = null;

            if (!(type == "s" || type == "p"))
            {
                residual  = ResidualCB.Checked ? "1" : "0";
                batchnorm = BatchNormCB.Checked ? "1" : "0";
                tanh      = TanhCB.Checked ? "1" : "0";
            }
            if (residual is null && batchnorm is null && tanh is null)
            {
                if (!valid)
                {
                    ActiveLayers.Add(type);
                }
                else
                {
                    ActiveLayers.Add(type + "," + result.ToString());
                }
            }
예제 #3
0
        public void read(Reader reader)
        {
            title = reader.readRSDKString();

            activeLayer0  = (ActiveLayers)reader.ReadByte();
            activeLayer1  = (ActiveLayers)reader.ReadByte();
            activeLayer2  = (ActiveLayers)reader.ReadByte();
            activeLayer3  = (ActiveLayers)reader.ReadByte();
            layerMidpoint = (LayerMidpoints)reader.ReadByte();

            // Map width in 128 pixel units
            // In RSDKv4 it's one byte long (with an unused byte after each one), little-endian

            width = reader.ReadByte();
            reader.ReadByte(); // Unused

            height = reader.ReadByte();
            reader.ReadByte(); // Unused

            layout = new ushort[height][];
            for (int i = 0; i < height; i++)
            {
                layout[i] = new ushort[width];
            }

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    // 128x128 Block number is 16-bit
                    // Little-Endian in RSDKv4
                    layout[y][x]  = reader.ReadByte();
                    layout[y][x] |= (ushort)(reader.ReadByte() << 8);
                }
            }

            // Read entities

            // 2 bytes, little-endian, unsigned
            int entityCount = reader.ReadByte();

            entityCount |= reader.ReadByte() << 8;

            entities.Clear();
            for (int o = 0; o < entityCount; o++)
            {
                entities.Add(new Entity(reader));
            }

            reader.Close();
        }
예제 #4
0
    public void SetActiveLayers(IList <Layer> layers)
    {
        foreach (Layer l in activeLayers)
        {
            if (!layers.Contains(l))
            {
                foreach (EMesh m in l)
                {
                    if (m.Selected)
                    {
                        m.Selected = false;
                    }
                }
            }
        }

        activeLayers.Clear();
        ActiveLayers.AddRange(layers);

        Program.outlinerForm.UpdateUI();
    }