コード例 #1
0
 static public void removeInstance(VideoTexture removeMe)
 {
     if (VTP.videoTextures.Contains(removeMe))
     {
         VTP.videoTextures.Remove(removeMe);
     }
 }
コード例 #2
0
ファイル: pVideo.cs プロジェクト: Crystallinqq/osu-2005
        internal pVideo(string filename, int startTime)
            : base(
                null, FieldTypes.GamefieldRatio, OriginTypes.TopLeft, ClockTypes.Audio,
                new Vector2(GameBase.WindowDefaultWidth / 2, GameBase.WindowDefaultHeight / 2), 0.1F, true, Color.White)
        {
            if (File.Exists(filename))
            {
                video           = new VideoTexture(filename);
                video.startTime = startTime;

                //CurrentScale = (float) GameBase.WindowWidth/video.Width;
                SpriteEffect = SpriteEffects.FlipVertically;

                EndTime        = startTime + video.length;
                Length         = video.length;
                Width          = video.Width;
                Height         = video.Height;
                OriginPosition = new Vector2(video.Width / 2, video.Height / 2);
                DrawWidth      = Width;
                DrawHeight     = Height;
            }

            StartTime = startTime;


            Type = SpriteTypes.Video;
            //Disposable = true;
        }
コード例 #3
0
 static public void addInstance(VideoTexture addMe)
 {
     if (!VTP.videoTextures.Contains(addMe))
     {
         VTP.videoTextures.Add(addMe);
     }
 }
コード例 #4
0
        protected override object CreateResourceConfiguration(string fileName)
        {
            var extension = Path.GetExtension(fileName);

            fileName = PathConvert.GetProjectPath(fileName);

            Texture2D configuration;

            if (Array.IndexOf(VideoExtensions, extension) >= 0)
            {
                if (Control.ModifierKeys == Keys.Control)
                {
                    configuration = new ImageSequence {
                        FileName = fileName
                    }
                }
                ;
                else
                {
                    configuration = new VideoTexture {
                        FileName = fileName
                    }
                };
            }
            else
            {
                configuration = new ImageTexture {
                    FileName = fileName
                }
            };
            configuration.Name = Path.GetFileNameWithoutExtension(fileName);
            return(configuration);
        }
    }
コード例 #5
0
	public override void OnInspectorGUI(){
		//DrawDefaultInspector();
		mytarget = target as VideoTexture;
		 if(!mytarget.videoManagerScript){
			mytarget.videoManagerScript = Camera.main.GetComponent<VideoManager>();
			
			if(!mytarget.videoManagerScript){
			Debug.LogError("You don't have a video manager script anywhere yet, adding one to your main cam!"); 	
			mytarget.videoManagerScript = Camera.main.gameObject.AddComponent<VideoManager>();
			}
		 }		
			
		if(EditorApplication.isPlaying){
			mytarget.videoObject.drawCurrentlyPlayingDetails();
			GUILayout.Label("Video Options:");
			mytarget.videoObject.drawTimeline(false);
			mytarget.videoObject.drawSpeed();
			mytarget.videoObject.drawVolume();
			drawLoopStateEditor();
			mytarget.videoObject.drawIsPaused();
			drawTextureOptionsEditor();
			drawQueueListEditor();
		
		}
		else{
			GUILayout.Label("Video Options:");
			mytarget.videoObject.drawSpeed();
			mytarget.videoObject.drawVolume();
			drawLoopStateEditor();
			mytarget.videoObject.drawIsPausedEditor();
			drawTextureOptionsEditor();
			drawQueueListEditor();
		}	
	}
コード例 #6
0
ファイル: VTP.cs プロジェクト: bdpease/Shaders
    public static void CreateTextureFromVideoTextureCache(IntPtr myptr, int w, int h, IntPtr texID, int w2, int h2, IntPtr texID2)
    {
        if (videoTexturesDict.ContainsKey(myptr))
        {
            VideoTexture myTexture = videoTexturesDict[myptr];
//			Debug.Log ("texture infoz: " + w + " " + h + " " + texID);
            myTexture.UpdateTexture(w, h, texID, w2, h2, texID2);
        }
    }
コード例 #7
0
ファイル: pVideo.cs プロジェクト: notperry1234567890/osu
        internal override void Dispose(bool isDisposing)
        {
            if (video != null)
            {
                video.Dispose();
            }
            video = null;

            base.Dispose(isDisposing);
        }
コード例 #8
0
ファイル: pVideo.cs プロジェクト: Crystallinqq/osu-2005
        public override void Dispose()
        {
            if (video != null)
            {
                video.Dispose();
            }
            video = null;

            base.Dispose();
        }
