Beispiel #1
0
        static void textureManager_OnTextureLoaded(SceneNode node, Texture texture, Dimension2Di sourceDimension)
        {
            if (texture.Size == PreviewTextureSize || texture.Name.Path == "NoPreviewTexture")
            {
                float a = (float)sourceDimension.Height / sourceDimension.Width;
                animationManager.Remove(node);
                animationManager.Add(node, 400, new Vector3Df(node.Position.X, 0, node.Position.Z), null, new Vector3Df(1, 1, a));

                if (texture.Name.Path != "NoPreviewTexture")
                {
                    previewPlateInfo[node.ID] += "\n" + sourceDimension.ToString();
                    node.ID |= SelectableNodeIdFlag;
                }
            }
        }
        void thread_LoadTexture(SceneNode node, string path, Dimension2Di size)
        {
            Texture      t;
            Dimension2Di si;
            Image        i = irrDevice.DriverNoCheck.CreateImage(path);

            if (i != null)
            {
                Image j = irrDevice.DriverNoCheck.CreateImage(ColorFormat.A8R8G8B8, size);
                i.CopyToScaling(j);

                irrDevice.Lock();
                t = irrDevice.Driver.AddTexture(path + "|" + size.ToString(), j);
                irrDevice.Unlock();

                si = i.Dimension;

                i.Drop();
                j.Drop();

                lock (loadedTextures)
                {
                    loadedTextures.Add(t.Name.Path);
                }
            }
            else
            {
                t  = noPreviewTexture;
                si = noPreviewTexture.Size;
            }

            irrDevice.Lock();
            node.SetMaterialTexture(0, t);
            irrDevice.Unlock();

            if (OnTextureLoaded != null)
            {
                OnTextureLoaded(node, t, si);
            }

            node.Drop();
        }
		void thread_LoadTexture(SceneNode node, string path, Dimension2Di size)
		{
			Texture t;
			Dimension2Di si;
			Image i = irrDevice.DriverNoCheck.CreateImage(path);

			if (i != null)
			{
				Image j = irrDevice.DriverNoCheck.CreateImage(ColorFormat.A8R8G8B8, size);
				i.CopyToScaling(j);

				irrDevice.Lock();
				t = irrDevice.Driver.AddTexture(path + "|" + size.ToString(), j);
				irrDevice.Unlock();

				si = i.Dimension;

				i.Drop();
				j.Drop();

				lock (loadedTextures)
				{
					loadedTextures.Add(t.Name.Path);
				}
			}
			else
			{
				t = noPreviewTexture;
				si = noPreviewTexture.Size;
			}

			irrDevice.Lock();
			node.SetMaterialTexture(0, t);
			irrDevice.Unlock();

			if (OnTextureLoaded != null)
				OnTextureLoaded(node, t, si);

			node.Drop();
		}
Beispiel #4
0
		static void textureManager_OnTextureLoaded(SceneNode node, Texture texture, Dimension2Di sourceDimension)
		{
			if (texture.Size == PreviewTextureSize || texture.Name.Path == "NoPreviewTexture")
			{
				float a = (float)sourceDimension.Height / sourceDimension.Width;
				animationManager.Remove(node);
				animationManager.Add(node, 400, new Vector3Df(node.Position.X, 0, node.Position.Z), null, new Vector3Df(1, 1, a));

				if (texture.Name.Path != "NoPreviewTexture")
				{
					previewPlateInfo[node.ID] += "\n" + sourceDimension.ToString();
					node.ID |= SelectableNodeIdFlag;
				}
			}
		}