📄 view.java
字号:
// The current universe associated with this view // VirtualUniverse universe = null; // // The RenderBin associated with this view. // RenderBin renderBin = null; // This is the SoundScheduler associated with this view. SoundScheduler soundScheduler = null; // This is the thread associated with this view. SoundRenderer soundRenderer = new SoundRenderer(); // AudioDevice enumerator current position // AudioDeviceEnumerator allAudioEnumerator = null; // These are used for tracking the frame times static final int NUMBER_FRAME_START_TIMES = 10; long[] frameStartTimes = new long[NUMBER_FRAME_START_TIMES]; long[] frameNumbers = new long[NUMBER_FRAME_START_TIMES]; int currentFrameIndex = 0; // These are the values that are set at the end of each frame long currentFrameStartTime = 0; long currentFrameDuration = 0; long currentFrameNumber = 0; // These are the ones that get updated directly by MC long frameNumber = 0; long startTime = 0; long stopTime = 0; // Support dynamic video resize -- DVR. Viewer viewer = null; // Cached the associate viewer of this view. boolean firstTime = true;// float dvrFactor = 1.0f;// boolean dvrResizeCompensation = true; // User adjustable minimum frame cycle time long minFrameCycleTime; // True when stopBehaviorScheduler invoke boolean stopBehavior; // // View cache for this view. // ViewCache viewCache = null; // Compatibility mode related field has changed. // { compatibilityModeEnable, compatVpcToEc, compatLeftProjection, // compatRightProjection } static final int COMPATIBILITY_MODE_DIRTY = 0x01; // ScreenScalePolicy field has changed. static final int SCREEN_SCALE_POLICY_DIRTY = 0x02; // Screen scale field has changed. static final int SCREEN_SCALE_DIRTY = 0x04; // Window Resize Policy field has changed. static final int WINDOW_RESIZE_POLICY_DIRTY = 0x08; // View Policy eye in image plate field has changed. static final int VIEW_POLICY_DIRTY = 0x10; // Clip related field has changed. // { frontClipDistance, backClipDistance, frontClipPolicy, backClipPolicy } static final int CLIP_DIRTY = 0x20; // Projection Policy field has changed. static final int PROJECTION_POLICY_DIRTY = 0x40; // Window Movement Policy field has changed. static final int WINDOW_MOVEMENT_POLICY_DIRTY = 0x80; // Window Eye Point Policy field has changed. static final int WINDOW_EYE_POINT_POLICY_DIRTY = 0x100; // Monoscopic View Policy field has changed. static final int MONOSCOPIC_VIEW_POLICY_DIRTY = 0x200; // Field Of View field has changed. static final int FIELD_OF_VIEW_DIRTY = 0x400; // Tracking Enable field has changed. static final int TRACKING_ENABLE_DIRTY = 0x800; // User Head To Vworld Enable field has changed. static final int USER_HEAD_TO_VWORLD_ENABLE_DIRTY = 0x1000; // coexistenceCenteringEnable flag has changed. static final int COEXISTENCE_CENTERING_ENABLE_DIRTY = 0x2000; // leftManualEyeInCoexistence has changed. static final int LEFT_MANUAL_EYE_IN_COEXISTENCE_DIRTY = 0x4000; // rightManualEyeInCoexistence has changed. static final int RIGHT_MANUAL_EYE_IN_COEXISTENCE_DIRTY = 0x8000; // visibilityPolicy has changed. static final int VISIBILITY_POLICY_DIRTY = 0x10000; // This is not from View object. It is here for the purpose // keeping all ViewCache's dirty mask bit declaration in one place. // ViewPlatformRetained viewAttach Policy field has changed. static final int VPR_VIEW_ATTACH_POLICY_DIRTY = 0x10000; static final int VPR_VIEWPLATFORM_DIRTY = 0x20000; // PhysicalEnvironment fields has changed. static final int PE_COE_TO_TRACKER_BASE_DIRTY = 0x100000; static final int PE_TRACKING_AVAILABLE_DIRTY = 0x200000; static final int PE_COE_CENTER_IN_PWORLD_POLICY_DIRTY = 0x400000; // PhysicalBody fields has changed. static final int PB_EYE_POSITION_DIRTY = 0x1000000; static final int PB_EAR_POSITION_DIRTY = 0x2000000; static final int PB_NOMINAL_EYE_HEIGHT_FROM_GROUND_DIRTY = 0x4000000; static final int PB_NOMINAL_EYE_OFFSET_FROM_NOMINAL_SCREEN_DIRTY = 0x8000000; // Mask that indicates this View's view dependence info. has changed, // and CanvasViewCache may need to recompute the final view matries. int vDirtyMask = (COMPATIBILITY_MODE_DIRTY | SCREEN_SCALE_POLICY_DIRTY | SCREEN_SCALE_DIRTY | WINDOW_RESIZE_POLICY_DIRTY | VIEW_POLICY_DIRTY | CLIP_DIRTY | PROJECTION_POLICY_DIRTY | WINDOW_MOVEMENT_POLICY_DIRTY | WINDOW_EYE_POINT_POLICY_DIRTY | MONOSCOPIC_VIEW_POLICY_DIRTY | FIELD_OF_VIEW_DIRTY | TRACKING_ENABLE_DIRTY | USER_HEAD_TO_VWORLD_ENABLE_DIRTY | COEXISTENCE_CENTERING_ENABLE_DIRTY | LEFT_MANUAL_EYE_IN_COEXISTENCE_DIRTY | RIGHT_MANUAL_EYE_IN_COEXISTENCE_DIRTY | VISIBILITY_POLICY_DIRTY); // // This object contains a specification of the user's physical body. // // Attributes of this object are defined in head coordinates and // include information such as the location of the user's eyes and // ears. // The origin is defined to be halfway between the left and right eye // in the plane of the face. // The x-axis extends to the right (of the head looking out from the head). // The y-axis extends up. The z-axis extends to the rear of the head. // PhysicalBody physicalBody; // This object contains a specification of the physical environment. PhysicalEnvironment physicalEnvironment; // View model compatibility mode flag boolean compatibilityModeEnable = false; // View model coexistenceCenteringEnable flag boolean coexistenceCenteringEnable = true; Point3d leftManualEyeInCoexistence = new Point3d(); Point3d rightManualEyeInCoexistence = new Point3d(); // // Indicates which major mode of view computation to use: // HMD mode or screen/fish-tank-VR mode. // int viewPolicy = SCREEN_VIEW; // The current projection policy (parallel versus perspective) int projectionPolicy = PERSPECTIVE_PROJECTION; // // The view model's field of view. // double fieldOfView = 45.0 * Math.PI / 180.0; // // The distance away from the clip origin // in the direction of gaze for the front and back clip planes. // The default values are in meters. // double frontClipDistance = 0.1; double backClipDistance = 10.0; // This variable specifies where the screen scale comes from int screenScalePolicy = SCALE_SCREEN_SIZE; // The screen scale value used when the screen scale policy is // SCALE_EXPLICIT double screenScale = 1.0; // // This variable specifies how Java 3D modifies the view when // the window is resized (VIRTUAL_WORLD or PHYSICAL_WORLD). // int windowResizePolicy = PHYSICAL_WORLD; // // This variable specifies how Java 3D modifies the view when // the window is moved (VIRTUAL_WORLD or PHYSICAL_WORLD). // int windowMovementPolicy = PHYSICAL_WORLD; // // Specifies how Java 3D handles the predefined eyepoint in // non-head-tracked environment (RELATIVE_TO_SCREEN, // RELATIVE_TO_WINDOW, RELATIVE_TO_FIELD_OF_VIEW, or // RELATIVE_TO_COEXISTENCE) // int windowEyepointPolicy = RELATIVE_TO_FIELD_OF_VIEW; // // Specifies how Java 3D generates monoscopic view // (LEFT_EYE_VIEW, RIGHT_EYE_VIEW, or CYCLOPEAN_EYE_VIEW). // int monoscopicViewPolicy = CYCLOPEAN_EYE_VIEW; /** * Defines the policy for placing the front clipping plane. * Legal values include PHYSICAL_EYE, PHYSICAL_SCREEN, * VIRTUAL_EYE, and VIRTUAL_SCREEN. */ int frontClipPolicy = PHYSICAL_EYE; /** * Defines the policy for placing the back clipping plane. */ int backClipPolicy = PHYSICAL_EYE; /** * Defines the visibility policy. */ int visibilityPolicy = VISIBILITY_DRAW_VISIBLE; /** * Defines the transparency sorting policy. */ int transparencySortingPolicy = TRANSPARENCY_SORT_NONE; /** * Flag to enable tracking, if so allowed by the trackingAvailable flag. */ boolean trackingEnable = false; /** * This setting enables the continuous updating by Java 3D of the * userHeadToVworld transform. */ boolean userHeadToVworldEnable = false; /** * The view platform currently associated with this view. */ private ViewPlatform viewPlatform = null; // The current compatibility mode view transform Transform3D compatVpcToEc = new Transform3D(); // The current compatibility mode projection transforms Transform3D compatLeftProjection = new Transform3D(); Transform3D compatRightProjection = new Transform3D(); // The long id of this view - used for dirty bit evaluation in the scene graph Integer viewId = null; int viewIndex = -1; // A boolean that indicates whether or not this is the primary view boolean primaryView = false; // A boolean that indicates whether or not this view is active as // seen by MasterControl boolean active = false; // A boolean that indicates whether or not this view is active as // seen by this view. There is a delay before MasterControl set // active flag, so a local activeStatus is used. Otherwise // activate event may lost if it proceed by deactivate event // but MC not yet set active to false. This happens in // viewplatform detach and attach. boolean activeStatus = false; // This boolean indicates whether or not the view is running. It // is used for startView/stopView volatile boolean isRunning = true; // A flag to indicate that we are in a canvas callback routine boolean inCanvasCallback = false; // // Flag to enable depth buffer freeze during trasparent rendering pass // boolean depthBufferFreezeTransparent = true; // // Flag to enable scene antialiasing // boolean sceneAntialiasingEnable = false; // // Flag to enable local eye lighting // boolean localEyeLightingEnable = false; // Array Lists to track the screens and canvases associated with this View. // use getScreens() to access this private ArrayList screenList = new ArrayList(); // use getCanvasList() to access this private ArrayList canvasList = new ArrayList(); private Canvas3D[][] cachedCanvasList; private Canvas3D[] cachedCanvases; private Screen3D[] cachedScreens; private int longestScreenList = 0; private boolean canvasesDirty = true; // Flag to notify user thread when renderOnce is finished volatile boolean renderOnceFinish = true; // Lock to synchronize start/stop/renderOnce call private Object startStopViewLock = new Object(); // Lock for evaluateActive() only. This is used to prevent // using lock this which will cause deadlock when MC call // snapshot which waitForMC() in user thread. private Object evaluateLock = new Object(); /** * use for stop view, when stopview, set to count -1, * when reach 1, call stopView() in MC and reset to -1. */ int stopViewCount = -1; /** * False if current frame cycle time less than minimum frame cycle time */ boolean isMinCycleTimeAchieve = true; // Time to sleep if minimum frame cycle time not achieve long sleepTime = 0; // use in pure immediate mode to tell whether this view rendering // thread is added in MC renderThreadData volatile boolean inRenderThreadData = false; // use to notify MC that render bin has run once, and is ready for // renderer to render boolean renderBinReady = false; // No of time setUniverse() is invoke long universeCount = 0; // The universe count when UNREGISTER_VIEW request is post, // this is used to distingish whether new setUniverse() is // invoked after UNREGISTER_VIEW request post to avoid // resetting the newly set universe. long resetUnivCount = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -