📄 canvas3d.java
字号:
// boolean stereoAvailable; // // Flag to enable stereo rendering, if allowed by the // stereoAvailable flag. // boolean stereoEnable = true; // // This flag is set when stereo mode is both enabled and // available. Code that looks at stereo mode should use this // flag. // boolean useStereo; // Indicate whether it is left or right stereo pass currently boolean rightStereoPass = false; // // Specifies how Java 3D generates monoscopic view // (LEFT_EYE_VIEW, RIGHT_EYE_VIEW, or CYCLOPEAN_EYE_VIEW). // int monoscopicViewPolicy = View.CYCLOPEAN_EYE_VIEW; // User requested stencil size int requestedStencilSize; // Actual stencil size return for this canvas int actualStencilSize; // True if stencil buffer is available for user boolean userStencilAvailable; // True if stencil buffer is available for system ( decal ) boolean systemStencilAvailable; // // Read-only flag that indicates whether double buffering is supported // for this canvas. This is always false for off-screen canvases. // boolean doubleBufferAvailable; // // Flag to enable double buffered rendering, if allowed by the // doubleBufferAvailable flag. // boolean doubleBufferEnable = true; // // This flag is set when doubleBuffering is both enabled and // available Code that enables or disables double buffering should // use this flag. // boolean useDoubleBuffer; // // Read-only flag that indicates whether scene antialiasing // is supported for this canvas. // boolean sceneAntialiasingAvailable; boolean sceneAntialiasingMultiSamplesAvailable; // Use to see whether antialiasing is already set boolean antialiasingSet = false; // // Read-only flag that indicates the size of the texture color // table for this canvas. A value of 0 indicates that the texture // color table is not supported. // int textureColorTableSize; // number of active/enabled texture unit int numActiveTexUnit = 0; // index iof last enabled texture unit int lastActiveTexUnit = -1; // True if shadingLanguage is supported, otherwise false. boolean shadingLanguageGLSL = false; boolean shadingLanguageCg = false; // Query properties J3dQueryProps queryProps; // Flag indicating a fatal rendering error of some sort private boolean fatalError = false; // // The positions of the manual left and right eyes in image-plate // coordinates. // By default, we will use the center of the screen for X and Y values // (X values are adjusted for default eye separation), and // 0.4572 meters (18 inches) for the Z value. // These match defaults elsewhere in the system. // Point3d leftManualEyeInImagePlate = new Point3d(0.142, 0.135, 0.4572); Point3d rightManualEyeInImagePlate = new Point3d(0.208, 0.135, 0.4572); // // View that is attached to this Canvas3D. // View view = null; // View waiting to be set View pendingView; // // View cache for this canvas and its associated view. // CanvasViewCache canvasViewCache = null; // Issue 109: View cache for this canvas, for computing view frustum planes CanvasViewCache canvasViewCacheFrustum = null; // Since multiple renderAtomListInfo, share the same vecBounds // we want to do the intersection test only once per renderAtom // this flag is set to true after the first intersect and set to // false during checkForCompaction in renderBin boolean raIsVisible = false; RenderAtom ra = null; // Stereo related field has changed. static final int STEREO_DIRTY = 0x01; // MonoscopicViewPolicy field has changed. static final int MONOSCOPIC_VIEW_POLICY_DIRTY = 0x02; // Left/right eye in image plate field has changed. static final int EYE_IN_IMAGE_PLATE_DIRTY = 0x04; // Canvas has moved/resized. static final int MOVED_OR_RESIZED_DIRTY = 0x08; // Canvas Background changed (this may affect doInfinite flag) static final int BACKGROUND_DIRTY = 0x10; // Canvas Background Image changed static final int BACKGROUND_IMAGE_DIRTY = 0x20; // Mask that indicates this Canvas view dependence info. has changed, // and CanvasViewCache may need to recompute the final view matries. static final int VIEW_INFO_DIRTY = (STEREO_DIRTY | MONOSCOPIC_VIEW_POLICY_DIRTY | EYE_IN_IMAGE_PLATE_DIRTY | MOVED_OR_RESIZED_DIRTY | BACKGROUND_DIRTY | BACKGROUND_IMAGE_DIRTY); // Issue 163: Array of dirty bits is used because the Renderer and // RenderBin run asynchronously. Now that they each have a separate // instance of CanvasViewCache (due to the fix for Issue 109), they // need separate dirty bits. Array element 0 is used for the Renderer and // element 1 is used for the RenderBin. static final int RENDERER_DIRTY_IDX = 0; static final int RENDER_BIN_DIRTY_IDX = 1; int[] cvDirtyMask = new int[2]; // This boolean informs the J3DGraphics2DImpl that the window is resized boolean resizeGraphics2D = true; // // This boolean allows an application to start and stop the render // loop on this canvas. // volatile boolean isRunning = true; // This is used by MasterControl only. MC relay on this in a // single loop to set renderer thread. During this time, // the isRunningStatus can't change by user thread. volatile boolean isRunningStatus = true; // This is true when the canvas is ready to be rendered into boolean active = false; // This is true when the canvas is visible boolean visible = false; // This is true if context need to recreate boolean ctxReset = true; // The Screen3D that corresponds to this Canvas3D Screen3D screen = null; // Flag to indicate that image is render completely // so swap is valid. boolean imageReady = false; // // The current fog enable state // int fogOn = 0; // The 3D Graphics context used for immediate mode rendering // into this canvas. GraphicsContext3D graphicsContext3D = null; boolean waiting = false; boolean swapDone = false; GraphicsConfiguration graphicsConfiguration; // The Java 3D Graphics2D object used for Java2D/AWT rendering // into this Canvas3D J3DGraphics2DImpl graphics2D = null; // Lock used to synchronize the creation of the 2D and 3D // graphics context objects Object gfxCreationLock = new Object(); // The source of the currently loaded localToVWorld for this Canvas3D // (used to only update the model matrix when it changes) // Transform3D localToVWorldSrc = null; // The current vworldToEc Transform Transform3D vworldToEc = new Transform3D(); // The view transform (VPC to EC) for the current eye. // NOTE that this is *read-only* Transform3D vpcToEc; // Opaque object representing the underlying drawable (window). This // is defined by the Pipeline. Drawable drawable = null; // fbConfig is a pointer to the fbConfig object that is associated with // the GraphicsConfiguration object used to create this Canvas. // // For Unix : Fix for issue 20. // The fbConfig is only used when running X11. It contains a pointer // to the native GLXFBConfig structure list, since in some cases the visual id // alone isn't sufficient for the native OpenGL renderer (e.g., when using // Solaris OpenGL with Xinerama mode disabled). // // For Windows : Fix for issue 76. This is use as a holder of the // PixelFormat structure ( see also gldef.h ) to allow value such // as offScreen's pixelformat, and ARB function pointers to be stored. long fbConfig = 0; // offScreenBufferInfo is a pointer to additional information about the // offScreenBuffer in this Canvas. // // For Windows : Fix for issue 76. long offScreenBufferInfo = 0; // graphicsConfigTable is a static hashtable which allows getBestConfiguration() // in NativeConfigTemplate3D to map a GraphicsConfiguration to the pointer // to the actual GLXFBConfig that glXChooseFBConfig() returns. The Canvas3D // doesn't exist at the time getBestConfiguration() is called, and // X11GraphicsConfig neither maintains this pointer nor provides a public // constructor to allow Java 3D to extend it. static Hashtable<GraphicsConfiguration,GraphicsConfigInfo> graphicsConfigTable = new Hashtable<GraphicsConfiguration,GraphicsConfigInfo>(); // The native graphics version, vendor, and renderer information String nativeGraphicsVersion = "<UNKNOWN>"; String nativeGraphicsVendor = "<UNKNOWN>"; String nativeGraphicsRenderer = "<UNKNOWN>"; boolean firstPaintCalled = false; // This reflects whether or not this canvas has seen an addNotify. It is // forced to true for off-screen canvases boolean added = false; // Flag indicating whether addNotify has been called (so we don't process it twice). private boolean addNotifyCalled = false; // This is the id for the underlying graphics context structure. Context ctx = null; // since the ctx id can be the same as the previous one, // we need to keep a time stamp to differentiate the contexts with the // same id volatile long ctxTimeStamp = 0; // The current context setting for local eye lighting boolean ctxEyeLightingEnable = false; // This AppearanceRetained Object refelects the current state of this // canvas. It is used to optimize setting of attributes at render time. AppearanceRetained currentAppear = new AppearanceRetained(); // This MaterialRetained Object refelects the current state of this canvas. // It is used to optimize setting of attributes at render time. MaterialRetained currentMaterial = new MaterialRetained(); /** * The object used for View Frustum Culling */ CachedFrustum viewFrustum = new CachedFrustum(); /** * The RenderBin bundle references used to decide what the underlying * context contains. */ LightBin lightBin = null; EnvironmentSet environmentSet = null; AttributeBin attributeBin = null; ShaderBin shaderBin = null; RenderMolecule renderMolecule = null; PolygonAttributesRetained polygonAttributes = null; LineAttributesRetained lineAttributes = null; PointAttributesRetained pointAttributes = null; MaterialRetained material = null; boolean enableLighting = false; TransparencyAttributesRetained transparency = null; ColoringAttributesRetained coloringAttributes = null; Transform3D modelMatrix = null; Transform3D projTrans = null; TextureBin textureBin = null; /** * cached RenderBin states for lazy native states update */ LightRetained lights[] = null; int frameCount[] = null; long enableMask = -1; FogRetained fog = null; ModelClipRetained modelClip = null; Color3f sceneAmbient = new Color3f(); TextureUnitStateRetained[] texUnitState = null; /** * These cached values are only used in Pure Immediate and Mixed Mode rendering */ TextureRetained texture = null; TextureAttributesRetained texAttrs = null; TexCoordGenerationRetained texCoordGeneration = null; RenderingAttributesRetained renderingAttrs = null; AppearanceRetained appearance = null; ShaderProgramRetained shaderProgram = null; // only used in Mixed Mode rendering Object appHandle = null; /** * Set to true when any one of texture state use * Texture Generation linear mode. This is used for D3D * temporary turn displayList off and do its own coordinate * generation since D3D don't support it. * * TODO aces : is this still true in DX9? */ boolean texLinearMode = false; /** * Dirty bit to determine if the NodeComponent needs to be re-sent * down to the underlying API */ int canvasDirty = 0xffff; // True when either one of dirtyRenderMoleculeList, // dirtyDlistPerRinfoList, dirtyRenderAtomList size > 0 boolean dirtyDisplayList = false; ArrayList dirtyRenderMoleculeList = new ArrayList(); ArrayList dirtyRenderAtomList = new ArrayList(); // List of (Rm, rInfo) pair of individual dlists that need to be rebuilt ArrayList dirtyDlistPerRinfoList = new ArrayList();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -