Inheritance: Texture
コード例 #1
1
 /// <summary>
 /// Initializes a new instance of the <see cref="UnityGwenRenderer"/> class.
 /// </summary>
 /// <param name="target">Unity render target.</param>
 public UnityGwenRenderer()
 {
     whiteTex = new Texture2D(1, 1);
     whiteTex.SetPixel(0, 0, UnityEngine.Color.white);
     whiteTex.Apply();
     m_ViewScale = Vector2.one;
 }
コード例 #2
0
ファイル: GUIMatPicker.cs プロジェクト: gviaud/OS-unity-5
    public void setContent()
    {
        if(m_grassTex == null)
            m_grassTex = m_grassSkybox.GetComponent<GrassHandler>().GetDefaultTexs();

        if(m_grassThumbs == null){
            m_grassThumbs = m_grassSkybox.GetComponent<GrassHandler>().GetDefaultThumbs();
        }
        int i=0;
        if(m_grassThumbs.Length == m_grassTex.Length){
            int count = m_grassTex.Length;
            m_texArray = new Texture2D[count];
            Texture2D[] thumbsArray = new Texture2D[count];
            for(;i<count;i++){
                m_texArray[i] =(Texture2D) m_grassTex[i];
                thumbsArray[i] =(Texture2D) m_grassThumbs[i];
            }

            Texture2D grassTex;
            i=0;
            _matTexList = new GUIUpperList (1, 0, TextManager.GetText("Material"), "sousMenuOn", "sousMenuOff", this);
            _matTexList.setImgContent(m_texArray, thumbsArray);
            //_matTexList.display();
            visibility = true;
        }
    }
コード例 #3
0
ファイル: CQuadtree_Indie.cs プロジェクト: dexo568/LightFight
    public CQuadtree(Vector3 up, Vector3 front, CPlanet planet, Texture2D shapeTex)
    {
        m_Planet = planet;
        m_ShapeTex = shapeTex;

        m_Up = m_SUp = up;
        m_Front = m_SFront = front;
        m_Right = -Vector3.Cross(m_Up, m_Front);

        m_Parent = null;
        m_SplitLevel = 0;
        m_Size = m_Planet.m_Radius * 2;

        m_Neighbors[0].node = m_Neighbors[1].node = m_Neighbors[2].node = m_Neighbors[3].node = null;
        m_Neighbors[0].isFixed = m_Neighbors[1].isFixed = m_Neighbors[2].isFixed = m_Neighbors[3].isFixed = false;
        m_Children[0] = m_Children[1] = m_Children[2] = m_Children[3] = null;

        m_NeedsRejoinCount = 0;
        m_HasChildren = false;
        m_NeedsReedge = true;
        m_NeedsTerrain = true;
        m_GapFixMask = 15;

        m_NormalMapTex = null;

        GenVolume();

        m_Plane = new Plane(m_Volume.vertices[0], m_Volume.vertices[2], m_Volume.vertices[1]);
    }
コード例 #4
0
ファイル: WaterNoise.cs プロジェクト: ewout99/Stark_CPR
 void Start()
 {
     rend = GetComponent<Renderer>();
     noiseTex = new Texture2D(pixWidth, pixHeight);
     pix = new Color[noiseTex.width * noiseTex.height];
     rend.material.mainTexture = noiseTex;
 }
コード例 #5
0
    public void Generate2DTexture()
    {
        texture2D = new Texture2D(n,n,TextureFormat.ARGB32,true);
        int size = n*n;
        Color[] cols = new Color[size];
        float u,v;
        int idx = 0;
        Color c = Color.white;
        for(int i = 0; i < n; i++) {
            u = i/(float)n;
            for(int j = 0; j < n; j++, ++idx) {
              	v = j/(float)n;
                float noise = Mathf.PerlinNoise(u,v);
                c.r = c.g = c.b = noise;
                cols[idx] = c;

            }
        }

        texture2D.SetPixels(cols);
        texture2D.Apply();
        renderer.material.SetTexture("g_tex", texture2D);

        //Color[] cs = texture3D.GetPixels();
        //for(int i = 0; i < 10; i++)
        //	Debug.Log (cs[i]);
    }
コード例 #6
0
    /// <summary>
    /// Reads from the provided file name all parameters and data for a
    /// heightmap.  If the data for the heightmap does not exist, then
    /// no data is written to the provided texture.
    /// </summary>
    /// <param name='fileName'>
    /// The file name.  This can be relative or fully-qualified.
    /// </param>
    /// <param name='no'>
    /// The <see cref="NormalOptions" /> that will store read-in parameters.
    /// </param>
    /// <param name='co'>
    /// The <see cref="CloudOptions" /> that will store read-in parameters for
    /// <see cref="CloudFractal" />.
    /// </param>
    /// <param name='wo'>
    /// The <see cref="WorleyOptions" />  that will store read-in parameters for
    /// <see cref="WorleyNoise" />.
    /// </param>
    /// <param name='tex'>
    /// The <code>Texture2D</code> containing the heightmap data.
    /// </param>
    public static void Read(string fileName, ref NormalOptions no,
	                        ref CloudOptions co, ref VoronoiOptions vo,
							ref Texture2D tex)
    {
        using(BinaryReader r = new BinaryReader(File.OpenRead(fileName)))
        {
            no.size = r.ReadInt32();
            no.seed = r.ReadInt32();
            no.cloudInf = r.ReadSingle();
            no.voronoiInf = r.ReadSingle();
            no.useThermalErosion = r.ReadBoolean();
            no.useHydroErosion = r.ReadBoolean();
            no.showSeams = r.ReadBoolean();

            co.upperLeftStart = r.ReadSingle();
            co.lowerLeftStart = r.ReadSingle();
            co.lowerRightStart = r.ReadSingle();
            co.upperRightStart = r.ReadSingle();

            vo.metric = (DistanceFunctions.DistanceMetric)r.ReadInt32();
            vo.combiner = (CombinerFunctions.CombineFunction)r.ReadInt32();
            vo.numberOfFeaturePoints = r.ReadInt32();
            vo.numberOfSubregions = r.ReadInt32();
            vo.multiplier = r.ReadSingle();

            tex.Resize(no.size, no.size);
            int bLeft = (int)(r.BaseStream.Length - r.BaseStream.Position);
            if(bLeft > 0)
                tex.LoadImage(r.ReadBytes(bLeft));
        }
    }
コード例 #7
0
    IEnumerator ScreenshotEncode()
    {
        // wait for graphics to render
        yield return new WaitForEndOfFrame();

        // create a texture to pass to encoding
        Texture2D texture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);

        // put buffer into texture
        texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
        texture.Apply();

        // split the process up--ReadPixels() and the GetPixels() call inside of the encoder are both pretty heavy
        yield return 0;

        byte[] bytes = texture.EncodeToPNG();

        count = PlayerPrefs.GetInt("count");

        // save our test image (could also upload to WWW)
        File.WriteAllBytes(Application.dataPath + "/../testscreen-" + count + ".png", bytes);
        count++;

        PlayerPrefs.SetInt("count", count);

        // Added by Karl. - Tell unity to delete the texture, by default it seems to keep hold of it and memory crashes will occur after too many screenshots.
        DestroyObject(texture);

        Debug.Log( Application.dataPath + "/../testscreen-" + count + ".png" );
    }
コード例 #8
0
ファイル: IconsFactory.cs プロジェクト: Baensi/Assets
 private Texture2D loadIcon(string path)
 {
     Texture2D result = new Texture2D(1, 1);
         result.LoadImage(System.IO.File.ReadAllBytes(PATH+path));
     result.Apply();
     return result;
 }
コード例 #9
0
ファイル: DynamicGUIStyle.cs プロジェクト: russboss/VisTest2
    void Start()
    {
        _img = (Texture2D)Resources.Load("bg1");
        _img2 = (Texture2D)Resources.Load("bg2");

        style = new GUIStyle();

        style.font = (Font)Resources.Load("Fonts/Arial");

        style.active.background = _img2; // not working
        style.hover.background = _img2; // not working
        style.normal.background = _img; // not working

        style.active.textColor = Color.red; // not working
        style.hover.textColor = Color.blue; // not working
        style.normal.textColor = Color.white;

        int border = 30;

        style.border.left = border; // not working, since backgrounds aren't showing
        style.border.right = border; // ---
        style.border.top = border; // ---
        style.border.bottom = border; // ---

        style.stretchWidth = true; // ---
        style.stretchHeight = true; // not working, since backgrounds aren't showing

        style.alignment = TextAnchor.MiddleCenter;
    }