コード例 #9
0
ファイル: pVideo.cs プロジェクト: notperry1234567890/osu
        internal pVideo(string filename, SkinSource source, Clocks clock, int startTime = 0)
            : base(null, Fields.StoryboardCentre, Origins.Centre, clock, Vector2.Zero, 0.1F, true, Color.White)
        {
            video = new VideoTexture(filename, source, clock);

            StartTime      = (clock == Clocks.Game ? GameBase.Time : 0) + startTime;
            EndTime        = StartTime + video.length;
            Width          = DrawWidth = video.Width;
            Height         = DrawHeight = video.Height;
            OriginPosition = new Vector2(video.Width / 2, video.Height / 2);
        }
コード例 #10
0
ファイル: VTP.cs プロジェクト: bdpease/Shaders
    static public void addInstance(VideoTexture addMe)
    {
        if (!VTP.videoTexturesDict.ContainsKey(addMe.VideoInstance))
        {
            VTP.videoTexturesDict.Add(addMe.VideoInstance, addMe);
        }

        if (!VTP.videoTextures.Contains(addMe))
        {
            VTP.videoTextures.Add(addMe);
        }
    }
コード例 #11
0
    public override void OnInspectorGUI()
    {
        mytarget = target as VideoTexture;
        m_object.Update();

        drawVideoPathInspector();

        m_object.ApplyModifiedProperties();

        EditorGUIUtility.LookLikeControls();


        if (mytarget.videoPaths != null && mytarget.videoPaths.Length > 0 && mytarget.videoPaths[0] != "" && EditorApplication.isPlaying && GUILayout.Button("Reload Videos"))
        {
            mytarget.load();
        }


        if (EditorApplication.isPlaying)
        {
//			mytarget.drawCurrentlyPlayingDetails();
            GUILayout.Label("Video Options:");
            mytarget.drawTimeline(false);
            mytarget.drawSpeed();
            mytarget.drawVolume();
            drawLoopStateEditor();
            mytarget.drawIsPaused();
//			drawTextureOptionsEditor();
//			drawQueueListEditor();
        }
        else
        {
            //		mytarget.drawCurrentlyPlayingDetailsEditor();

            GUILayout.Label("Video Options:");
            mytarget.drawSpeed();
            mytarget.drawVolume();
            drawLoopStateEditor();
            mytarget.drawIsPausedEditor();
//			drawTextureOptionsEditor();
//			drawQueueListEditor();
        }
    }
コード例 #12
0
ファイル: VideoScene.cs プロジェクト: Wiladams/NewTOAPIA
        /// <summary>
        /// Once we have a context, we are able to peform various setup routines
        /// that require us to connect to OpenGL.
        /// </summary>
        protected override void OnSetContext()
        {
            // find out how many video cameras there are.
            int numSources = VideoCaptureDevice.GetNumberOfInputDevices();

            // If there's more than one, then connect to the one that is
            // at position '0' in the index.  To change which camera to use,
            // simply change the index number.
            if (numSources > 4)
            {
                fVideoTexture = VideoTexture.CreateFromDeviceIndex(GI, 4, true);
            }
            else if (numSources > 0)
            {
                fVideoTexture = VideoTexture.CreateFromDeviceIndex(GI, 0, true);
            }

            // Enable texture support as we'll be using that.
            GI.Features.Texturing2D.Enable();
            GI.TexEnv(TextureEnvModeParam.Replace);
        
            // Turn off features that we don't need, and they 
            // just slow down video processing
            GI.Features.AlphaTest.Disable();
            GI.Features.Blend.Disable();
            GI.Features.DepthTest.Disable();
            GI.Features.Dither.Disable();
            GI.Features.Fog.Disable();
            GI.Features.Lighting.Disable();

            // Create the FaceMesh that will receive the gray texture so we 
            // can break it up into 8x8 squares
            fFaceSize = new Vector3D(fVideoTexture.Width, fVideoTexture.Height, 0);

            fYCrCbProcessor = new YCrCbProcessor(GI, fVideoTexture.Width, fVideoTexture.Height);

            // Create the shader programs that will perform the colorization so we can see our results.
            //fRedColorizer = GLSLShaderProgram.CreateUsingVertexAndFragmentStrings(GI, Shaders.ShaderStrings.FixedVert, Shaders.ShaderStrings.redcolorizer_fs);
            //fGreenColorizer = GLSLShaderProgram.CreateUsingVertexAndFragmentStrings(GI, Shaders.ShaderStrings.FixedVert, Shaders.ShaderStrings.greencolorizer_fs);
            //fBlueColorizer = GLSLShaderProgram.CreateUsingVertexAndFragmentStrings(GI, Shaders.ShaderStrings.FixedVert, Shaders.ShaderStrings.bluecolorizer_fs);
            fIntensityColorizer = GLSLShaderProgram.CreateUsingVertexAndFragmentStrings(GI, Shaders.ShaderStrings.FixedVert, Shaders.ShaderStrings.graycolorizer_fs);
        }
コード例 #13
0
// Copyright 2011-2013 Brian Chasalow & Anton Marini - [email protected] - All Rights Reserved.

    //this is an example of how to programmatically create a video texture entirely from code.
    //put this script on any gameobject, or your main camera, or wherever.

    public void Start()
    {
        // be sure to change myVideoPath to the full path of your video, in the form "/Users/me/Desktop/myVideo.mov"
        // or, "http://www.chasalow.com/OSXVTP/demo.mov" (this URL is valid)
        string myVideoPath = "http://www.chasalow.com/OSXVTP/demo.mov";
        // //----------------------------
        GameObject videoTextureGO = GameObject.CreatePrimitive(PrimitiveType.Plane);

        videoTextureGO.name = "VideoTexture";
        videoTextureGO.transform.position    = new Vector3(0, 0, 0);
        videoTextureGO.transform.eulerAngles = new Vector3(90, 180, 0);
        videoTextureGO.SetActive(false);
        videoTextureGO.renderer.material = new Material(Shader.Find("Unlit/Transparent"));

        VideoTexture videoTextureScript = videoTextureGO.AddComponent <VideoTexture>();

        videoTextureScript.videoPaths    = new string[1];
        videoTextureScript.videoPaths[0] = myVideoPath;
        videoTextureScript.IsPaused      = false;
        videoTextureGO.AddComponent <PlaneScaler>();
        videoTextureGO.SetActive(true);
    }
コード例 #14
0
        /// <inheritdoc />
        protected override Texture CreateCameraTexture(int textureWidth, int textureHeight)
        {
            var cameraTexture = new VideoTexture()
            {
                Width  = textureWidth,
                Height = textureHeight,
                Levels = 1,
                Faces  = 0,
                Format = PixelFormat.R8G8B8A8
            };

            var adapter        = Game.Current.Application.Adapter as Adapter.Adapter;
            var textureManager = adapter.Graphics.TextureManager;

            textureManager.UploadTexture(cameraTexture);
            this.dxDevicePtr = this.dxDevice.NativePointer;

            var dxTexture = textureManager.TextureFromHandle <DXTexture>(cameraTexture.TextureHandle).Texture;

            QCAR_setVideoTexture(dxTexture.NativePointer);

            return(cameraTexture);
        }
コード例 #15
0
	void createVideoTexture()
	{
		_videoTexture = new VideoTexture(moviePath, 256, 256, false, 0f, true );
			
		// apply the texture to a material and set the UVs
	    videoScreen.renderer.sharedMaterial.mainTexture = _videoTexture.texture;
	    //LiveTextureBinding.updateMaterialUVScaleForTexture(videoScreen.renderer.sharedMaterial, _videoTexture.texture );
			
		
		// add some event handlers
		_videoTexture.videoDidStartEvent = () =>
		{
			Debug.Log( "Video one started" );
		};
		
		_videoTexture.videoDidFinishEvent = () =>
		{
			// when the video finishes if we are not set to loop this instance is no longer valid
			Debug.Log( "Video one finished" );
		};
		
		Home.onClickedHomeButton += destroyVideoTexture;
	}
コード例 #16
0
ファイル: VideoGUI.cs プロジェクト: pocdev/ar
	void OnGUI()
	{
		float yPos = 5.0f;
		float xPos = 5.0f;
		float width = ( Screen.width >= 960 || Screen.height >= 960 ) ? 320 : 160;
		float height = ( Screen.width >= 960 || Screen.height >= 960 ) ? 80 : 40;
		float heightPlus = height + 10.0f;
		
		
		if( GUI.Button( new Rect( xPos, yPos, width, height ), "Start Video Texture" ) )
		{
			// create the video texture
			_videoTexture = new VideoTexture( "vid.m4v", 640, 360, true );
			
			// apply the texture to a material and set the UVs
	        targetOne.renderer.sharedMaterial.mainTexture = _videoTexture.texture;
	        LiveTextureBinding.updateMaterialUVScaleForTexture( targetOne.renderer.sharedMaterial, _videoTexture.texture );
			
			// add some event handlers
			_videoTexture.videoDidStartEvent = () =>
			{
				Debug.Log( "Video one started" );
			};
			_videoTexture.videoDidFinishEvent = () =>
			{
				// when the video finishes if we are not set to loop this instance is no longer valid
				Debug.Log( "Video one finished" );
			};
		}
		
		
		if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Pause" ) )
		{
			// null check in case Stop was pressed which will kill the VideoTexture
			if( _videoTexture != null )
				_videoTexture.pause();
		}
		
		
		if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Unpause" ) )
		{
			// null check in case Stop was pressed which will kill the VideoTexture
			if( _videoTexture != null )
				_videoTexture.unpause();
		}
		
		
		if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Stop" ) )
		{
			// null check in case Stop was pressed which will kill the VideoTexture
			if( _videoTexture != null )
			{
				_videoTexture.stop();
				_videoTexture = null;
			}
		}
		

		xPos = Screen.width - width - 5.0f;
		yPos = Screen.height - height - 5.0f;
		if( GUI.Button( new Rect( xPos, yPos, width, height ), "Back" ) )
		{
			// if the video texture is still playing kill it
			OnApplicationQuit();
	        
	        Application.LoadLevel( "CameraTestScene" );
		}
		
		
		if( GUI.Button( new Rect( 5, yPos, width, height ), "Play Unity Audio Clip" ) )
		{
			GetComponent<AudioSource>().Play();
		}

		
		
		// Second video texture
		yPos = 5.0f;
		xPos = Screen.width - width - 5;
		if( GUI.Button( new Rect( xPos, yPos, width, height ), "Start Video Texture Two" ) )
		{
			// create the video texture
			_videoTextureTwo = new VideoTexture( "vid2.m4v", 480, 264, false, 0, true );
			
			// apply the texture to a material and set the UVs
	        targetTwo.renderer.sharedMaterial.mainTexture = _videoTextureTwo.texture;
	        LiveTextureBinding.updateMaterialUVScaleForTexture( targetTwo.renderer.sharedMaterial, _videoTextureTwo.texture );
			
			// add some event handlers
			_videoTextureTwo.videoDidStartEvent = () =>
			{
				Debug.Log( "Video two started" );
			};
			_videoTextureTwo.videoDidFinishEvent = () =>
			{
				// when the video finishes if we are not set to loop this instance is no longer valid and this texture is not set to loop
				_videoTextureTwo = null;
				Debug.Log( "Video two finished" );
			};
		}
		
		
		
		if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Pause" ) )
		{
			// null check in case Stop was pressed which will kill the VideoTexture
			if( _videoTextureTwo != null )
				_videoTextureTwo.pause();
		}
		
		
		if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Unpause" ) )
		{
			// null check in case Stop was pressed which will kill the VideoTexture
			if( _videoTextureTwo != null )
				_videoTextureTwo.unpause();
		}
		
		
		if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Stop" ) )
		{
			// null check in case Stop was pressed which will kill the VideoTexture
			if( _videoTextureTwo != null )
			{
				_videoTextureTwo.stop();
				_videoTextureTwo = null;
			}
		}
	}
コード例 #17
0
ファイル: VideoGUI.cs プロジェクト: pocdev/ar
	void OnApplicationPause( bool paused )
	{
		if( paused )
		{
	        // if the video texture is still playing kill it
			if( _videoTexture != null )
			{
				_videoTexture.stop();
				_videoTexture = null;
			}
			
			if( _videoTextureTwo != null )
			{
				_videoTextureTwo.stop();
				_videoTextureTwo = null;
			}
		}
	}
コード例 #18
0
ファイル: VideoGUI.cs プロジェクト: pocdev/ar
	void OnApplicationQuit()
	{
        // if the video texture is still playing kill it
		if( _videoTexture != null )
		{
			_videoTexture.stop();
			_videoTexture = null;
		}
		
		if( _videoTextureTwo != null )
		{
			_videoTextureTwo.stop();
			_videoTextureTwo = null;
		}
	}
コード例 #19
0
ファイル: VideoTextureManager.cs プロジェクト: pocdev/ar
	public static void registerInstance( string instanceId, VideoTexture instance )
	{
		videoTextureInstances[instanceId] = instance;
	}
コード例 #20
0
	void destroyVideoTexture()
	{
		_videoTexture.stop();
		_videoTexture = null;
		
		Home.onClickedHomeButton -= destroyVideoTexture;
	}
コード例 #21
0
	public void addInstance(VideoTexture addMe){
		if(!myVideoTextures.Contains(addMe)){
			myVideoTextures.Add(addMe);
		}
	}
コード例 #22
0
	public void removeInstance(VideoTexture removeMe){
		if(myVideoTextures.Contains(removeMe)){
			myVideoTextures.Remove(removeMe);
		}
	}
コード例 #23
0
ファイル: WebCamTexture.cs プロジェクト: Wiladams/NewTOAPIA
 public WebCamTexture(GraphicsInterface gi, int webCamDevice)
 {
     //fWebcamTexture = VideoTexture.CreateFromDeviceIndex(gi, webCamDevice, 320, 240, true);
     fWebcamTexture = VideoTexture.CreateFromDeviceIndex(gi, webCamDevice, true);
 }