public void CopyFrom(tk2dSpriteAnimationClip source)
 {
     this.name = source.name;
     if (source.frames == null)
     {
         this.frames = null;
     }
     else
     {
         this.frames = new tk2dSpriteAnimationFrame[source.frames.Length];
         for (int i = 0; i < this.frames.Length; i++)
         {
             if (source.frames[i] == null)
             {
                 this.frames[i] = null;
             }
             else
             {
                 this.frames[i] = new tk2dSpriteAnimationFrame();
                 this.frames[i].CopyFrom(source.frames[i]);
             }
         }
     }
     this.fps = source.fps;
     this.loopStart = source.loopStart;
     this.wrapMode = source.wrapMode;
     if ((this.wrapMode == WrapMode.Single) && (this.frames.Length > 1))
     {
         this.frames = new tk2dSpriteAnimationFrame[] { this.frames[0] };
         Debug.LogError(string.Format("Clip: '{0}' Fixed up frames for WrapMode.Single", this.name));
     }
 }
Пример #2
0
    public AbstractAction(GameObject actor)
    {
        this.actor = actor;

        state = actor.GetComponent(typeof(CharacterState)) as CharacterState;
        animator = actor.GetComponent(typeof(CharacterAnimator)) as CharacterAnimator;
        mover = actor.GetComponent(typeof(CharacterMover)) as CharacterMover;
        actionRunner = actor.GetComponent(typeof(ActionRunner)) as ActionRunner;

        animationName = null;
        wrapMode = WrapMode.Once;
        emotionBodyParts = Emotion.BodyParts.NONE;

        canStartDialogueWithPC = true;
        canStartDialogueWithAgents = true;
        canEndAnyTime = true;
        //canCancelDuringMovement = true;

        quickReaction = null;
        moveToAction = null;

        started = false;
        endedASAP = false;
        endNextRound = false;

        finished = false;
    }
Пример #3
0
        public TextureNative(SectionHeader header, Stream stream)
            : base(header, stream)
        {
            SectionHeader.Read(stream);
            var reader = new BinaryReader(stream);

            PlatformID = reader.ReadUInt32();
            FilterFlags = (Filter) reader.ReadUInt16();
            WrapV = (WrapMode) reader.ReadByte();
            WrapU = (WrapMode) reader.ReadByte();
            DiffuseName = reader.ReadString(32);
            AlphaName = reader.ReadString(32);
            Format = (RasterFormat) reader.ReadUInt32();

            if (PlatformID == 9) {
                var dxt = reader.ReadString(4);
                switch (dxt) {
                    case "DXT1":
                        Compression = CompressionMode.DXT1;
                        break;
                    case "DXT3":
                        Compression = CompressionMode.DXT3; break;
                    default:
                        Compression = CompressionMode.None; break;
                }
            } else {
                Alpha = reader.ReadUInt32() == 0x1;
            }

            Width = reader.ReadUInt16();
            Height = reader.ReadUInt16();
            BPP = (byte) (reader.ReadByte() >> 3);
            MipMapCount = reader.ReadByte();
            RasterType = reader.ReadByte();

            if (RasterType != 0x4) {
                throw new Exception("Unexpected RasterType, expected 0x04.");
            }

            if (PlatformID == 9) {
                Alpha = (reader.ReadByte() & 0x1) == 0x1;
            } else {
                Compression = (CompressionMode) reader.ReadByte();
            }

            ImageDataSize = reader.ReadInt32();

            ImageData = reader.ReadBytes(ImageDataSize);

            if ((Format & RasterFormat.ExtMipMap) != 0) {
                var tot = ImageDataSize;
                for (var i = 0; i < MipMapCount; ++i) {
                    tot += ImageDataSize >> (2 * i);
                }

                ImageLevelData = reader.ReadBytes(tot);
            } else {
                ImageLevelData = ImageData;
            }
        }
Пример #4
0
    public void AddClip(AnimationClip clip, string newName, float speed, WrapMode wrapMode)
    {
        if (GetAnimationData(newName) != null) Debug.LogWarning("An animation with the name '" + newName + "' already exists.");
        LegacyAnimationData animData = new LegacyAnimationData();
        animData.clip = (AnimationClip)Instantiate(clip);
        if (wrapMode == WrapMode.Default) wrapMode = animator.wrapMode;
        animData.clip.wrapMode = wrapMode;
        animData.clip.name = newName;
        animData.clipName = newName;
        animData.speed = speed;
        animData.originalSpeed = speed;
        animData.length = clip.length;
        animData.wrapMode = wrapMode;

        List<LegacyAnimationData> animationDataList = new List<LegacyAnimationData>(animations);
        animationDataList.Add(animData);
        animations = animationDataList.ToArray();

        animator.AddClip(clip, newName);
        animator[newName].speed = speed;
        animator[newName].wrapMode = wrapMode;

        foreach (AnimationState animState in animator) {
            if (animState.name == newName) animData.animState = animState;
        }
    }
Пример #5
0
    /// <summary>
    /// Animate the Avatar
    /// </summary>
    /// <param name="animation">The Animation Name</param>
    /// <param name="action">0 - To play the animation, 1 - to stop the animation</param>
    /// <param name="wrapMode">Wrap Mode</param>
    /// <param name="animationSpeed">Animation Speed</param>
    /// <param name="layer">Animation Layer</param>
    public void Animate(string animation, AnimationAction action, WrapMode wrapMode, float animationSpeed, int layer)
    {
        if (characterObject	!= null && animation != "")
        {
            if (generator.AnimationClips.Contains(animation) && characterObject.animation != null)
            {
                if (action == AnimationAction.Play)
                {
                    characterObject.animation[animation].layer = layer;
                    characterObject.animation[animation].speed = animationSpeed;
                    characterObject.animation[animation].wrapMode = wrapMode;
                    characterObject.animation.CrossFade(animation);
                }
                else
                {
                    characterObject.animation[animation].layer = layer;
                    characterObject.animation.Stop(animation);
                }
            }
            else
            {
                string anims = "";
                foreach (AnimationState state in characterObject.animation)
                {
                    anims = anims + state.clip.name + ", ";
                }

                if (PopBloopSettings.useLogs)
                {
                    Debug.LogWarning("Animation " + animation + " not found on Character " + this.gameObject.name + " => Anims found : " + anims);
                }
            }
        }
    }
Пример #6
0
 /// <summary>
 /// Creates a new PicturePattern with the specified image
 /// </summary>
 /// <param name="picture">The picture to draw</param>
 /// <param name="wrap">The way to wrap the picture</param>
 /// <param name="angle">The angle to rotate the image</param>
 public PicturePattern(Image picture, WrapMode wrap, double angle)
 {
     _picture = picture;
     _wrapMode = wrap;
     _angle = angle;
     _dialogFilter = "Image Files|*.bmp;*.gif;*.jpg;*.png;*.tif;*.ico";
 }
Пример #7
0
        /// <summary>
        /// 骨骼融合播放动作
        /// </summary>
        /// <param name="name"></param>
        public bool Blend(string name, WrapMode wrap, float speed)
        {
            if (this.m_cAnimation != null)
            {
                if (this.m_cAnimation[name] != null)
                {
                    this.m_strCurrentAni = name;
                    this.m_fTime = this.m_delGetTime();
                    this.m_eWrap = wrap;
                    this.m_fSpeed = speed;

                    this.m_cAnimation[name].speed = speed * this.m_fScale;
                    this.m_cAnimation[name].wrapMode = wrap;
                    this.m_cAnimation.Blend(name);

                    return true;
                }
                return false;
            }
            else
            {
                this.m_strCurrentAni = "";
                this.m_fTime = this.m_delGetTime();
                this.m_eWrap = wrap;
                this.m_fSpeed = speed;
                return false;
            }
            return false;
        }
    void OnSelectionChange()
    {
        //Check user selection in editor - check for folder selection
        if (Selection.objects != null && Selection.objects.Length == 1)
        {
            
            if (Selection.activeObject != null && Selection.activeObject is AnimationClip)
            {
                AssetDatabase.StartAssetEditing();
                AnimationClip selectedClip = (AnimationClip)Selection.activeObject;
                AnimationClipCurveData[] curves = AnimationUtility.GetAllCurves(selectedClip);

                FrameRate = selectedClip.frameRate;
                legacy = selectedClip.legacy;
                WrapMode = selectedClip.wrapMode;
                Clipname = selectedClip.name;

                int maxTime = -1;
                for (int i = 0; i < curves.Count(); i++)
                {
                    AnimationCurve curve = curves[i].curve;

                    for (int k = 0; k < curve.length; k++)
                    {
                        int newTime = (int)(curve.keys[k].time * selectedClip.frameRate);
                        maxTime = Math.Max(maxTime, newTime);
                    }
                }
                TotalOfFrames = maxTime;
                AssetDatabase.StopAssetEditing();
            }
        }
    }
Пример #9
0
		void Initialize(GraphicsPath path, WrapMode wrapMode, bool initColors, bool calcCenter) {
			
			_texturePath = path;
			_wrapMode = wrapMode;
			_rectangle = path.GetBounds();

			if (initColors) {
				_centerColor = Color.Black;
				_surroundColors = new Color []{ Color.White };
			}
			
			Bitmap texture = new Bitmap( (int)_rectangle.Width, (int)_rectangle.Height );
			Graphics g = Graphics.FromImage( texture );
			PointF [] pathPoints = path.PathPoints;

			if (calcCenter) {
				for (int i=0; i < pathPoints.Length; i++) {
					_center.X += pathPoints[i].X;
					_center.Y += pathPoints[i].Y;
				}
				_center.X /= pathPoints.Length;
				_center.Y /= pathPoints.Length;
			}

			int outerColor = 0;
			DrawSector( g, CenterPoint, pathPoints[pathPoints.Length-1], pathPoints[0], CenterColor, SurroundColors[outerColor] );
			for(int i=0; i < pathPoints.Length - 1; i++) {
				if (outerColor < SurroundColors.Length - 1)
					outerColor++;
				DrawSector( g, CenterPoint, pathPoints[i], pathPoints[i+1], CenterColor, SurroundColors[outerColor] );
			}

			_nativeObject = new TextureBrush( texture );
		}
 public TextureBrush(Image image, WrapMode wrapMode, RectangleF dstRect)
 {
     if (image == null)
     {
         throw new ArgumentNullException("image");
     }
 }
    public void StartAnimation(BasicAnimationType basicAnimationType, WrapMode wrapMode, bool playAgain)
    {
        if (m_CurrAnim == BasicAnimations[(int)basicAnimationType] && !playAgain)
            return;

        StartAnimation(basicAnimationType, wrapMode);
    }
 public void Clear()
 {
     this.name = string.Empty;
     this.frames = new tk2dSpriteAnimationFrame[0];
     this.fps = 30f;
     this.loopStart = 0;
     this.wrapMode = WrapMode.Loop;
 }
Пример #13
0
 public LesserAnimationClass(AnimationClip animationClip, float animationSpeed, WrapMode wrapMode, float crossFade)
 {
     name = animationClip.name;
     clip = animationClip;
     speed = animationSpeed;
     wrap = wrapMode;
     crossfade = crossFade;
 }
Пример #14
0
 public LesserAnimationClass(string animationName, float animationSpeed, WrapMode wrapMode, float crossFade, string stateName)
 {
     name = animationName;
     speed = animationSpeed;
     wrap = wrapMode;
     crossfade = crossFade;
     state = stateName;
 }
Пример #15
0
 public bool setWrapMode(WrapMode wrapMode)
 {
     if(this.wrapMode != wrapMode) {
         this.wrapMode = wrapMode;
         return true;
     }
     return false;
 }
Пример #16
0
	private void CreateSpline (WrapMode wrapMode)
	{
		_curveX = new AnimationCurve();
		_curveY = new AnimationCurve();
		_curveZ = new AnimationCurve();
		
		SetWrapMode(wrapMode);
	}
Пример #17
0
        /// <summary>
        /// Create Normal Map Texture.
        /// </summary>
        /// <param name="img">Reference FloatImage.</param>
        /// <param name="wm">Texture Wrap Mode.</param>
        /// <param name="heightWeights">float[4]-> Color Weights.</param>
        /// <param name="kdu">Kernel U.</param>
        /// <param name="kdv">Kernel V.</param>
        /// <returns></returns>
        public static FloatImage CreateNormalMap(FloatImage img, WrapMode wm, float[] heightWeights, Kernel2 kdu, Kernel2 kdv, ParsePixelEventHandler pixelParseEvent)
        {
            int w = (int)img.Width;
            int h = (int)img.Height;
            bool canceled = false;

            FloatImage fimage = new FloatImage();
            fimage.Allocate(4, w, h);
            unsafe
            {
                float* alphaChannel = fimage.Channel(3);
                int x = 0, y = 0;
                for (uint i = 0; i < w * h; i++)
                {
                    float r = img.Pixel((uint)x, (uint)y, 0);
                    float g = img.Pixel((uint)x, (uint)y, 1);
                    float b = img.Pixel((uint)x, (uint)y, 2);
                    float a = img.ComponentCount > 3 ? img.Pixel((uint)x, (uint)y, 3) : 255f;
                    float[] color = ColorToVector4(r, g, b, a);
                    alphaChannel[i] = Float4Dot(color, heightWeights);
                    if (!pixelParseEvent())
                    {
                        canceled = true;
                        break;
                    }
                    x++;
                    if (x >= w)
                    {
                        x = 0;
                        y++;
                    }
                }
                float heightScale = 1.0f / 16.0f;	// @@ Use a user defined factor.
                for (y = 0; y < h; y++)
                {
                    for (x = 0; x < w; x++)
                    {
                        float du = fimage.ApplyKernel(kdu, x, y, 3, wm);
                        float dv = fimage.ApplyKernel(kdv, x, y, 3, wm);
                        float[] n = Float3Normalize(new float[] { du, dv, heightScale });
                        fimage.SetPixel(0.5f * n[0] + 0.5f, (uint)x, (uint)y, 0);
                        fimage.SetPixel(0.5f * n[1] + 0.5f, (uint)x, (uint)y, 1);
                        fimage.SetPixel(0.5f * n[2] + 0.5f, (uint)x, (uint)y, 2);
                        if (canceled)
                            break;
                        if (!pixelParseEvent())
                        {
                            canceled = true;
                            break;
                        }
                    }
                    if (canceled)
                        break;
                }
            }

            return fimage;
        }
Пример #18
0
		public override void Reset()
		{
			gameObject = null;
			animName = null;
			wrapMode = WrapMode.Loop;
			blendMode = AnimationBlendMode.Blend;
			speed = 1.0f;
			layer = 0;
		}
Пример #19
0
	public TextureBrush(Image image, WrapMode wrapMode)
			{
				if(image == null)
				{
					throw new ArgumentNullException("image");
				}
				this.image = image;
				this.wrapMode = wrapMode;
			}
Пример #20
0
 public override void Reset()
 {
     this.gameObject = null;
     this.animName = null;
     this.wrapMode = WrapMode.Loop;
     this.blendMode = AnimationBlendMode.Blend;
     this.speed = 1f;
     this.layer = 0;
 }
Пример #21
0
		private void Common (TextureBrush t, WrapMode wm)
		{
			using (Image img = t.Image) {
				Assert.IsNotNull (img, "Image");
			}
			Assert.IsFalse (Object.ReferenceEquals (image, t.Image), "Image-Equals");
			Assert.IsTrue (t.Transform.IsIdentity, "Transform.IsIdentity");
			Assert.AreEqual (wm, t.WrapMode, "WrapMode");
		}
        public TextureNativeSectionData( SectionHeader header, FramedStream stream )
        {
            SectionHeader dataHeader = new SectionHeader( stream );
            BinaryReader reader = new BinaryReader( stream );

            PlatformID = reader.ReadUInt32();
            FilterFlags = (Filter) reader.ReadUInt16();
            WrapV = (WrapMode) reader.ReadByte();
            WrapU = (WrapMode) reader.ReadByte();
            DiffuseName = reader.ReadString( 32 );
            AlphaName = reader.ReadString( 32 );
            Format = (RasterFormat) reader.ReadUInt32();

            if ( PlatformID == 9 )
            {
                String dxt = reader.ReadString( 4 );
                switch ( dxt )
                {
                    case "DXT1":
                        Compression = CompressionMode.DXT1; break;
                    case "DXT3":
                        Compression = CompressionMode.DXT3; break;
                    default:
                        Compression = CompressionMode.None; break;
                }
            }
            else
                Alpha = reader.ReadUInt32() == 0x1;

            Width = reader.ReadUInt16();
            Height = reader.ReadUInt16();
            BPP = (byte) ( reader.ReadByte() >> 3 );
            MipMapCount = reader.ReadByte();
            RasterType = reader.ReadByte();

            if ( RasterType != 0x4 )
                throw new Exception( "Unexpected RasterType, expected 0x04." );

            if ( PlatformID == 9 )
                Alpha = ( reader.ReadByte() & 0x1 ) == 0x1;
            else
                Compression = (CompressionMode) reader.ReadByte();

            ImageDataSize = reader.ReadUInt32();
            if ( ( Format & RasterFormat.ExtMipMap ) != 0 )
            {
                ImageLevelData = new byte[ MipMapCount ][];
                for ( int i = 0; i < MipMapCount; ++i )
                    ImageLevelData[ i ] = reader.ReadBytes( (int) ImageDataSize >> ( 2 * i ) );
            }
            else
            {
                ImageLevelData = new byte[ 1 ][];
                ImageLevelData[ 0 ] = reader.ReadBytes( (int) ImageDataSize );
            }
        }
Пример #23
0
		public TextureBrush (Image image, WrapMode wrapMode)
		{
			if (image == null)
				throw new ArgumentNullException ("image");
			if ((wrapMode < WrapMode.Tile) || (wrapMode > WrapMode.Clamp))
				throw new InvalidEnumArgumentException ("WrapMode");

			Status status = GDIPlus.GdipCreateTexture (image.nativeObject, wrapMode, out nativeObject);
			GDIPlus.CheckStatus (status);
		}
Пример #24
0
	public void SetWrapMode( WrapMode mode)
	{
		animation.wrapMode = mode;

		Animation[] anims = gameObject.GetComponentsInChildren<Animation>();
		foreach( Animation ani in anims )
		{
			ani.wrapMode = mode;
		}
	}
Пример #25
0
		public PathGradientBrush (PointF [] points, WrapMode wrapMode)
		{
			if (points == null)
				throw new ArgumentNullException ("points");
			if ((wrapMode < WrapMode.Tile) || (wrapMode > WrapMode.Clamp))
				throw new InvalidEnumArgumentException ("WrapMode");

			Status status = GDIPlus.GdipCreatePathGradient (points, points.Length, wrapMode, out nativeObject);
			GDIPlus.CheckStatus (status);
		}
Пример #26
0
 public AMPlugAnimation(Animation aAnim, string clipName, WrapMode aWrap, bool aFadeIn, float aFadeInTime)
     : base(null, false)
 {
     ignoreAccessor = true;
     anim = aAnim;
     animState = anim[clipName];
     wrap = aWrap;
     fadeIn = aFadeIn;
     fadeInTime = aFadeInTime;
 }
Пример #27
0
    public override void Animate(string animation, AnimationAction action, WrapMode wrapMode, float animationSpeed, int layer)
    {
        base.Animate(animation, action, wrapMode, animationSpeed, layer);

        _mmoGame.Avatar.Animate(animation, action, (byte)wrapMode, animationSpeed, layer);

        if (_avatarController == null)
        {
            Debug.Log("PlayerActor.Animate: character not found, please check the AvatarController being attached");
        }
    }
Пример #28
0
	public void SetWrapMode(WrapMode wrapMode)
	{
		_curveX.preWrapMode = wrapMode;
		_curveX.postWrapMode = wrapMode;
		
		_curveY.preWrapMode = wrapMode;
		_curveY.postWrapMode = wrapMode;
		
		_curveZ.preWrapMode = wrapMode;
		_curveZ.postWrapMode = wrapMode;
	}
Пример #29
0
        public CurveProxy(AnimationCurve _val)
        {
            preWrapMode = _val.preWrapMode;
            postWrapMode = _val.postWrapMode;
            keys = new KFProxy[_val.keys.Length];

            for (int _i = 0; _i < _val.keys.Length; ++_i)
            {
                keys[_i] = new KFProxy(_val.keys[_i]);
            }
        }
Пример #30
0
 /// <summary>
 /// コンストラクター
 /// </summary>
 /// <remarks>
 /// <paramref name="name"/> はこのクリップを識別しやすいようにユーザーが自由に決められる名前です。
 /// エンジン側では使用しません。
 /// </remarks>
 /// <param name="duration">クリップの長さ(msec)</param>
 /// <param name="name">このクリップの名前</param>
 public AnimationClip(int duration, string name)
 {
     this.name = name ?? "";
     this.duration = duration;
     this.localRefTime = 0;
     this.worldRefTime = 0;
     this.speed = 1;
     this.wrapMode = WrapMode.Loop;
     this.state = State.Stopped;
     this.tracks = new List<Tuple<WeakReference, AnimationTrack>> ();
     this.events = new List<AnimationEvent>();
 }
Пример #31
0
 public bool TweenOnce(bool reversed, bool reset = false, System.Action endAction = null)
 {
     m_StartByReversed = reversed;
     tweenWrapMode     = reset ? WrapMode.Once : WrapMode.ClampForever;
     return(Tween(endAction));
 }
Пример #32
0
        /// <summary>
        /// Add (allocate) a new texture in the atlas.
        /// </summary>
        /// <param name="width">The width of the requested texture.</param>
        /// <param name="height">The height of the requested texture.</param>
        /// <param name="wrapModeS">The horizontal wrap mode of the texture.</param>
        /// <param name="wrapModeT">The vertical wrap mode of the texture.</param>
        /// <returns>A texture, or null if the requested size exceeds the atlas' bounds.</returns>
        internal TextureGL Add(int width, int height, WrapMode wrapModeS = WrapMode.None, WrapMode wrapModeT = WrapMode.None)
        {
            if (!canFitEmptyTextureAtlas(width, height))
            {
                return(null);
            }

            lock (textureRetrievalLock)
            {
                Vector2I   position = findPosition(width, height);
                RectangleI bounds   = new RectangleI(position.X, position.Y, width, height);
                subTextureBounds.Add(bounds);

                return(new TextureGLSub(bounds, AtlasTexture, wrapModeS, wrapModeT));
            }
        }
Пример #33
0
        /// <summary>
        /// Binds a texture to draw with.
        /// </summary>
        /// <param name="texture">The texture to bind.</param>
        /// <param name="unit">The texture unit to bind it to.</param>
        /// <param name="wrapModeS">The texture wrap mode in horizontal direction.</param>
        /// <param name="wrapModeT">The texture wrap mode in vertical direction.</param>
        /// <returns>true if the provided texture was not already bound (causing a binding change).</returns>
        public static bool BindTexture(TextureGL texture, TextureUnit unit = TextureUnit.Texture0, WrapMode wrapModeS = WrapMode.None, WrapMode wrapModeT = WrapMode.None)
        {
            bool didBind = BindTexture(texture?.TextureId ?? 0, unit, wrapModeS, wrapModeT);

            last_bound_texture_is_atlas[GetTextureUnitId(unit)] = texture is TextureGLAtlas;

            return(didBind);
        }
Пример #34
0
 private Texture getTexture(string name, WrapMode wrapModeS = WrapMode.None, WrapMode wrapModeT = WrapMode.None) => loadRaw(base.Get(name), wrapModeS, wrapModeT);
Пример #35
0
 public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => lookupWithFallback(s => s.GetTexture(componentName, wrapModeS, wrapModeT));
Пример #36
0
 public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => CurrentSkin.Value.GetTexture(componentName, wrapModeS, wrapModeT);
Пример #37
0
 private extern static void nvttSetInputOptionsWrapMode(IntPtr inputOptions, WrapMode mode);
Пример #38
0
 public override Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => null;
Пример #39
0
        private Texture loadRaw(TextureUpload upload, WrapMode wrapModeS = WrapMode.None, WrapMode wrapModeT = WrapMode.None)
        {
            if (upload == null)
            {
                return(null);
            }

            TextureGL glTexture = null;

            if (Atlas != null)
            {
                if ((glTexture = Atlas.Add(upload.Width, upload.Height, wrapModeS, wrapModeT)) == null)
                {
                    Logger.Log(
                        $"Texture requested ({upload.Width}x{upload.Height}) which exceeds {nameof(TextureStore)}'s atlas size ({max_atlas_size}x{max_atlas_size}) - bypassing atlasing. Consider using {nameof(LargeTextureStore)}.",
                        LoggingTarget.Performance);
                }
            }

            glTexture ??= new TextureGLSingle(upload.Width, upload.Height, manualMipmaps, filteringMode, wrapModeS, wrapModeT);

            Texture tex = new Texture(glTexture)
            {
                ScaleAdjust = ScaleAdjust
            };

            tex.SetData(upload);

            return(tex);
        }
Пример #40
0
 /// <summary>
 /// Creates a new PicturePattern with the specified image
 /// </summary>
 /// <param name="picture">The picture to draw</param>
 /// <param name="wrap">The way to wrap the picture</param>
 /// <param name="angle">The angle to rotate the image</param>
 public PolygonSymbolizer(Image picture, WrapMode wrap, double angle)
 {
     _patterns = new CopyList <IPattern>();
     _patterns.Add(new PicturePattern(picture, wrap, angle));
 }
Пример #41
0
        public RectTransformAnimation(RectTransform rectTransformToAnimate, RectTransform destinationRectTransform, RectTransform originRectTransform, float duration = 1f, Curve curve = Curve.EaseInOut, WrapMode wrapMode = WrapMode.Once)
        {
            this.rectTransformToAnimate   = rectTransformToAnimate;
            this.originRectTransform      = originRectTransform;
            this.destinationRectTransform = destinationRectTransform;


            this.duration = duration;
            this.curve    = SimpleAnimation.GetCurve(curve);
            this.wrapMode = wrapMode;
        }
Пример #42
0
        /// <summary>
        /// Retrieves a texture from the store and adds it to the atlas.
        /// </summary>
        /// <param name="name">The name of the texture.</param>
        /// <param name="wrapModeS">The texture wrap mode in horizontal direction.</param>
        /// <param name="wrapModeT">The texture wrap mode in vertical direction.</param>
        /// <returns>The texture.</returns>
        public virtual Texture Get(string name, WrapMode wrapModeS, WrapMode wrapModeT)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }

            string key = $"{name}:wrap-{(int)wrapModeS}-{(int)wrapModeT}";

            TaskCompletionSource <Texture> tcs = null;
            Task task;

            lock (retrievalCompletionSources)
            {
                // Check if the texture exists in the cache.
                if (TryGetCached(key, out var cached))
                {
                    return(cached);
                }

                // check if an existing lookup was already started for this key.
                if (!retrievalCompletionSources.TryGetValue(key, out task))
                {
                    // if not, take responsibility for the lookup.
                    retrievalCompletionSources[key] = (tcs = new TaskCompletionSource <Texture>()).Task;
                }
            }

            // handle the case where a lookup is already in progress.
            if (task != null)
            {
                task.Wait();

                // always perform re-lookups through TryGetCached (see LargeTextureStore which has a custom implementation of this where it matters).
                if (TryGetCached(key, out var cached))
                {
                    return(cached);
                }

                return(null);
            }

            this.LogIfNonBackgroundThread(key);

            Texture tex = null;

            try
            {
                tex = getTexture(name, wrapModeS, wrapModeT);
                if (tex != null)
                {
                    tex.LookupKey = key;
                }

                return(CacheAndReturnTexture(key, tex));
            }
            catch (TextureTooLargeForGLException)
            {
                Logger.Log($"Texture \"{name}\" exceeds the maximum size supported by this device ({GLWrapper.MaxTextureSize}px).", level: LogLevel.Error);
            }
            finally
            {
                // notify other lookups waiting on the same name lookup.
                lock (retrievalCompletionSources)
                {
                    Debug.Assert(tcs != null);

                    tcs.SetResult(tex);
                    retrievalCompletionSources.Remove(key);
                }
            }

            return(null);
        }
Пример #43
0
 public void SetWrapMode(WrapMode wrapMode)
 {
     nvttSetInputOptionsWrapMode(options, wrapMode);
 }
Пример #44
0
            public override Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT)
            {
                var lookup = base.GetTexture(componentName, wrapModeS, wrapModeT);

                if (lookup != null)
                {
                    return(lookup);
                }

                // extrapolate frames to test longer animations
                if (extrapolateAnimations)
                {
                    var match = Regex.Match(componentName, "-([0-9]*)");

                    if (match.Length > 0 && int.TryParse(match.Groups[1].Value, out int number) && number < 60)
                    {
                        return(base.GetTexture(componentName.Replace($"-{number}", $"-{number % 2}"), wrapModeS, wrapModeT));
                    }
                }

                return(null);
            }
Пример #45
0
 private async Task <Texture> getTextureAsync(string name, WrapMode wrapModeS = WrapMode.None, WrapMode wrapModeT = WrapMode.None) => loadRaw(await base.GetAsync(name).ConfigureAwait(false), wrapModeS, wrapModeT);
 public override Texture Get(string name, WrapMode wrapModeS, WrapMode wrapModeT) => null;
Пример #47
0
 /// <summary>
 /// Retrieves a texture from the store and adds it to the atlas.
 /// </summary>
 /// <param name="name">The name of the texture.</param>
 /// <param name="wrapModeS">The texture wrap mode in horizontal direction.</param>
 /// <param name="wrapModeT">The texture wrap mode in vertical direction.</param>
 /// <returns>The texture.</returns>
 public Task <Texture> GetAsync(string name, WrapMode wrapModeT, WrapMode wrapModeS) =>
 Task.Run(() => Get(name, wrapModeS, wrapModeT));     // TODO: best effort. need to re-think textureCache data structure to fix this.
Пример #48
0
 public void SetWrapMode(WrapMode mode)
 {
     SetWrapMode(mode, Color_.Black);
 }
Пример #49
0
        /// <summary>
        /// Binds a texture to draw with.
        /// </summary>
        /// <param name="textureId">The texture to bind.</param>
        /// <param name="unit">The texture unit to bind it to.</param>
        /// <param name="wrapModeS">The texture wrap mode in horizontal direction.</param>
        /// <param name="wrapModeT">The texture wrap mode in vertical direction.</param>
        /// <returns>true if the provided texture was not already bound (causing a binding change).</returns>
        public static bool BindTexture(int textureId, TextureUnit unit = TextureUnit.Texture0, WrapMode wrapModeS = WrapMode.None, WrapMode wrapModeT = WrapMode.None)
        {
            var index = GetTextureUnitId(unit);

            if (wrapModeS != CurrentWrapModeS)
            {
                GlobalPropertyManager.Set(GlobalProperty.WrapModeS, (int)wrapModeS);
                CurrentWrapModeS = wrapModeS;
            }

            if (wrapModeT != CurrentWrapModeT)
            {
                GlobalPropertyManager.Set(GlobalProperty.WrapModeT, (int)wrapModeT);
                CurrentWrapModeT = wrapModeT;
            }

            if (last_bound_texture[index] == textureId)
            {
                return(false);
            }

            FlushCurrentBatch();

            GL.ActiveTexture(unit);
            GL.BindTexture(TextureTarget.Texture2D, textureId);

            last_bound_texture[index] = textureId;
            last_bound_texture_is_atlas[GetTextureUnitId(unit)] = false;

            FrameStatistics.Increment(StatisticsCounterType.TextureBinds);
            return(true);
        }
Пример #50
0
 public void SetWrapMode(WrapMode mode, Color_ color)
 {
     SetWrapMode(mode, color, false);
 }
Пример #51
0
 public override void SetFacialAnimation(string anikey, WrapMode wrapmode)
 {
 }
Пример #52
0
        public void SetWrapMode(WrapMode mode, Color_ color, bool clamp)
        {
            Status status = GDIPlus.GdipSetImageAttributesWrapMode(nativeImageAttr, mode, color.ToArgb(), clamp);

            GDIPlus.CheckStatus(status);
        }
Пример #53
0
 public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();
Пример #54
0
 internal static extern void Material_SetShaderParameterAnimation(IntPtr handle, string name, IntPtr animation, WrapMode wrapMode, float speed);
Пример #55
0
 public override void PlayAni(string name, float speed, WrapMode wm)
 {
     SetAni(name, speed, wm);
 }
Пример #56
0
 /// <summary>
 /// Set shader parameter animation.
 /// </summary>
 public void SetShaderParameterAnimation(string name, ValueAnimation animation, WrapMode wrapMode = WrapMode.Loop, float speed = 1f)
 {
     Runtime.ValidateRefCounted(this);
     Material_SetShaderParameterAnimation(handle, name, (object)animation == null ? IntPtr.Zero : animation.Handle, wrapMode, speed);
 }
Пример #57
0
 internal static extern void Material_SetShaderParameterAnimationWrapMode(IntPtr handle, string name, WrapMode wrapMode);
Пример #58
0
 /// <summary>
 /// Set shader parameter animation wrap mode.
 /// </summary>
 public void SetShaderParameterAnimationWrapMode(string name, WrapMode wrapMode)
 {
     Runtime.ValidateRefCounted(this);
     Material_SetShaderParameterAnimationWrapMode(handle, name, wrapMode);
 }
Пример #59
0
 /// <summary>
 /// Creates a new PicturePattern with the specified image
 /// </summary>
 /// <param name="picture">The picture to draw</param>
 /// <param name="wrap">The way to wrap the picture</param>
 /// <param name="angle">The angle to rotate the image</param>
 /// <param name="outlineColor">The color to use for the border symbolizer</param>
 /// <param name="outlineWidth">The width of the line to use for the border symbolizer</param>
 public PolygonSymbolizer(Image picture, WrapMode wrap, double angle, Color outlineColor, double outlineWidth)
 {
     _patterns = new CopyList <IPattern>();
     _patterns.Add(new PicturePattern(picture, wrap, angle));
     OutlineSymbolizer = new LineSymbolizer(outlineColor, outlineWidth);
 }
Пример #60
0
 public AnimationCurveDefaultAttribute(Keyframe startVal, Keyframe endVal, WrapMode postWrap = WrapMode.Loop)
 {
     PostWrap = postWrap;
     StartVal = startVal;
     EndVal   = endVal;
 }