本文整理汇总了C#中UnityEngine.WebCamTexture类的典型用法代码示例。如果您正苦于以下问题:C# WebCamTexture类的具体用法?C# WebCamTexture怎么用?C# WebCamTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebCamTexture类属于UnityEngine命名空间,在下文中一共展示了WebCamTexture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
mCamera = new WebCamTexture ();
mCamera.Play ();
gameObject.GetComponent<Renderer> ().material.mainTexture = mCamera;
if(!mCamera.isPlaying) mCamera.Play ();
}
开发者ID:tsi25,项目名称:Alfred,代码行数:7,代码来源:CameraController.cs
示例2: Start
// Use this for initialization
void Start()
{
webcam = new WebCamTexture();
GetComponent<Renderer>().material.mainTexture = webcam;
webcam.Play();
//webcam.videoVerticallyMirrored
}
开发者ID:nullsquid,项目名称:UnityLiveCam,代码行数:8,代码来源:WebcamTest.cs
示例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;
}
开发者ID:nmrtkhs,项目名称:teacherHunting,代码行数:27,代码来源:CaptureScene.cs
示例4: Start
// Use this for initialization
void Start()
{
// load image from camera
back = new WebCamTexture ();
renderer.material.mainTexture = back;
back.Play ();
}
开发者ID:e-solus,项目名称:occultreality,代码行数:8,代码来源:WebCam.cs
示例5: Awake
void Awake()
{
WebCamTexture webcam=new WebCamTexture();
imagen.texture = webcam;
imagen.material.mainTexture=webcam;
webcam.Play();
}
开发者ID:tejerolucas,项目名称:Social-Drive,代码行数:7,代码来源:webcamui.cs
示例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();
}
开发者ID:redflasher,项目名称:unity-opencvsharp,代码行数:7,代码来源:UnityCvBase.cs
示例7: Start
void Start()
{
WebCamTexture webcamTexture = new WebCamTexture();
rawimage.texture = webcamTexture;
rawimage.material.mainTexture = webcamTexture;
webcamTexture.Play();
}
开发者ID:Geeker-GNF,项目名称:RAsE2,代码行数:7,代码来源:MostrarCamara.cs
示例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();
}
}
开发者ID:8monolith8,项目名称:fuze-vj-kit,代码行数:28,代码来源:VJWebCam.cs
示例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);
}
开发者ID:guozanhua,项目名称:NyARToolkitUnity,代码行数:27,代码来源:ImagePickup.cs
示例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 );
}
}
开发者ID:kaorun55,项目名称:UnitySandbox,代码行数:29,代码来源:WebCamBehaviourScript.cs
示例11: Start
// Use this for initialization
void Start()
{
var wc = new WebCamTexture (640, 400);
wc.Play ();
Shader.SetGlobalTexture (propEmit, wc);
Shader.SetGlobalTexture (propKage, wc);
}
开发者ID:sugi-cho,项目名称:FlowingParticles,代码行数:8,代码来源:Webcam.cs
示例12: Start
/// <summary>
///
/// </summary>
void Start()
{
webcamTexture = new WebCamTexture();
matWeb.mainTexture = webcamTexture;
webcamTexture.Play();
}
开发者ID:javageek68,项目名称:mikulus,代码行数:10,代码来源:AugReality.cs
示例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;
}
开发者ID:deanstanfield,项目名称:test-scene,代码行数:33,代码来源:CameraSetup.cs
示例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;
}
开发者ID:deanstanfield,项目名称:test-scene,代码行数:33,代码来源:OldCC.cs
示例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();
}
开发者ID:davidmfry,项目名称:Sales-Ipad-app,代码行数:25,代码来源:WebCameraScript.cs
示例16: Start
void Start ()
{
webcamTexture = new WebCamTexture();
Renderer renderer = GetComponent<Renderer>();
renderer.material.mainTexture = webcamTexture;
OnEnable();
}
开发者ID:mathijs750,项目名称:Tarot,代码行数:7,代码来源:WebCam.cs
示例17: 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();
}
}
开发者ID:leon196,项目名称:DingDong,代码行数:31,代码来源:Webcam.cs
示例18: 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("./Assets/Data/patt.hiro",16,25,80);
//This line loads a marker from texture
mid=this._ms.addARMarker((Texture2D)(Resources.Load("MarkerHiro", typeof(Texture2D))),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);
return;
}
开发者ID:imclab,项目名称:NyARToolkitUnity,代码行数:28,代码来源:ARCameraBehaviour.cs
示例19: 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();
}
开发者ID:anthony-ngu,项目名称:VRCameraDemo,代码行数:36,代码来源:RenderWebCam.cs
示例20: 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
}
开发者ID:Chenoso,项目名称:Stephanie,代码行数:33,代码来源:AddMemory.cs
注:本文中的UnityEngine.WebCamTexture类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论