protected NyARSingleCameraSystem(NyARParam i_ref_cparam) { this._observer = new ObserverList(3); this._ref_param = i_ref_cparam; this._frustum = new NyARFrustum(); this.setProjectionMatrixClipping(FRUSTUM_DEFAULT_NEAR_CLIP, FRUSTUM_DEFAULT_FAR_CLIP); }
public NyARSingleCameraView(NyARParam i_ref_cparam) { this._ref_param = i_ref_cparam; this._frustum = new NyARFrustum(); this._observer = new ObserverList(3); this.setClipping(FRUSTUM_DEFAULT_NEAR_CLIP, FRUSTUM_DEFAULT_FAR_CLIP); return; }
/// <summary> /// この関数は,cameraオブジェクトにProjectionMatrixを指定します. /// </summary> public void setARCameraProjection(Camera i_camera) { NyARFrustum f = this.getFrustum(); NyARFrustum.PerspectiveParam pp = f.getPerspectiveParam(new NyARFrustum.PerspectiveParam()); //setup camera projection i_camera.nearClipPlane = (float)pp.near; i_camera.farClipPlane = (float)pp.far; i_camera.fieldOfView = (float)(360 * pp.fovy / (2 * Math.PI)); i_camera.aspect = (float)(pp.aspect); i_camera.transform.LookAt(new Vector3(0, 0, 0), new Vector3(1, 0, 0)); }
/// <summary> この関数は、背景画像の姿勢行列を transform メンバに設定します </summary> public void setARBackgroundTransform(Transform i_transform) { NyARFrustum f = this.getFrustum(); var fp = f.getFrustumParam(new NyARFrustum.FrustumParam()); float bg_pos = (float)fp.far - 20f; i_transform.position = Vector3.forward * bg_pos; double b = bg_pos / fp.near / 10;// 10? i_transform.localScale = new Vector3((float)(-(fp.right - fp.left) * b), 1f, -(float)((fp.top - fp.bottom) * b)); i_transform.eulerAngles = new Vector3(-90, 0, 0); }
/** * コンストラクタです。{@link INyARMarkerSystemConfig}を元に、インスタンスを生成します。 * @param i_config * 初期化済の{@link MarkerSystem}を指定します。 * @throws NyARException */ public NyARMarkerSystem(INyARMarkerSystemConfig i_config) { this._ref_param = i_config.getNyARParam(); this._frustum = new NyARFrustum(); this.initInstance(i_config); this.setProjectionMatrixClipping(FRUSTUM_DEFAULT_NEAR_CLIP, FRUSTUM_DEFAULT_FAR_CLIP); this._armk_list = new ARMarkerList(); this._idmk_list = new NyIdList(); this._tracking_list = new TrackingList(); this._transmat = i_config.createTransmatAlgorism(); //同時に判定待ちにできる矩形の数 this._sq_stack = new SquareStack(INITIAL_MARKER_STACK_SIZE); this._on_sq_handler = new OnSquareDetect(i_config, this._armk_list, this._idmk_list, this._tracking_list, this._sq_stack); }
/** * コンストラクタから呼び出す共通な初期化部分です。 * @param i_dist_factor * @param i_prjmat * @throws NyARException */ protected void InitInstance(NyARIntSize i_screen, double i_near, double i_far, NyARPerspectiveProjectionMatrix i_prjmat, INyARCameraDistortionFactor i_dist_factor) { int number_of_reality_target = this.MAX_LIMIT_KNOWN + this.MAX_LIMIT_UNKNOWN; //演算インスタンス this._transmat = new NyARTransMat(i_dist_factor, i_prjmat); //データインスタンス this._pool = new NyARRealityTargetPool(number_of_reality_target, i_prjmat); this.target = new NyARRealityTargetList(number_of_reality_target); //Trackerの特性値 this._tracker = new NyARTracker((this.MAX_LIMIT_KNOWN + this.MAX_LIMIT_UNKNOWN) * 2, 1, this.MAX_LIMIT_KNOWN * 2); //フラスタムの計算とスクリーンサイズの保存 this._ref_prjmat = i_prjmat; this._frustum = new NyARFrustum(i_prjmat, i_screen.w, i_screen.h, i_near, i_far); //初期化 this._number_of_dead = this._number_of_unknown = this._number_of_known = 0; return; }