/// <summary> /// Closes a camera and release resources. /// </summary> private void closeCamera() { try { mCameraOpenCloseLock.acquire(); if (null != mSCameraSession) { mSCameraSession.close(); mSCameraSession = null; } if (null != mSCameraDevice) { mSCameraDevice.close(); mSCameraDevice = null; } mSCameraManager = null; mSCamera = null; } catch (InterruptedException e) { Log.e(TAG, "Interrupted while trying to lock camera closing.", e); } finally { mCameraOpenCloseLock.release(); } }
private void InitMain() { //初始化主角 mainPlayer = Tools.Instance(LEngine.rm.Load("role/1/role1"), _player); mainPlayer.name = "MainRole"; mainPlayerScript = mainPlayer.AddComponent <Player>(); Animator anim = mainPlayer.GetComponent <Animator>(); mainPlayerScript.ia = new MainAnimCtrl(anim); LEngine.em.DispatchEvent(new LEvent(LEventType.SetMainPlayer, mainPlayerScript)); LEngine.em.DispatchEvent(new LEvent(LEventType.AddMoveItem, mainPlayerScript)); //绑武器 Tools.AddBinding(LEngine.rm.Load("role/1/weapon1"), mainPlayer, "Bip001 Weapons"); //SkinnedMeshRenderer[] renders = mainPlayer.GetComponentsInChildren<SkinnedMeshRenderer>(); //foreach (SkinnedMeshRenderer r in renders) //{ // r.useLightProbes = true; //} //初始化摄像机 mainCamera = GameObject.Find("Main Camera"); mainCameraScript = mainCamera.AddComponent <SCamera>(); mainCameraScript.SetTarget(mainPlayer.transform); InitNavAgent(); }
public static SCamera Serialize(this Camera _cam) { SCamera RetSCamera = new SCamera { ExistsOnObject = (_cam == null) ? false : true, Enabled = _cam.enabled, ClearFlag = (int)_cam.clearFlags, BackGroundColor = _cam.backgroundColor.Serialize(), GateFitMode = (int)_cam.gateFit, SensorSize = _cam.sensorSize.Serialize(), LensShift = _cam.lensShift.Serialize(), FocalLength = _cam.focalLength, NormalizedViewPortRect = _cam.rect.Serialize(), NearClipPlane = _cam.nearClipPlane, FarClipPlane = _cam.farClipPlane, FieldOfView = _cam.fieldOfView, Orthographic = _cam.orthographic, OrthographicSize = _cam.orthographicSize, Depth = _cam.depth, CullingMask = _cam.cullingMask, RenderPath = (int)_cam.renderingPath, TargetDisplay = _cam.targetDisplay, TargetEye = (int)_cam.stereoTargetEye, HDR = _cam.allowHDR, AllowMSAA = _cam.allowMSAA, AllowDynamicResolution = _cam.allowDynamicResolution, ForceIntoRT = _cam.forceIntoRenderTexture, OcclusionCulling = _cam.useOcclusionCulling, StereoConvergence = _cam.stereoConvergence, StereoSeparation = _cam.stereoSeparation }; return(RetSCamera); }
public override void onResume() { base.onResume(); startBackgroundThread(); //Initialize SCamera. mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } if (!checkRequiredFeatures()) { return; } createProcessor(); createUI(); openCamera(); }
public override void onResume() { base.onResume(); State = CAMERA_STATE.IDLE; startBackgroundThread(); // initialize SCamera mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } OrientationListener = true; if (!checkRequiredFeatures()) { return; } createUI(); openCamera(); }
protected internal override void onResume() { base.onResume(); // initialize SCamera mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } if (!checkRequiredFeatures()) { return; } mSCameraManager = mSCamera.SCameraManager; mTextureView = (AutoFitTextureView)findViewById(R.id.texture); // Set SurfaceTextureListener that handle life cycle of TextureView mTextureView.SurfaceTextureListener = new SurfaceTextureListenerAnonymousInnerClassHelper(this); findViewById(R.id.picture).OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); startBackgroundThread(); openCamera(); }
protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_filter; mSelectedFilterTextView = (TextView)findViewById(R.id.selected_textview); findViewById(R.id.btn_select_image).OnClickListener = this; findViewById(R.id.btn_select_filter).OnClickListener = this; mBitmapButton = (Button)findViewById(R.id.btn_bitmap); mFileButton = (Button)findViewById(R.id.btn_file); mBitmapButton.OnClickListener = this; mFileButton.OnClickListener = this; mBitmapButton.Enabled = false; mFileButton.Enabled = false; mInputImageView = (ImageView)findViewById(R.id.input_image_view); mOutputImageView = (ImageView)findViewById(R.id.output_image_view); mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } if (!mSCamera.isFeatureEnabled(SCamera.SCAMERA_FILTER)) { showAlertDialog("This device does not support SCamera Filter feature.", true); return; } // retrieving an {@link com.samsung.android.sdk.camera.filter.SCameraFilterManager} mSCameraFilterManager = mSCamera.SCameraFilterManager; // retrieving available filters mFilterInfoList = mSCameraFilterManager.AvailableFilters; if (mFilterInfoList.Count > 0) { mSelectedFilterTextView.Text = mFilterInfoList[0].Name; } }
// Use this for initialization void Start() { rgbd = GetComponent <Rigidbody2D>(); isRunning = false; distanceToRun = 0.0f; sCam = Camera.main.GetComponent <SCamera>(); collider = GetComponent <CircleCollider2D>(); anim = GetComponent <Animator>(); sprite = GetComponent <SpriteRenderer>(); isVulnerable = true; hasFlee = false; sm = SpriteManager.GetSpriteManager; GameObject.Find("EncyclopediaSmourbiff").GetComponent <EncyclopediaSmourbiff>().PrepareForCapture(); StartCoroutine(DecreaseTimerFlee()); }
private void Start() { sprRend = GetComponent <SpriteRenderer>(); anim = GetComponent <Animator>(); animInChild = transform.GetChild(0).GetComponent <Animator>(); Anim.enabled = false; animInChild.enabled = false; scam = Camera.main.GetComponent <SCamera>(); if (RefActivity.GetComponent <PlayerController>().isLocalPlayer) { scam.StopFollowingPlayer = true; } }
protected internal override void onDestroy() { Log.v(TAG, "onDestroy"); if (mInputBitmap != null) { mInputBitmap.recycle(); } if (mOutputBitmap != null) { mOutputBitmap.recycle(); } if (mInputImage != null) { mInputImage.release(); } buffer = null; mScamera = null; base.onPause(); }
/// <summary> /// Prepares an UI, like button, dialog, etc. and /// </summary> protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_ipx; Log.v(TAG, "onCreate"); mInputView = (ImageView)findViewById(R.id.image_in); mOutputView = (ImageView)findViewById(R.id.image_out); // Get screen width. DisplayMetrics dm = new DisplayMetrics(); WindowManager.DefaultDisplay.getMetrics(dm); mScreenWidth = dm.widthPixels; mScreenHeight = dm.heightPixels; // initialize SCamera mScamera = new SCamera(); try { mScamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } if (!mScamera.isFeatureEnabled(SCamera.SCAMERA_IMAGE)) { showAlertDialog("This device does not support SCamera Image Processing Accelerator feature.", true); return; } Log.v(TAG, "SDK feature check passed"); // initialize Gellery button ImageView openGalleryButton = (ImageView)findViewById(R.id.button1); openGalleryButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); makeBufferWithDefaultPath(); }
/// <summary> /// Prepares an UI, like button, dialog, etc. and /// </summary> protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_ipx; Log.v(TAG, "onCreate"); mInputView = (ImageView)findViewById(R.id.image_in); mOutputView = (ImageView)findViewById(R.id.image_out); // Get screen width. DisplayMetrics dm = new DisplayMetrics(); WindowManager.DefaultDisplay.getMetrics(dm); mScreenWidth = dm.widthPixels; mScreenHeight = dm.heightPixels; // initialize SCamera mScamera = new SCamera(); try { mScamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } if (!mScamera.isFeatureEnabled(SCamera.SCAMERA_IMAGE)) { showAlertDialog("This device does not support SCamera Image Processing Accelerator feature.", true); return; } Log.v(TAG, "SDK feature check passed"); // initialize Gellery button ImageView openGalleryButton = (ImageView) findViewById(R.id.button1); openGalleryButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); makeBufferWithDefaultPath(); }
protected internal override void onResume() { base.onResume(); // initialize SCamera mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } if (!checkRequiredFeatures()) { return; } createUI(); }
protected internal override void onResume() { base.onResume(); // initialize SCamera mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } if (!checkRequiredFeatures()) { return; } createUI(); }
public static Camera Deserialize(this SCamera _cam, ref GameObject _gameObject) { if (_cam.ExistsOnObject == false) { return(null); } Camera _Camera = _gameObject.GetComponent <Camera>(); _Camera.enabled = _cam.Enabled; _Camera.clearFlags = (CameraClearFlags)_cam.ClearFlag; _Camera.backgroundColor = _cam.BackGroundColor.Deserialize(); _Camera.gateFit = (Camera.GateFitMode)_cam.GateFitMode; _Camera.sensorSize = _cam.SensorSize.Deserialize(); _Camera.lensShift = _cam.LensShift.Deserialize(); _Camera.focalLength = _cam.FocalLength; _Camera.rect = _cam.NormalizedViewPortRect.Deserialize(); _Camera.nearClipPlane = _cam.NearClipPlane; _Camera.farClipPlane = _cam.FarClipPlane; _Camera.fieldOfView = _cam.FieldOfView; _Camera.orthographic = _cam.Orthographic; _Camera.orthographicSize = _cam.OrthographicSize; _Camera.depth = _cam.Depth; _Camera.cullingMask = _cam.CullingMask; _Camera.renderingPath = (RenderingPath)_cam.RenderPath; _Camera.targetDisplay = _cam.TargetDisplay; _Camera.stereoTargetEye = (StereoTargetEyeMask)_cam.TargetEye; _Camera.allowHDR = _cam.HDR; _Camera.allowMSAA = _cam.AllowMSAA; _Camera.allowDynamicResolution = _cam.AllowDynamicResolution; _Camera.forceIntoRenderTexture = _cam.ForceIntoRT; _Camera.useOcclusionCulling = _cam.OcclusionCulling; _Camera.stereoConvergence = _cam.StereoConvergence; _Camera.stereoSeparation = _cam.StereoSeparation; return(_Camera); }
protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_filter; mSelectedFilterTextView = (TextView) findViewById(R.id.selected_textview); findViewById(R.id.btn_select_image).OnClickListener = this; findViewById(R.id.btn_select_filter).OnClickListener = this; mBitmapButton = (Button) findViewById(R.id.btn_bitmap); mFileButton = (Button) findViewById(R.id.btn_file); mBitmapButton.OnClickListener = this; mFileButton.OnClickListener = this; mBitmapButton.Enabled = false; mFileButton.Enabled = false; mInputImageView = (ImageView) findViewById(R.id.input_image_view); mOutputImageView = (ImageView) findViewById(R.id.output_image_view); mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } if (!mSCamera.isFeatureEnabled(SCamera.SCAMERA_FILTER)) { showAlertDialog("This device does not support SCamera Filter feature.", true); return; } // retrieving an {@link com.samsung.android.sdk.camera.filter.SCameraFilterManager} mSCameraFilterManager = mSCamera.SCameraFilterManager; // retrieving available filters mFilterInfoList = mSCameraFilterManager.AvailableFilters; if (mFilterInfoList.Count > 0) { mSelectedFilterTextView.Text = mFilterInfoList[0].Name; } }
public override void onResume() { base.onResume(); State = CAMERA_STATE.IDLE; startBackgroundThread(); // initialize SCamera mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } mCaptureResultQueue = new LinkedBlockingQueue<SCaptureResult>(); OrientationListener = true; createUI(); checkRequiredFeatures(); openCamera(mLensFacing); }
public override void onPause() { State = CAMERA_STATE.CLOSING; if (mSettingDialog != null) { mSettingDialog.dismiss(); mSettingDialog = null; } OrientationListener = false; stopBackgroundThread(); closeCamera(); mSCamera = null; base.onPause(); }
protected internal override void onDestroy() { mSCamera = null; base.onDestroy(); }
protected internal override void onResume() { base.onResume(); // initialize SCamera mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } if (!checkRequiredFeatures()) { return; } mSCameraManager = mSCamera.SCameraManager; mTextureView = (AutoFitTextureView) findViewById(R.id.texture); // Set SurfaceTextureListener that handle life cycle of TextureView mTextureView.SurfaceTextureListener = new SurfaceTextureListenerAnonymousInnerClassHelper(this); findViewById(R.id.picture).OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); startBackgroundThread(); openCamera(); }
public override void onResume() { base.onResume(); State = CAMERA_STATE.IDLE; startBackgroundThread(); // initialize SCamera mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } OrientationListener = true; if (!checkRequiredFeatures()) { return; } createProcessor(); createUI(); openCamera(); }
/// <summary> /// Closes a camera and release resources. /// </summary> private void closeCamera() { try { mCameraOpenCloseLock.acquire(); if (mSCameraSession != null) { mSCameraSession.close(); mSCameraSession = null; } if (mSCameraDevice != null) { mSCameraDevice.close(); mSCameraDevice = null; } if (mImageReader != null) { mImageReader.close(); mImageReader = null; } mSCameraManager = null; mSCamera = null; } catch (InterruptedException e) { Log.e(TAG, "Interrupted while trying to lock camera closing.", e); } finally { mCameraOpenCloseLock.release(); } }
protected internal override void onDestroy() { Log.v(TAG, "onDestroy"); if (mInputBitmap != null) { mInputBitmap.recycle(); } if (mOutputBitmap != null) { mOutputBitmap.recycle(); } if (mInputImage != null) { mInputImage.release(); } buffer = null; mScamera = null; base.onPause(); }
protected internal override void onDestroy() { mSCamera = null; base.onDestroy(); }