本文整理汇总了C#中UnityEngine.WebCamTexture类的典型用法代码示例。如果您正苦于以下问题:C# WebCamTexture类的具体用法?C# WebCamTexture怎么用?C# WebCamTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebCamTexture类属于UnityEngine命名空间,在下文中一共展示了WebCamTexture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
mCamera = new WebCamTexture ();
mCamera.Play ();
gameObject.GetComponent<Renderer> ().material.mainTexture = mCamera;
if(!mCamera.isPlaying) mCamera.Play ();
}
示例2: Start
// Use this for initialization
void Start()
{
webcam = new WebCamTexture();
GetComponent<Renderer>().material.mainTexture = webcam;
webcam.Play();
//webcam.videoVerticallyMirrored
}
示例3: 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;
}
示例4: Start
// Use this for initialization
void Start()
{
// load image from camera
back = new WebCamTexture ();
renderer.material.mainTexture = back;
back.Play ();
}
示例5: Awake
void Awake()
{
WebCamTexture webcam=new WebCamTexture();
imagen.texture = webcam;
imagen.material.mainTexture=webcam;
webcam.Play();
}
示例6: 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();
}
示例7: Start
void Start()
{
WebCamTexture webcamTexture = new WebCamTexture();
rawimage.texture = webcamTexture;
rawimage.material.mainTexture = webcamTexture;
webcamTexture.Play();
}
示例8: 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();
}
}
示例9: Awake
void Awake()
{
//setup unity webcam
WebCamDevice[] devices= WebCamTexture.devices;
if (devices.Length <= 0){
Debug.LogError("No Webcam.");
return;
}
WebCamTexture w=new WebCamTexture(320,240,15);
//Make WebcamTexture wrapped Sensor.
this._ss=NyARUnityWebCam.createInstance(w);
//Make configulation by Sensor size.
NyARMarkerSystemConfig config = new NyARMarkerSystemConfig(this._ss.width,this._ss.height);
this._ms=new NyARUnityMarkerSystem(config);
mid=this._ms.addARMarker(
new StreamReader(new MemoryStream(((TextAsset)Resources.Load("patt_hiro",typeof(TextAsset))).bytes)),
16,25,80);
//setup background
this._bg_panel=GameObject.Find("Plane");
this._bg_panel.renderer.material.mainTexture=w;
this._ms.setARBackgroundTransform(this._bg_panel.transform);
//setup camera projection
this._ms.setARCameraProjection(this.camera);
GameObject.Find("Cube").renderer.material.mainTexture=new Texture2D(64,64);
}
示例10: 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 );
}
}
示例11: Start
// Use this for initialization
void Start()
{
var wc = new WebCamTexture (640, 400);
wc.Play ();
Shader.SetGlobalTexture (propEmit, wc);
Shader.SetGlobalTexture (propKage, wc);
}
示例12: Start
/// <summary>
///
/// </summary>
void Start()
{
webcamTexture = new WebCamTexture();
matWeb.mainTexture = webcamTexture;
webcamTexture.Play();
}
示例13: Awake
void Awake()
{
m_ProjectionCam = GameObject.Find("Projection Camera");
m_TopDownCam = GameObject.Find("Top Down Camera");
m_GUICam = GameObject.Find("GUI Camera");
//3 screens 5 monitors
if(Application.isEditor)
m_fEditorValue = 6079;
else
m_fEditorValue = (float)Screen.width;
m_fGUICamProWidth = 1280.0f / m_fEditorValue;
m_fProjCamProStart = 2560.0f / m_fEditorValue;
m_fProjCamProWidth = (m_fEditorValue - 2560) / m_fEditorValue;
m_GUICam.camera.rect = new Rect(0.0f, 0, m_fGUICamProWidth, 1);
m_TopDownCam.camera.rect = new Rect(m_fGUICamProWidth, 0, m_fGUICamProWidth, 1);
m_ProjectionCam.camera.rect = new Rect(m_fProjCamProStart, 0, m_fProjCamProWidth, 1);
//webcam
webcamTexture = new WebCamTexture();
webcamTexture.requestedWidth = (int)(Screen.width / 4) / 3;
webcamTexture.requestedHeight = (int)(Screen.height / 1.333333) / 3;
//webcamTexture.Play();
m_WebRect = new Rect();
m_WebRect.x = Screen.width * m_TopDownCam.camera.rect.x;
m_WebRect.y = Screen.height - ((Screen.height / 1.333333f) / 3);
m_WebRect.width = (Screen.width * m_TopDownCam.camera.rect.width) / 3;
m_WebRect.height = (Screen.height / 1.333333f) / 3;
}
示例14: Awake
//TextBox
////private TouchKeyboard m_TouchKeyboard = new TouchKeyboard();
//string[] m_TextBoxStrings;
//int m_iFocusOn;
//bool m_bFocusChange;
void Awake()
{
m_ProjectionCam = GameObject.Find("Projection Camera");
m_TopDownCam = GameObject.Find("Top Down Camera");
m_GUICam = GameObject.Find("GUI Camera");
m_Resolution = m_MainResolution;
//Setup the cameras depending on settings
SetupCameras();
//Screen.SetResolution((int)m_Resolution.x, (int)m_Resolution.y, true);
//Screen.fullScreen = true;
m_GUIGroupRect = new Rect((Screen.width * m_GUICam.camera.rect.x), 0, 1280, 960);
//webcam
webcamTexture = new WebCamTexture();
webcamTexture.requestedWidth = (int)(Screen.width / 4) / 3;
webcamTexture.requestedHeight = (int)(Screen.height / 1.333333) / 3;
//webcamTexture.Play();
m_WebRect = new Rect();
m_WebRect.x = Screen.width * m_TopDownCam.camera.rect.x;
m_WebRect.y = Screen.height - ((Screen.height / 1.333333f) / 3);
m_WebRect.width = (Screen.width * m_TopDownCam.camera.rect.width) / 3;
m_WebRect.height = (Screen.height / 1.333333f) / 3;
}
示例15: Start
void Start()
{
// Checks how many and which cameras are available on the device
for (int cameraIndex = 0; cameraIndex < WebCamTexture.devices.Length; cameraIndex++)
{
// We want the back camera
if (!WebCamTexture.devices[cameraIndex].isFrontFacing)
{
webCameraTexture = new WebCamTexture(cameraIndex, Screen.width, Screen.height);
// Here we flip the GuiTexture by applying a localScale transformation
// works only in Landscape mode
myCameraTexture.transform.localScale = new Vector3(-1,-1,1);
}
}
// Here we tell that the texture of coming from the camera should be applied
// to our GUITexture. As we have flipped it before the camera preview will have the
// correct orientation
myCameraTexture.texture = webCameraTexture;
// Starts the camera
webCameraTexture.Play();
}