コード例 #1
0
        //--------------------------------------------------------------------------------------------------

        void _UpdateAspects()
        {
            if (_HatchTexture == null)
            {
                var bitmap = ResourceUtils.ReadBitmapFromResource(@"Visual\Hatch45.png");
                if (bitmap == null)
                {
                    Messages.Error($"Could not load hatch texture from resource.");
                    return;
                }

                var pixmap = PixMapHelper.ConvertFromBitmap(bitmap);
                if (pixmap == null)
                {
                    Messages.Error($"Could not load hatch texture into pixmap.");
                    return;
                }
                _HatchTexture = new Graphic3d_Texture2Dmanual(pixmap);
                _HatchTexture.EnableModulate();
                _HatchTexture.EnableRepeat();
                _HatchTexture.GetParams().SetScale(new Graphic3d_Vec2(0.05f));
            }

            _OcClipPlane.SetCapping(true);
            _OcClipPlane.SetUseObjectMaterial(true);
            _OcClipPlane.SetUseObjectTexture(false);
            _OcClipPlane.SetCappingTexture(_HatchTexture);
        }
コード例 #2
0
        //--------------------------------------------------------------------------------------------------

        static Image _GetMarkerImage(string name)
        {
            if (_ImageCache.TryGetValue(name, out var image))
            {
                return(image);
            }

            var bitmap = ResourceUtils.ReadBitmapFromResource(Path.Combine("Marker", name) + ".png");

            if (bitmap == null)
            {
                Messages.Error($"Could not load marker image {name} from resource.");
            }
            else
            {
                var pixmap = PixMapHelper.ConvertFromBitmap(bitmap);
                if (pixmap == null)
                {
                    Messages.Error($"Could not load marker image {name} into pixmap.");
                }
                else
                {
                    image = new Image()
                    {
                        PixMap = pixmap,
                        Width  = (int)pixmap.Width(),
                        Height = (int)pixmap.Height(),
                        Bytes  = new Graphic3d_MarkerImage(pixmap).GetBitMapArray()
                    };
                }
            }
            _ImageCache.Add(name, image);
            return(image);
        }