class D3DContext extends BaseShaderContext
BaseShaderContext.MaskType, BaseShaderContext.SpecialShaderType, BaseShaderContext.State
Modifier and Type | Field and Description |
---|---|
private Vec3d |
cameraPos |
static int |
CULL_BACK |
static int |
CULL_FRONT |
static int |
CULL_NONE |
static int |
D3D_OK |
static int |
D3DCOMPMODE_ADD |
static int |
D3DCOMPMODE_CLEAR |
static int |
D3DCOMPMODE_DSTOUT |
static int |
D3DCOMPMODE_SRC |
static int |
D3DCOMPMODE_SRCOVER |
static int |
D3DERR_DEVICELOST |
static int |
D3DERR_DEVICENOTRESET |
static int |
D3DERR_OUTOFVIDEOMEMORY |
static int |
D3DTADDRESS_BORDER |
static int |
D3DTADDRESS_CLAMP |
static int |
D3DTADDRESS_MIRROR |
static int |
D3DTADDRESS_NOP |
static int |
D3DTADDRESS_WRAP |
static int |
E_FAIL |
private D3DResourceFactory |
factory |
private boolean |
isLost |
static int |
NUM_QUADS |
private long |
pContext |
private GeneralTransform3D |
projViewTx |
private static Affine3D |
scratchAffine3DTx |
private static GeneralTransform3D |
scratchTx |
private BaseShaderContext.State |
state |
private int |
targetHeight |
private int |
targetWidth |
private static double[] |
tempAdjustClipSpaceMat |
Constructor and Description |
---|
D3DContext(long pContext,
Screen screen,
D3DResourceFactory factory) |
Modifier and Type | Method and Description |
---|---|
private GeneralTransform3D |
adjustClipSpace(GeneralTransform3D projViewTx)
OpenGL projection transform use z-range of [-1, 1] while D3D expects it
to be [0, 1], so we need to adjust the matrix, see RT-32880.
|
void |
blit(RTTexture srcRTT,
RTTexture dstRTT,
int srcX0,
int srcY0,
int srcX1,
int srcY1,
int dstX0,
int dstY0,
int dstX1,
int dstY1) |
(package private) boolean |
buildNativeGeometry(long nativeHandle,
float[] vertexBuffer,
int vertexBufferLength,
int[] indexBuffer,
int indexBufferLength) |
(package private) boolean |
buildNativeGeometry(long nativeHandle,
float[] vertexBuffer,
int vertexBufferLength,
short[] indexBuffer,
int indexBufferLength) |
(package private) long |
createD3DMesh() |
(package private) long |
createD3DMeshView(long nativeMesh) |
(package private) long |
createD3DPhongMaterial() |
static boolean |
FAILED(int hr)
WIN32 COM bool FAILED(HRESULT hr) macro synonym
|
(package private) long |
getContextHandle() |
(package private) D3DFrameStats |
getFrameStats(boolean reset,
D3DFrameStats result) |
D3DResourceFactory |
getResourceFactory() |
static java.lang.String |
hResultToString(long hResult) |
protected void |
initState() |
(package private) boolean |
isLost()
Returns whether the context is lost.
|
boolean |
isRTTVolatile() |
private static void |
nBlit(long pContext,
long nSrcRTT,
long nDstRTT,
int srcX0,
int srcY0,
int srcX1,
int srcY1,
int dstX0,
int dstY0,
int dstX1,
int dstY1) |
private static boolean |
nBuildNativeGeometryInt(long pContext,
long nativeHandle,
float[] vertexBuffer,
int vertexBufferLength,
int[] indexBuffer,
int indexBufferLength) |
private static boolean |
nBuildNativeGeometryShort(long pContext,
long nativeHandle,
float[] vertexBuffer,
int vertexBufferLength,
short[] indexBuffer,
int indexBufferLength) |
private static long |
nCreateD3DMesh(long pContext) |
private static long |
nCreateD3DMeshView(long pContext,
long nativeMesh) |
private static long |
nCreateD3DPhongMaterial(long pContext) |
private static int |
nDrawIndexedQuads(long pContext,
float[] coords,
byte[] colors,
int numVertices) |
private static boolean |
nGetFrameStats(long pContext,
D3DFrameStats returnValue,
boolean bReset) |
private static boolean |
nIsRTTVolatile(long contextHandle) |
private static void |
nReleaseD3DMesh(long pContext,
long nativeHandle) |
private static void |
nReleaseD3DMeshView(long pContext,
long nativeHandle) |
private static void |
nReleaseD3DPhongMaterial(long pContext,
long nativeHandle) |
private static void |
nRenderMeshView(long pContext,
long nativeMeshView) |
private static int |
nResetClipRect(long pContext) |
private static int |
nResetTransform(long pContext) |
private static void |
nSetAmbientLight(long pContext,
long nativeMeshView,
float r,
float g,
float b) |
private static int |
nSetBlendEnabled(long pContext,
int mode) |
private static int |
nSetCameraPosition(long pContext,
double x,
double y,
double z) |
private static int |
nSetClipRect(long pContext,
int x1,
int y1,
int x2,
int y2) |
private static void |
nSetCullingMode(long pContext,
long nativeMeshView,
int cullingMode) |
private static int |
nSetDeviceParametersFor2D(long pContext) |
private static int |
nSetDeviceParametersFor3D(long pContext) |
private static void |
nSetDiffuseColor(long pContext,
long nativePhongMaterial,
float r,
float g,
float b,
float a) |
private static void |
nSetMap(long pContext,
long nativePhongMaterial,
int mapType,
long texID) |
private static void |
nSetMaterial(long pContext,
long nativeMeshView,
long nativePhongMaterialInfo) |
private static void |
nSetPointLight(long pContext,
long nativeMeshView,
int index,
float x,
float y,
float z,
float r,
float g,
float b,
float w) |
private static int |
nSetProjViewMatrix(long pContext,
boolean isOrtho,
double m00,
double m01,
double m02,
double m03,
double m10,
double m11,
double m12,
double m13,
double m20,
double m21,
double m22,
double m23,
double m30,
double m31,
double m32,
double m33) |
private static int |
nSetRenderTarget(long pContext,
long pDest,
boolean depthBuffer,
boolean msaa) |
private static void |
nSetSpecularColor(long pContext,
long nativePhongMaterial,
boolean set,
float r,
float g,
float b,
float a) |
private static int |
nSetTexture(long pContext,
long pTex,
int texUnit,
boolean linear,
int wrapMode) |
private static int |
nSetTransform(long pContext,
double m00,
double m01,
double m02,
double m03,
double m10,
double m11,
double m12,
double m13,
double m20,
double m21,
double m22,
double m23,
double m30,
double m31,
double m32,
double m33) |
private static void |
nSetWireframe(long pContext,
long nativeMeshView,
boolean wireframe) |
private static void |
nSetWorldTransform(long pContext,
double m00,
double m01,
double m02,
double m03,
double m10,
double m11,
double m12,
double m13,
double m20,
double m21,
double m22,
double m23,
double m30,
double m31,
double m32,
double m33) |
private static void |
nSetWorldTransformToIdentity(long pContext) |
(package private) void |
releaseD3DMesh(long nativeHandle) |
(package private) void |
releaseD3DMeshView(long nativeMeshView) |
(package private) void |
releaseD3DPhongMaterial(long nativeHandle) |
(package private) void |
renderMeshView(long nativeMeshView,
Graphics g) |
protected void |
renderQuads(float[] coordArray,
byte[] colorArray,
int numVertices) |
(package private) void |
setAmbientLight(long nativeMeshView,
float r,
float g,
float b) |
(package private) void |
setCullingMode(long nativeMeshView,
int cullMode) |
void |
setDeviceParametersFor2D() |
protected void |
setDeviceParametersFor3D() |
(package private) void |
setDiffuseColor(long nativePhongMaterial,
float r,
float g,
float b,
float a) |
private void |
setLost()
set device to lost state
|
(package private) void |
setMap(long nativePhongMaterial,
int mapType,
long nativeTexture) |
(package private) void |
setMaterial(long nativeMeshView,
long nativePhongMaterial) |
(package private) void |
setPointLight(long nativeMeshView,
int index,
float x,
float y,
float z,
float r,
float g,
float b,
float w) |
(package private) void |
setSpecularColor(long nativePhongMaterial,
boolean set,
float r,
float g,
float b,
float a) |
(package private) void |
setWireframe(long nativeMeshView,
boolean wireframe) |
(package private) boolean |
testLostStateAndReset()
Validates the device, sets the context lost
status if necessary, and tries to restore the context if needed.
|
protected void |
updateClipRect(Rectangle clipRect) |
protected void |
updateCompositeMode(CompositeMode mode) |
protected BaseShaderContext.State |
updateRenderTarget(RenderTarget target,
NGCamera camera,
boolean depthTest) |
protected void |
updateShaderTransform(Shader shader,
BaseTransform xform) |
protected void |
updateTexture(int texUnit,
Texture tex) |
protected void |
updateWorldTransform(BaseTransform xform) |
(package private) static void |
validate(int res)
Does D3D native return value validation for DEBUG interests
|
(package private) boolean |
validatePresent(int res)
Validates result of present operation,
sets the context lost status if necessary
|
disposeLCDBuffer, getLCDBuffer, init, initLCDBuffer, isSuperShaderEnabled, releaseRenderTarget, resetLastClip, setPerspectiveTransform, setRenderTarget, validateClearOp, validateLCDBuffer, validateLCDOp, validatePaintOp, validateTextureOp
clearGlyphCaches, drawQuads, flushMask, flushVertexBuffer, getAssociatedScreen, getGlyphCache, getGradientTexture, getOvalTexture, getPerspectiveTransformNoClone, getRectTexture, getRectTextureMaxSize, getVertexBuffer, getWrapRectTexture, setRenderTarget, updateMaskTexture, validateMaskTexture
public static final int D3DERR_DEVICENOTRESET
public static final int D3DERR_DEVICELOST
public static final int E_FAIL
public static final int D3DERR_OUTOFVIDEOMEMORY
public static final int D3D_OK
public static final int D3DCOMPMODE_CLEAR
public static final int D3DCOMPMODE_SRC
public static final int D3DCOMPMODE_SRCOVER
public static final int D3DCOMPMODE_DSTOUT
public static final int D3DCOMPMODE_ADD
public static final int D3DTADDRESS_NOP
public static final int D3DTADDRESS_WRAP
public static final int D3DTADDRESS_MIRROR
public static final int D3DTADDRESS_CLAMP
public static final int D3DTADDRESS_BORDER
public static final int CULL_BACK
public static final int CULL_FRONT
public static final int CULL_NONE
private static GeneralTransform3D scratchTx
private static final Affine3D scratchAffine3DTx
private static double[] tempAdjustClipSpaceMat
private BaseShaderContext.State state
private boolean isLost
private final long pContext
private Vec3d cameraPos
private GeneralTransform3D projViewTx
private int targetWidth
private int targetHeight
private final D3DResourceFactory factory
public static final int NUM_QUADS
D3DContext(long pContext, Screen screen, D3DResourceFactory factory)
public static boolean FAILED(int hr)
hr
- public D3DResourceFactory getResourceFactory()
getResourceFactory
in class BaseContext
protected void initState()
long getContextHandle()
boolean isLost()
static void validate(int res)
private void setLost()
boolean testLostStateAndReset()
boolean validatePresent(int res)
private GeneralTransform3D adjustClipSpace(GeneralTransform3D projViewTx)
protected BaseShaderContext.State updateRenderTarget(RenderTarget target, NGCamera camera, boolean depthTest)
updateRenderTarget
in class BaseShaderContext
protected void updateTexture(int texUnit, Texture tex)
updateTexture
in class BaseShaderContext
protected void updateShaderTransform(Shader shader, BaseTransform xform)
updateShaderTransform
in class BaseShaderContext
protected void updateWorldTransform(BaseTransform xform)
updateWorldTransform
in class BaseShaderContext
protected void updateClipRect(Rectangle clipRect)
updateClipRect
in class BaseShaderContext
protected void updateCompositeMode(CompositeMode mode)
updateCompositeMode
in class BaseShaderContext
D3DFrameStats getFrameStats(boolean reset, D3DFrameStats result)
private static int nSetRenderTarget(long pContext, long pDest, boolean depthBuffer, boolean msaa)
private static int nSetTexture(long pContext, long pTex, int texUnit, boolean linear, int wrapMode)
private static int nResetTransform(long pContext)
private static int nSetTransform(long pContext, double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
private static void nSetWorldTransformToIdentity(long pContext)
private static void nSetWorldTransform(long pContext, double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
private static int nSetCameraPosition(long pContext, double x, double y, double z)
private static int nSetProjViewMatrix(long pContext, boolean isOrtho, double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
private static int nResetClipRect(long pContext)
private static int nSetClipRect(long pContext, int x1, int y1, int x2, int y2)
private static int nSetBlendEnabled(long pContext, int mode)
private static int nSetDeviceParametersFor2D(long pContext)
private static int nSetDeviceParametersFor3D(long pContext)
private static long nCreateD3DMesh(long pContext)
private static void nReleaseD3DMesh(long pContext, long nativeHandle)
private static boolean nBuildNativeGeometryShort(long pContext, long nativeHandle, float[] vertexBuffer, int vertexBufferLength, short[] indexBuffer, int indexBufferLength)
private static boolean nBuildNativeGeometryInt(long pContext, long nativeHandle, float[] vertexBuffer, int vertexBufferLength, int[] indexBuffer, int indexBufferLength)
private static long nCreateD3DPhongMaterial(long pContext)
private static void nReleaseD3DPhongMaterial(long pContext, long nativeHandle)
private static void nSetDiffuseColor(long pContext, long nativePhongMaterial, float r, float g, float b, float a)
private static void nSetSpecularColor(long pContext, long nativePhongMaterial, boolean set, float r, float g, float b, float a)
private static void nSetMap(long pContext, long nativePhongMaterial, int mapType, long texID)
private static long nCreateD3DMeshView(long pContext, long nativeMesh)
private static void nReleaseD3DMeshView(long pContext, long nativeHandle)
private static void nSetCullingMode(long pContext, long nativeMeshView, int cullingMode)
private static void nSetMaterial(long pContext, long nativeMeshView, long nativePhongMaterialInfo)
private static void nSetWireframe(long pContext, long nativeMeshView, boolean wireframe)
private static void nSetAmbientLight(long pContext, long nativeMeshView, float r, float g, float b)
private static void nSetPointLight(long pContext, long nativeMeshView, int index, float x, float y, float z, float r, float g, float b, float w)
private static void nRenderMeshView(long pContext, long nativeMeshView)
private static int nDrawIndexedQuads(long pContext, float[] coords, byte[] colors, int numVertices)
private static void nBlit(long pContext, long nSrcRTT, long nDstRTT, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1)
private static boolean nGetFrameStats(long pContext, D3DFrameStats returnValue, boolean bReset)
private static boolean nIsRTTVolatile(long contextHandle)
public boolean isRTTVolatile()
public static java.lang.String hResultToString(long hResult)
public void setDeviceParametersFor2D()
setDeviceParametersFor2D
in class BaseContext
protected void setDeviceParametersFor3D()
setDeviceParametersFor3D
in class BaseContext
long createD3DMesh()
void releaseD3DMesh(long nativeHandle)
boolean buildNativeGeometry(long nativeHandle, float[] vertexBuffer, int vertexBufferLength, short[] indexBuffer, int indexBufferLength)
boolean buildNativeGeometry(long nativeHandle, float[] vertexBuffer, int vertexBufferLength, int[] indexBuffer, int indexBufferLength)
long createD3DPhongMaterial()
void releaseD3DPhongMaterial(long nativeHandle)
void setDiffuseColor(long nativePhongMaterial, float r, float g, float b, float a)
void setSpecularColor(long nativePhongMaterial, boolean set, float r, float g, float b, float a)
void setMap(long nativePhongMaterial, int mapType, long nativeTexture)
long createD3DMeshView(long nativeMesh)
void releaseD3DMeshView(long nativeMeshView)
void setCullingMode(long nativeMeshView, int cullMode)
void setMaterial(long nativeMeshView, long nativePhongMaterial)
void setWireframe(long nativeMeshView, boolean wireframe)
void setAmbientLight(long nativeMeshView, float r, float g, float b)
void setPointLight(long nativeMeshView, int index, float x, float y, float z, float r, float g, float b, float w)
protected void renderQuads(float[] coordArray, byte[] colorArray, int numVertices)
renderQuads
in class BaseContext
void renderMeshView(long nativeMeshView, Graphics g)
public void blit(RTTexture srcRTT, RTTexture dstRTT, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1)
blit
in class BaseShaderContext