コード例 #1
0
        public Tex2D(VirtualEntry entry, bool alpha)
        {
            Path = entry.Name;

            if (VLut.ContainsKey(entry))
            {
                Tex2D ot = VLut[entry];
                ID      = ot.ID;
                Width   = ot.Width;
                Height  = ot.Height;
                Alpha   = ot.Alpha;
                Name    = ot.Name;
                Path    = ot.Path;
                RawData = ot.RawData;
                /// Console.WriteLine("Lut:" + Name);
                return;
            }
            else
            {
                VLut.Add(entry, this);
            }

            Width  = entry.Par[0];
            Height = entry.Par[1];
            Alpha  = entry.Par[2] == 1 ? true : false;
            if (Alpha)
            {
            }

            RawData = entry.RawData;

            GL.Enable(EnableCap.Texture2D);
            ID = GL.GenTexture();

            GL.BindTexture(TextureTarget.Texture2D, ID);

            //GL.TexImage2D(TextureTarget.Texture2D,0,PixelInternalFormat.)

            if (alpha)
            {
                GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, Width, Height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, RawData);
            }
            else
            {
                GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, Width, Height, 0, PixelFormat.Rgb, PixelType.UnsignedByte, RawData);
            }

            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge);

            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

            GL.BindTexture(TextureTarget.Texture2D, 0);
        }
コード例 #2
0
        public void Execute(Entity dataModel, ChangeObservable observable)
        {
            ProjectEntity project = ProjectEntity.Decorate(dataModel.Root);

            if (!project.Settings.IsPersistent)
            {
                try
                {
                    ICodeModel codeModel = dataModel.Root.Value <ICodeModel>();
                    if (codeModel != null)
                    {
                        VirtualEntry acfFile = codeModel.SourceDirectories
                                               .SelectMany(directory => directory.Entries)
                                               .Where(entry => entry.Name.EndsWith(Constants.AcfConfigExtension, StringComparison.OrdinalIgnoreCase))
                                               .FirstOrDefault();
                        if (acfFile != null)
                        {
                            using (Stream xmlStream = (acfFile as VirtualFile).OpenRead())
                                using (XmlReader reader = XmlReader.Create(xmlStream))
                                {
                                    while (reader.Read())
                                    {
                                        if (reader.MoveToContent() == XmlNodeType.Element && reader.Name == "Component")
                                        {
                                            string componenttype = reader.GetAttribute("type");
                                            if (componenttype.Contains("::"))
                                            {
                                                throw new OldAcfConfigException();
                                            }
                                        }
                                    }
                                }
                        }
                    }
                }
                catch (XmlException)
                {
                    executionContext.WriteWarning("From version 2021.6 on the component type attribute inside the .acf.config file" +
                                                  " must use the namespace separator '.' instead of '::'!");
                }
            }
        }