modules/graphics/src/main/java/com/sun/prism/d3d/D3DContext.java

Print this page

        

*** 31,40 **** --- 31,41 ---- import com.sun.javafx.geom.transform.BaseTransform; import com.sun.javafx.geom.transform.GeneralTransform3D; import com.sun.javafx.sg.prism.NGCamera; import com.sun.javafx.sg.prism.NGDefaultCamera; import com.sun.prism.CompositeMode; + import com.sun.prism.Graphics; import com.sun.prism.MeshView; import com.sun.prism.RTTexture; import com.sun.prism.RenderTarget; import com.sun.prism.Texture; import com.sun.prism.impl.PrismSettings;
*** 83,93 **** private State state; private boolean isLost = false; private final long pContext; ! NGCamera camera = null; private int targetWidth = 0, targetHeight = 0; private final D3DResourceFactory factory; public static final int NUM_QUADS = PrismSettings.superShader ? 4096 : 256; --- 84,94 ---- private State state; private boolean isLost = false; private final long pContext; ! private Vec3d cameraPos = new Vec3d(); private int targetWidth = 0, targetHeight = 0; private final D3DResourceFactory factory; public static final int NUM_QUADS = PrismSettings.superShader ? 4096 : 256;
*** 213,223 **** // if render target wasn't changed if (res == D3D_OK) { resetLastClip(state); } - this.camera = camera; targetWidth = target.getPhysicalWidth(); targetHeight = target.getPhysicalHeight(); // Need to validate the camera before getting its computed data. if (camera instanceof NGDefaultCamera) { --- 214,223 ----
*** 240,252 **** tempTx.get(4), tempTx.get(5), tempTx.get(6), tempTx.get(7), tempTx.get(8), tempTx.get(9), tempTx.get(10), tempTx.get(11), tempTx.get(12), tempTx.get(13), tempTx.get(14), tempTx.get(15)); validate(res); ! tempVec3d = camera.getPositionInWorld(tempVec3d); ! // System.err.println("Camera position in world = " + tempVec3d); ! res = nSetCameraPosition(pContext, tempVec3d.x, tempVec3d.y, tempVec3d.z); return state; } @Override --- 240,252 ---- tempTx.get(4), tempTx.get(5), tempTx.get(6), tempTx.get(7), tempTx.get(8), tempTx.get(9), tempTx.get(10), tempTx.get(11), tempTx.get(12), tempTx.get(13), tempTx.get(14), tempTx.get(15)); validate(res); ! // update camera position; this will be uploaded to the shader ! // when we switch to 3D state ! cameraPos = camera.getPositionInWorld(cameraPos); return state; } @Override
*** 542,553 **** void setPointLight(long nativeMeshView, int index, float x, float y, float z, float r, float g, float b, float w) { nSetPointLight(pContext, nativeMeshView, index, x, y, z, r, g, b, w); } ! void renderMeshView(long nativeMeshView, BaseTransform transformNoClone) { ! updateWorldTransform(transformNoClone); nRenderMeshView(pContext, nativeMeshView); } @Override public void blit(RTTexture srcRTT, RTTexture dstRTT, --- 542,559 ---- void setPointLight(long nativeMeshView, int index, float x, float y, float z, float r, float g, float b, float w) { nSetPointLight(pContext, nativeMeshView, index, x, y, z, r, g, b, w); } ! void renderMeshView(long nativeMeshView, Graphics g) { ! updateWorldTransform(g.getTransformNoClone()); ! float pixelScaleFactor = g.getPixelScaleFactor(); ! int res = nSetCameraPosition(pContext, ! cameraPos.x * pixelScaleFactor, ! cameraPos.y * pixelScaleFactor, ! cameraPos.z * pixelScaleFactor); ! validate(res); nRenderMeshView(pContext, nativeMeshView); } @Override public void blit(RTTexture srcRTT, RTTexture dstRTT,