123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using CommonUI.Display;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using UnityEngine;
- namespace CommonUI_Unity3D.Impl
- {
- public class UnityImage3D : Image, IUnityImageInterface
- {
- internal int mLogicW, mLogicH;
- internal float mMaxU, mMaxV;
- private RenderTexture mTexture;
- public override int Width
- {
- get
- {
- return mLogicW;
- }
- }
- public override int Height
- {
- get
- {
- return mLogicH;
- }
- }
- public override float MaxU
- {
- get
- {
- return mMaxU;
- }
- }
- public override float MaxV
- {
- get
- {
- return mMaxV;
- }
- }
- public Texture Texture
- {
- get
- {
- return mTexture;
- }
- }
- public Texture TextureMask
- {
- get
- {
- return null;
- }
- }
- internal static void FilterTexture(RenderTexture tex)
- {
- tex.filterMode = FilterMode.Bilinear;
- tex.wrapMode = TextureWrapMode.Clamp;
- tex.anisoLevel = 0;
- tex.mipMapBias = 0;
- }
- public UnityImage3D(RenderTexture tex, string name)
- {
- this.name = name;
- if (tex == null) { Debug.Log("Create UnityImage3D Error tex = null"); }
- this.mTexture = tex;
- this.mTexture.name = name;
- FilterTexture(tex);
- this.mLogicW = tex.width;
- this.mLogicH = tex.height;
- this.mMaxU = 1f;
- this.mMaxV = 1f;
- }
- protected override void Disposing()
- {
- if (mTexture != null)
- {
- RenderTexture.Destroy(mTexture);
- mTexture = null;
- }
- }
- public override void CopyPixels(Image src, int sx, int sy, int sw, int sh, int dx, int dy)
- {
- //do nothing.
- }
- public override void Flush()
- {
- //do nothing.
- }
- }
- }
|