本文整理汇总了C#中UnityEngine.WebCamTexture.Play方法的典型用法代码示例。如果您正苦于以下问题:C# WebCamTexture.Play方法的具体用法?C# WebCamTexture.Play怎么用?C# WebCamTexture.Play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.WebCamTexture
的用法示例。
在下文中一共展示了WebCamTexture.Play方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
mCamera = new WebCamTexture ();
mCamera.Play ();
gameObject.GetComponent<Renderer> ().material.mainTexture = mCamera;
if(!mCamera.isPlaying) mCamera.Play ();
}
示例2: Start
/// <summary>
///
/// </summary>
void Start()
{
webcamTexture = new WebCamTexture();
matWeb.mainTexture = webcamTexture;
webcamTexture.Play();
}
示例3: Start
// Use this for initialization
void Start()
{
var devices = WebCamTexture.devices;
if ( devices.Length == 0 ) {
Debug.LogError( "Webカメラが検出できませんでした。" );
return;
}
// WebCamテクスチャを作成する
var webcamTexture = new WebCamTexture( Width, Height, FPS );
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
// ミラーリング
if ( Mirror ) {
transform.localScale = new Vector3( -transform.localScale.x, transform.localScale.y, transform.localScale.z );
}
// 縦にする
if ( RightUp ) {
var euler = transform.localRotation.eulerAngles;
transform.localRotation = Quaternion.Euler( euler.x, euler.y, euler.z + 90 );
}
else if ( LeftUp ) {
var euler = transform.localRotation.eulerAngles;
transform.localRotation = Quaternion.Euler( euler.x, euler.y, euler.z - 90 );
}
}
示例4: Start
// Use this for initialization
void Start()
{
// Ensure orientation and scaling of the image.
var scale = 2.2f;
Quaternion rotation = Quaternion.Euler(0, 0, 0);
Matrix4x4 rotationMatrix = Matrix4x4.TRS(Vector3.zero, rotation, new Vector3(scale , scale , scale));
gameObject.GetComponent<Renderer>().material.SetMatrix("_Rotation", rotationMatrix);
int t = 0;
bool front_facing = false;
WebCamDevice[] devices = WebCamTexture.devices;
// Gets the back facing camera if there is one on the device
while(front_facing && t < devices.Length){
deviceName = devices[t].name;
front_facing = devices[t].isFrontFacing;
t++;
}
webcamTexture = new WebCamTexture(deviceName);
// performs the vertical axis flip
if (!front_facing) {
transform.Rotate(new Vector3(0,0,180));
}
// performs the horizontal axis flip that is the issue regardless
transform.localScale = new Vector3(-1 * transform.localScale.x,
transform.localScale.y,
transform.localScale.z);
GetComponent<Renderer>().material.mainTexture = webcamTexture;
webcamTexture.Play();
}
示例5: LoadConfigs
void LoadConfigs(){
webcamTexture = new WebCamTexture (480, 320, 30);
myURL = Config.masterURL;
fileName = Config.currentChild;
totalMemories = Config.currentChildDayMemoriesCount;
Debug.Log ("Total memories: " + totalMemories);
myURL += "?webfilename=" + fileName +
"&webusername=" + Config.masterUser +
"&webpassword=" + Config.masterPass;
memoryDay = Config.currentDay;
memoryMonth = Config.currentMonth;
memoryYear = Config.currentYear;
NGUITools.SetActive (confirmButton, false);
titleUILabel.value = "";
descriptionUILabel.value = "";
photoUITexture.mainTexture = null;
#if UNITY_EDITOR
webcamTexture = new WebCamTexture ();
photoUITexture.mainTexture = webcamTexture;
webcamTexture.Play ();
#endif
#if UNITY_IOS
PromptForPhoto ();
#endif
}
示例6: SetWebCamTexture
public void SetWebCamTexture(int w, int h, int f)
{
width = w;
height = h;
fps = f;
if(Application.isPlaying){
if( null != webcam ) {
webcam.Stop();
Destroy(webcam);
}
webcam = new WebCamTexture(w, h, f);
if(targetMaterial == null) {
targetMaterial = renderer.material;
}
if(texturePropertyName == null || texturePropertyName.Length == 0) {
targetMaterial.mainTexture = webcam;
} else {
targetMaterial.SetTexture(texturePropertyName, webcam);
}
webcam.Play();
}
}
示例7: Start
// Use this for initialization
void Start()
{
WebCamDevice[] devices = WebCamTexture.devices;
// display all cameras
for (var i = 0; i < devices.Length; i++) {
Debug.Log (devices [i].name);
}
imageObj = GameObject.Find("RawImage").gameObject as GameObject;
string deviceName = devices [0].name;
foreach (var device in WebCamTexture.devices) {
if (device.isFrontFacing) {
deviceName = device.name;
}
}
webcamTexture = new WebCamTexture(deviceName, Width, Height, FPS);
if (webcamTexture == null) {
Debug.Log (webcamTexture);
}
webcamTexture.Play();
imageObj.GetComponent<RawImage>().texture = webcamTexture;
}
示例8: Start
// Use this for initialization
void Start()
{
WebCamDevice[] devices = WebCamTexture.devices;
int cameraCount = devices.Length;
if (cameraCount == 0)
{
Image<Bgr, Byte> img = new Image<Bgr, byte>(640, 240);
CvInvoke.PutText(img, String.Format("{0} camera found", devices.Length), new System.Drawing.Point(10, 60),
Emgu.CV.CvEnum.FontFace.HersheyDuplex,
1.0, new MCvScalar(0, 255, 0));
Texture2D texture = TextureConvert.ImageToTexture2D(img, FlipType.Vertical);
this.GetComponent<GUITexture>().texture = texture;
this.GetComponent<GUITexture>().pixelInset = new Rect(-img.Width/2, -img.Height/2, img.Width, img.Height);
}
else
{
webcamTexture = new WebCamTexture(devices[0].name);
baseRotation = transform.rotation;
webcamTexture.Play();
//data = new Color32[webcamTexture.width * webcamTexture.height];
CvInvoke.CheckLibraryLoaded();
}
}
示例9: Start
// Use this for initialization
void Start()
{
var wc = new WebCamTexture (640, 400);
wc.Play ();
Shader.SetGlobalTexture (propEmit, wc);
Shader.SetGlobalTexture (propKage, wc);
}
示例10: Init
public static void Init(string deviceName, int requestedWidth, int requestedHeight, int requestedFps, BitDepth targetBitDepth)
{
WebCamTexture = new WebCamTexture(deviceName, requestedWidth, requestedHeight, requestedFps);
WebCamTexture.Play();
if (!WebCamTextureProxy.instance)
new GameObject("_webcamtextureproxy") { hideFlags = HideFlags.HideAndDontSave }.AddComponent<WebCamTextureProxy>().SetTargetTexture(WebCamTexture).SetTargetDepth(targetBitDepth).StartCapture();
}
示例11: Start
void Start()
{
if(PlayerPrefs.GetInt("Win",2)==1)
{
Winner.sprite=Bear;
}
else
{
Winner.sprite=Lion;
}
webCamTexture = new WebCamTexture("Camera 1");
//webCamTexture = new WebCamTexture();
Texture2D photo = new Texture2D(webCamTexture.width, webCamTexture.height);
m_RendererPhoto.material.mainTexture = webCamTexture;
//StartVideo
webCamTexture.Play();
//Set Mode
m_PhotoMode = true;
m_RendererPhoto.gameObject.SetActive(m_PhotoMode);
m_RendererRendu.gameObject.SetActive(!m_PhotoMode);
}
示例12: Update
void Update()
{
// Control luminance treshold
if (Input.GetKey(KeyCode.RightArrow)) {
treshold = Mathf.Clamp(treshold + 0.001f, 0f, 1f);
} else if (Input.GetKey(KeyCode.LeftArrow)) {
treshold = Mathf.Clamp(treshold - 0.001f, 0f, 1f);
}
// Control fade out ratio
if (Input.GetKey(KeyCode.DownArrow)) {
fadeOutRatio = Mathf.Clamp(fadeOutRatio - 0.001f, 0f, 1f);
} else if (Input.GetKey(KeyCode.UpArrow)) {
fadeOutRatio = Mathf.Clamp(fadeOutRatio + 0.001f, 0f, 1f);
}
// Switch camera
if (Input.GetKeyDown(KeyCode.C)) {
if (WebCamTexture.devices.Length > 1) {
currentWebcam = (currentWebcam + 1) % WebCamTexture.devices.Length;
textureWebcam.Stop();
textureWebcam = new WebCamTexture(WebCamTexture.devices[currentWebcam].name);
Shader.SetGlobalTexture("_TextureWebcam", textureWebcam);
textureWebcam.Play();
}
}
if (Input.anyKey) {
UpdateUniforms();
}
}
示例13: Start
// Use this for initialization
void Start()
{
WebCamTexture webcamTexture = new WebCamTexture();
Renderer renderer = GetComponent<Renderer>();
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
}
示例14: Start
// Use this for initialization
void Start()
{
webcam = new WebCamTexture();
GetComponent<Renderer>().material.mainTexture = webcam;
webcam.Play();
//webcam.videoVerticallyMirrored
}
示例15: Awake
void Awake()
{
WebCamTexture webcam=new WebCamTexture();
imagen.texture = webcam;
imagen.material.mainTexture=webcam;
webcam.Play();
}