コード例 #10
0
ファイル: FaceDetect.cs プロジェクト: kaorun55/UnitySandbox
    // Use this for initialization
    void Start()
    {
        // カメラを列挙する
        // 使いたいカメラのインデックスをVideoIndexに入れる
        // 列挙はUnityで使うのはOpenCVだけど、インデックスは同じらしい
        var devices = WebCamTexture.devices;
        for ( int i = 0; i < devices.Length; i++ ) {
            print( string.Format( "index {0}:{1}", i, devices[i].name) );
        }

        // ビデオの設定
        video = new VideoCapture( VideoIndex );
        video.Set( CaptureProperty.FrameWidth, Width );
        video.Set( CaptureProperty.FrameHeight, Height );

        print( string.Format("{0},{1}", Width, Height) );

        // 顔検出器の作成
        cascade = new CascadeClassifier( Application.dataPath + @"/haarcascade_frontalface_alt.xml" );

        // テクスチャの作成
        texture = new Texture2D( Width, Height, TextureFormat.RGB24, false );
        renderer.material.mainTexture = texture;

        // 変換用のカメラの作成
        _Camera = GameObject.Find( Camera.name ).camera;
        print( string.Format( "({0},{1})({2},{3})", Screen.width, Screen.height, _Camera.pixelWidth, _Camera.pixelHeight ) );
    }
コード例 #11
0
ファイル: Main.cs プロジェクト: inoook/Homography
    // Update is called once per frame
    void Update()
    {
        // new Vector2 はsource Textureでのピクセル位置

        float srcW = source.width;
        float srcH = source.height;

        // src texture uv position
        Vector2[] uvs = new Vector2[4];
        uvs[0] = new Vector2(P1.localPosition.x/2, P1.localPosition.y/1) /10;
        uvs[1] = new Vector2(P2.localPosition.x/2, P2.localPosition.y/1) /10;
        uvs[2] = new Vector2(P3.localPosition.x/2, P3.localPosition.y/1) /10;
        uvs[3] = new Vector2(P4.localPosition.x/2, P4.localPosition.y/1) /10;

        Color32[] colors = Homography.GetTransformedColors( source, dstWidth, dstHeight,
                                                    new Vector2(uvs[0].x * srcW, uvs[0].y * srcH),
                                                    new Vector2(uvs[1].x * srcW, uvs[1].y * srcH),
                                                    new Vector2(uvs[2].x * srcW, uvs[2].y * srcH),
                                                    new Vector2(uvs[3].x * srcW, uvs[3].y * srcH));
        if(target == null){
            target = new Texture2D(dstWidth, dstHeight);
        }
        target.SetPixels32(colors, 0);
        target.Apply();

        targetRender.material.mainTexture = target;
    }
コード例 #12
0
	/// <summary>
	/// Draws and returns the value of a GUI.Button.
	/// </summary>
	/// <param name="pos">The position of the button as an interpolant between 0 and 1.</param>
	/// <returns>Whether the button was pressed.</returns>
	private bool MainScreenButton(Vector2 posLerp, Texture2D tex, ScreenPositioningData data)
	{
		return data.GUIButton(posLerp, Cellphone.MainScreen.ButtonSize,
							  new Vector2(Cellphone.MainScreen.ScreenBorder.x * data.ScreenSizeScale.x,
							 			  Cellphone.MainScreen.ScreenBorder.y * data.ScreenSizeScale.y),
							  Cellphone.ButtonStyle, tex);
	}
コード例 #13
0
    void OnEnable()
    {
		displayManager = target as RUISDisplayManager;
		
        displays = serializedObject.FindProperty("displays");
		ruisMenuPrefab = serializedObject.FindProperty("ruisMenuPrefab");
		
		guiX = serializedObject.FindProperty("guiX");
		guiY = serializedObject.FindProperty("guiY");
		guiZ = serializedObject.FindProperty("guiZ");
		guiScaleX = serializedObject.FindProperty("guiScaleX");
		guiScaleY = serializedObject.FindProperty("guiScaleY");
		hideMouseOnPlay = serializedObject.FindProperty("hideMouseOnPlay");
		
		displayManagerLink = new SerializedObject(displayManager);
		guiDisplayChoiceLink = displayManagerLink.FindProperty("guiDisplayChoice");
		
//        allowResolutionDialog = serializedObject.FindProperty("allowResolutionDialog");
        displayPrefab = Resources.Load("RUIS/Prefabs/Main RUIS/RUISDisplay") as GameObject;

        displayBoxStyle = new GUIStyle();
        displayBoxStyle.normal.textColor = Color.white;
        displayBoxStyle.alignment = TextAnchor.MiddleCenter;
        displayBoxStyle.border = new RectOffset(2, 2, 2, 2);
        displayBoxStyle.margin = new RectOffset(1, 0, 0, 0);
        displayBoxStyle.wordWrap = true;

        monoDisplayTexture = Resources.Load("RUIS/Editor/Textures/monodisplay") as Texture2D;
        stereoDisplayTexture = Resources.Load("RUIS/Editor/Textures/stereodisplay") as Texture2D;
		
		menuCursorPrefab = serializedObject.FindProperty("menuCursorPrefab");
		menuLayer = serializedObject.FindProperty("menuLayer");
    }
コード例 #14
0
ファイル: Monitor.cs プロジェクト: Cilph/ProgCom
        public Monitor(Int32[] arr, UInt16 ptr, UInt16 chars, UInt16 colPtr, UInt16 modePointer)
        {
            mem = arr;
            pointer = ptr;
            charSetPtr = chars;
            colors = new Color[16];
            modePtr = modePointer;
            for (int i = 0; i < 16; ++i) {
                colors[i] = new Color();
                colors[i].a = 1.0f;
            }
            colorPointer = colPtr;

            image = new Texture2D(256, 256, TextureFormat.ARGB32, false);
            windowPos = new Rect();
            if ((windowPos.x == 0) && (windowPos.y == 0))//windowPos is used to position the GUI window, lets set it in the center of the screen
            {
                windowPos = new Rect(Screen.width / 2, Screen.height / 2, 100, 100);
            }
            //Set all the pixels to black. If you don't do this the image contains random junk.
            for (int y = 0; y < image.height; y++) {
                for (int x = 0; x < image.width; x++) {
                    image.SetPixel(x, y, Color.black);
                }
            }
            image.Apply();
        }
コード例 #15
0
		public static bool LoadTexture2DLutFromImage( Texture2D texture, ToolSettings settings, out Texture2D lutTexture )
		{
			var width = settings.Resolution.TargetWidth;
			var height = settings.Resolution.TargetHeight;

			var size = settings.LUT.Size;
			var cols = settings.LUT.Columns;
			var rows = settings.LUT.Rows;

			var imageData = texture.GetPixels();

			var lutText = new Texture2D( size * size, size, TextureFormat.ARGB32, false );
			var lutData = new Color[ size * size * size ];


			for ( int h = 0, i = 0; h < size; h++ )
			{
				for ( int r = 0; r < rows; r++ )
				{
					for ( int w = 0; w < size * cols; w++ )
					{
						var x = w;
						var y = h + r * size;
						y = height - 1 - y;
						lutData[ i++ ] = imageData[ x + y * width ];
					}
				}
			}

			lutText.SetPixels( lutData );
			lutText.Apply();
			lutTexture = lutText;

			return true;
		}
コード例 #16
0
 public void SetSize(int w, int h)
 {
     Width = w;
     Height = h;
     Texture = new Texture2D(w, h, TextureFormat.RGB24, false);
     Texture.filterMode = FilterMode.Point;
 }
コード例 #17
0
        public static Texture2D LoadTextureDXT( string path, TextureFormat format, bool mipmap = true )
        {
            var a = Path.Combine( GenFilePaths.CoreModsFolderPath, LoadedModManager.LoadedMods.ToList().Find( s => s.name == "LT_RedistHeat" ).name );
            var b = Path.Combine( a, "Textures" );
            var filePath = Path.Combine( b,  path + ".dds");
            var bytes = File.ReadAllBytes( filePath );

            if (format != TextureFormat.DXT1 && format != TextureFormat.DXT5)
                throw new Exception("Invalid TextureFormat. Only DXT1 and DXT5 formats are supported by this method.");

            var ddsSizeCheck = bytes[4];
            if (ddsSizeCheck != 124)
                throw new Exception("Invalid DDS DXT texture. Unable to read");  //this header byte should be 124 for DDS image files

            var height = bytes[13] * 256 + bytes[12];
            var width = bytes[17] * 256 + bytes[16];

            var dxtBytes = new byte[bytes.Length - DDSHeaderSize];
            Buffer.BlockCopy(bytes, DDSHeaderSize, dxtBytes, 0, bytes.Length - DDSHeaderSize);

            var texture = new Texture2D(width, height, format, mipmap);
            texture.LoadRawTextureData(dxtBytes);
            texture.Apply();

            return (texture);
        }
コード例 #18
0
	void Update () 
	{
		if(manager && manager.IsInitialized())
		{
			foregroundTex = manager.GetUsersLblTex();
		}
	}
コード例 #19
0
    /// <summary>
    /// Converts vector data stored within a texture using the specified basis.  Assume all calculations are performed in tangent space.
    /// </summary>
    /// <param name='basis'>
    /// Basis to multiply the vector values against.
    /// </param>
    /// <param name='vectorData'>
    /// Texture2D containing vector data.  Textures are passed by reference, so make sure to copy beforehand if you don't want to overwrite your data!
    /// </param>
    public static void ConvertTangentBasis(Matrix4x4 basis, ref Texture2D vectorData, bool recomputeZ = false)
    {
        Color[] colorData = vectorData.GetPixels();
        Texture2D tmpTexture = new Texture2D(vectorData.width, vectorData.height, TextureFormat.ARGB32, false);

        for (int i = 0; i < colorData.Length; i++)
        {
            Color vecData = new Color(colorData[i].r, colorData[i].g, colorData[i].b, 1);
            vecData.r = Vector3.Dot(new Vector3(basis.m00, basis.m01, basis.m02), UnpackUnitVector(new Vector3(colorData[i].r, colorData[i].g, colorData[i].b))) * 0.5f + 0.5f;
            vecData.g = Vector3.Dot(new Vector3(basis.m10, basis.m11, basis.m12), UnpackUnitVector(new Vector3(colorData[i].r, colorData[i].g, colorData[i].b))) * 0.5f + 0.5f;
            if (recomputeZ)
            {
                vecData.r = vecData.r * 2 - 1;
                vecData.g = vecData.g * 2 - 1;
                vecData.b = Mathf.Sqrt(1 - vecData.r * vecData.r - vecData.g * vecData.g) * 0.5f + 0.5f;
                vecData.r = vecData.r * 0.5f + 0.5f;
                vecData.g = vecData.g * 0.5f + 0.5f;
            } else {
                vecData.b = Vector3.Dot(new Vector3(basis.m20, basis.m21, basis.m22), UnpackUnitVector(new Vector3(colorData[i].r, colorData[i].g, colorData[i].b))) * 0.5f + 0.5f;
            }
            colorData[i] = vecData;
        }
        tmpTexture.SetPixels(colorData);
        tmpTexture.Apply();
        vectorData = tmpTexture;
    }
コード例 #20
0
ファイル: CaptureCamera.cs プロジェクト: zhutaorun/unitygame
    Texture2D Capture(Camera camera, Rect rect)
    {
        // 创建一个RenderTexture对象
        RenderTexture rt = new RenderTexture((int)rect.width, (int)rect.height, 0);
        // 临时设置相关相机的targetTexture为rt, 并手动渲染相关相机
        camera.targetTexture = rt;
        camera.Render();
        //ps: --- 如果这样加上第二个相机,可以实现只截图某几个指定的相机一起看到的图像。
        //ps: camera2.targetTexture = rt;
        //ps: camera2.Render();
        //ps: -------------------------------------------------------------------

        // 激活这个rt, 并从中中读取像素。
        RenderTexture.active = rt;
        Texture2D screenShot = new Texture2D((int)rect.width, (int)rect.height, TextureFormat.ARGB32, false);
        screenShot.ReadPixels(rect, 0, 0);// 注:这个时候,它是从RenderTexture.active中读取像素
        screenShot.Apply();

        // 重置相关参数,以使用camera继续在屏幕上显示
        camera.targetTexture = null;
        //ps: camera2.targetTexture = null;
        RenderTexture.active = null; // JC: added to avoid errors
        GameObject.Destroy(rt);
        // 最后将这些纹理数据,成一个png图片文件  
        byte[] bytes = screenShot.EncodeToPNG();
        string filename = Application.dataPath + "/Screenshot.png";
        System.IO.File.WriteAllBytes(filename, bytes);
        Debug.Log(string.Format("截屏了一张照片: {0}", filename));

        return screenShot;
    }
コード例 #21
0
ファイル: FB_Score.cs プロジェクト: JulianPaul/WhackBash
	private void OnLargeImageLoaded(Texture2D image) {
		if(image != null && !profileImages.ContainsKey(FB_ProfileImageSize.large)) {
			profileImages.Add(FB_ProfileImageSize.large, image);
		}
		
		OnProfileImageLoaded(this);
	}
コード例 #22
0
ファイル: BGMotionManager.cs プロジェクト: yosun/DDAR
    public static BGMotionManager GetInstance()
    {
        if (instance == null) {
            print("getting lock");
            lock (_lock) {
                if (instance == null) {
                    container = new GameObject ("BGMotionManager");
                    instance = container.AddComponent (typeof(BGMotionManager)) as BGMotionManager;

                    instance.bodyTrackerKeyboard = new BGBodyTrackerKeyboard (instance);

                    monoTrackerContainer = new GameObject("monoTrackerContainer");
                    print("made mono tracker");
                    instance.bodyTrackerMono = monoTrackerContainer.AddComponent(typeof(BGBodyTrackerMono)) as BGBodyTrackerMono;
                    ((instance.bodyTrackerMono) as BGBodyTrackerMono).SetOwner(instance);

                    nativeTrackerContainer = new GameObject("nativeTrackerContainer");
                    instance.bodyTrackerNative = nativeTrackerContainer.AddComponent(typeof(BGBodyTrackerNative)) as BGBodyTrackerNative;
                    ((instance.bodyTrackerNative) as BGBodyTrackerNative).SetOwner(instance);

                    feedbackTexture = new Texture2D(256, 256, TextureFormat.ARGB32, false);
                    DontDestroyOnLoad (container);
                }
            }
        }
        return instance;
    }
コード例 #23
0
ファイル: FB_Score.cs プロジェクト: JulianPaul/WhackBash
	private void OnNormalImageLoaded(Texture2D image) {
		if(image != null && !profileImages.ContainsKey(FB_ProfileImageSize.normal)) {
			profileImages.Add(FB_ProfileImageSize.normal, image);
		}
		
		OnProfileImageLoaded(this);
	}
コード例 #24
0
ファイル: JPGEncoder.cs プロジェクト: jsr2k1/gato-book-test
    public BitmapData(Texture2D texture)
    {
        height = texture.height;
        width = texture.width;

        pixels = texture.GetPixels();
    }
コード例 #25
0
 // RimWorld.AreaAllowedGUI
 private static void DoZoneSelector( Rect rect, ref Zone_Stockpile zoneAllowed, Zone_Stockpile zone, Texture2D tex)
 {
     rect = rect.ContractedBy( 1f );
     GUI.DrawTexture( rect, tex );
     Text.Anchor = TextAnchor.MiddleLeft;
     string label = zone?.label ?? "Any stockpile";
     Rect innerRect = rect;
     innerRect.xMin += 3f;
     innerRect.yMin += 2f;
     Widgets.Label( innerRect, label );
     if( zoneAllowed == zone )
     {
         Widgets.DrawBox( rect, 2 );
     }
     if( Mouse.IsOver( rect ) )
     {
         if( zone != null )
         {
             if ( zone.AllSlotCellsList() != null && zone.AllSlotCellsList().Count > 0 )
                 Find.CameraDriver.JumpTo( zone.AllSlotCellsList().FirstOrDefault() );
         }
         if( Input.GetMouseButton( 0 ) &&
              zoneAllowed != zone )
         {
             zoneAllowed = zone;
             SoundDefOf.DesignateDragStandardChanged.PlayOneShotOnCamera();
         }
     }
     TooltipHandler.TipRegion( rect, label );
     Text.Anchor = TextAnchor.UpperLeft;
 }
コード例 #26
0
			public MeshBakerMaterialTexture(Texture2D tx, Vector2 o, Vector2 s, Vector2 oUV, Vector2 sUV){
				t = tx;
				offset = o;
				scale = s;
				obUVoffset = oUV;
				obUVscale = sUV;
			}
コード例 #27
0
    public void Resize( int _Width, int _Height )
    {
        m_Width = _Width;
        m_Height = _Height;

        if (m_Texture == null)
        {
            m_Texture = new Texture2D(m_Width, m_Height, TextureFormat.RGBA32, false);
        }
        else
        {
            m_Texture.Resize(m_Width, m_Height, TextureFormat.RGBA32, false);
            m_Texture.Apply(false, false);
        }
        //m_Texture.filterMode = FilterMode.Point;

        if (m_WebView != null)
        {
            m_WebView.Resize(m_Width, m_Height);
        }
        else
        {
            m_WebView = AwesomiumUnityWebCore.CreateWebView(m_Width, m_Height);
        }
    }
コード例 #28
0
		//assign edilen objeler statik olmali
		public override void loadResources()
		{
			staticTowerObject = (GameObject)Resources.Load("3Ds/Towers/Physics/BallistaTower/TowerObject");            
			staticTowerIcon = (Texture2D)Resources.Load("3Ds/Towers/Physics/BallistaTower/GUI/towerIcon");
            staticCreateSound = (AudioClip)Resources.Load("Sound/tower_build");
			staticRangeProjector = ((GameObject)Resources.Load ("3Ds/Scenes/Game/RangeProjector")).GetComponent<Projector>();
		}
コード例 #29
0
ファイル: About.cs プロジェクト: davidlawson/ggj2016
		public void OnFocus()
		{
			string[] guids = AssetDatabase.FindAssets( "About t:Texture" );
			string asset = "";

			foreach ( string guid in guids )
			{
				string path = AssetDatabase.GUIDToAssetPath( guid );
				if ( path.EndsWith( AboutImagePath ) )
				{
					asset = path;
					break;
				}
			}

			if ( !string.IsNullOrEmpty( asset ) )
			{
				TextureImporter importer = AssetImporter.GetAtPath( asset ) as TextureImporter;

				if ( importer.textureType != TextureImporterType.GUI )
				{
					importer.textureType = TextureImporterType.GUI;
					AssetDatabase.ImportAsset( asset );
				}

				m_aboutImage = AssetDatabase.LoadAssetAtPath( asset, typeof( Texture2D ) ) as Texture2D;
			}
			else
				Debug.LogWarning( "[AmplifyColor] About image not found at " + AboutImagePath );
		}
コード例 #30
-1
    private GLexTexture(Texture2D texture)
        : base()
    {
        mTexture = texture;
        mImporter = (TextureImporter)AssetImporter.GetAtPath(OriginalURL);

        // texture need to be readable for export
        if (!mImporter.isReadable) {
            Debug.LogWarning("GLexTexture.Construct: Setting texture " + Name + " as Readable, or export will fail!");

            mImporter.isReadable = true;
            AssetDatabase.ImportAsset(OriginalURL);
            mImporter = (TextureImporter)AssetImporter.GetAtPath(OriginalURL);
        }

        if (IsARGB32orRGB24) {
            _dataBytes = mTexture.EncodeToPNG();
        }
        else {
            _dataBytes = new JPGEncoder(mTexture, GLexConfig.JPEGQuality).GetBytes();
        }
        _dataBinaryKeystring = NamesUtil.GenerateBinaryId(_dataBytes, GLex.Instance.UserName);

        mTextures.Add(this);
    }