- Fix compilation again using olders GL headers
(glCompressedTexImage2DARB problem). - Fix typo on constant. - Detection of NVidia texture_shader and register_combiners extensions. - Begin to implement BUMPMAPPING using NVidia Texture shader extension (not really working for now).
This commit is contained in:
parent
c349d7d297
commit
d52c5080cf
|
@ -232,6 +232,7 @@ struct PLIGHTINFOEL {
|
|||
#define GL_SUPPORT(ExtName) (TRUE == This->direct3d8->gl_info.supported[ExtName])
|
||||
#define GL_SUPPORT_DEV(ExtName, dev) (TRUE == (dev)->direct3d8->gl_info.supported[ExtName])
|
||||
#define GL_EXTCALL(FuncName) (This->direct3d8->gl_info.FuncName)
|
||||
#define GL_EXTCALL_DEV(FuncName, dev) ((dev)->direct3d8->gl_info.FuncName)
|
||||
|
||||
|
||||
#define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f)
|
||||
|
@ -359,6 +360,8 @@ struct IDirect3DDevice8Impl
|
|||
PALETTEENTRY palettes[MAX_PALETTES][256];
|
||||
UINT currentPalette;
|
||||
|
||||
BOOL texture_shader_active;
|
||||
|
||||
/* Optimization */
|
||||
BOOL modelview_valid;
|
||||
BOOL proj_valid;
|
||||
|
|
|
@ -386,6 +386,195 @@ typedef void (APIENTRY * PGLFNGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint l
|
|||
#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C
|
||||
/* reuse GL_EYE_PLANE */
|
||||
#endif
|
||||
/* GL_NV_texgen_reflection */
|
||||
#ifndef GL_NV_texgen_reflection
|
||||
#define GL_NV_texgen_reflection 1
|
||||
#define GL_NORMAL_MAP_NV 0x8511
|
||||
#define GL_REFLECTION_MAP_NV 0x8512
|
||||
#endif
|
||||
/* GL_NV_register_combiners */
|
||||
#ifndef GL_NV_register_combiners
|
||||
#define GL_NV_register_combiners 1
|
||||
#define GL_REGISTER_COMBINERS_NV 0x8522
|
||||
#define GL_VARIABLE_A_NV 0x8523
|
||||
#define GL_VARIABLE_B_NV 0x8524
|
||||
#define GL_VARIABLE_C_NV 0x8525
|
||||
#define GL_VARIABLE_D_NV 0x8526
|
||||
#define GL_VARIABLE_E_NV 0x8527
|
||||
#define GL_VARIABLE_F_NV 0x8528
|
||||
#define GL_VARIABLE_G_NV 0x8529
|
||||
#define GL_CONSTANT_COLOR0_NV 0x852A
|
||||
#define GL_CONSTANT_COLOR1_NV 0x852B
|
||||
#define GL_PRIMARY_COLOR_NV 0x852C
|
||||
#define GL_SECONDARY_COLOR_NV 0x852D
|
||||
#define GL_SPARE0_NV 0x852E
|
||||
#define GL_SPARE1_NV 0x852F
|
||||
#define GL_DISCARD_NV 0x8530
|
||||
#define GL_E_TIMES_F_NV 0x8531
|
||||
#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532
|
||||
#define GL_UNSIGNED_IDENTITY_NV 0x8536
|
||||
#define GL_UNSIGNED_INVERT_NV 0x8537
|
||||
#define GL_EXPAND_NORMAL_NV 0x8538
|
||||
#define GL_EXPAND_NEGATE_NV 0x8539
|
||||
#define GL_HALF_BIAS_NORMAL_NV 0x853A
|
||||
#define GL_HALF_BIAS_NEGATE_NV 0x853B
|
||||
#define GL_SIGNED_IDENTITY_NV 0x853C
|
||||
#define GL_SIGNED_NEGATE_NV 0x853D
|
||||
#define GL_SCALE_BY_TWO_NV 0x853E
|
||||
#define GL_SCALE_BY_FOUR_NV 0x853F
|
||||
#define GL_SCALE_BY_ONE_HALF_NV 0x8540
|
||||
#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541
|
||||
#define GL_COMBINER_INPUT_NV 0x8542
|
||||
#define GL_COMBINER_MAPPING_NV 0x8543
|
||||
#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544
|
||||
#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545
|
||||
#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546
|
||||
#define GL_COMBINER_MUX_SUM_NV 0x8547
|
||||
#define GL_COMBINER_SCALE_NV 0x8548
|
||||
#define GL_COMBINER_BIAS_NV 0x8549
|
||||
#define GL_COMBINER_AB_OUTPUT_NV 0x854A
|
||||
#define GL_COMBINER_CD_OUTPUT_NV 0x854B
|
||||
#define GL_COMBINER_SUM_OUTPUT_NV 0x854C
|
||||
#define GL_MAX_GENERAL_COMBINERS_NV 0x854D
|
||||
#define GL_NUM_GENERAL_COMBINERS_NV 0x854E
|
||||
#define GL_COLOR_SUM_CLAMP_NV 0x854F
|
||||
#define GL_COMBINER0_NV 0x8550
|
||||
#define GL_COMBINER1_NV 0x8551
|
||||
#define GL_COMBINER2_NV 0x8552
|
||||
#define GL_COMBINER3_NV 0x8553
|
||||
#define GL_COMBINER4_NV 0x8554
|
||||
#define GL_COMBINER5_NV 0x8555
|
||||
#define GL_COMBINER6_NV 0x8556
|
||||
#define GL_COMBINER7_NV 0x8557
|
||||
/* reuse GL_TEXTURE0_ARB */
|
||||
/* reuse GL_TEXTURE1_ARB */
|
||||
/* reuse GL_ZERO */
|
||||
/* reuse GL_NONE */
|
||||
/* reuse GL_FOG */
|
||||
#endif
|
||||
typedef void (APIENTRY * PGLFNCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params);
|
||||
typedef void (APIENTRY * PGLFNCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param);
|
||||
typedef void (APIENTRY * PGLFNCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params);
|
||||
typedef void (APIENTRY * PGLFNCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param);
|
||||
typedef void (APIENTRY * PGLFNCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
|
||||
typedef void (APIENTRY * PGLFNCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
|
||||
typedef void (APIENTRY * PGLFNFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
|
||||
typedef void (APIENTRY * PGLFNGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRY * PGLFNGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY * PGLFNGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRY * PGLFNGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY * PGLFNGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRY * PGLFNGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params);
|
||||
/* GL_NV_register_combiners2 */
|
||||
#ifndef GL_NV_register_combiners2
|
||||
#define GL_NV_register_combiners2 1
|
||||
#define GL_PER_STAGE_CONSTANTS_NV 0x8535
|
||||
#endif
|
||||
typedef void (APIENTRY * PGLFNCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params);
|
||||
typedef void (APIENTRY * PGLFNGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params);
|
||||
/* GL_NV_texture_shader */
|
||||
#ifndef GL_NV_texture_shader
|
||||
#define GL_NV_texture_shader 1
|
||||
#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C
|
||||
#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D
|
||||
#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E
|
||||
#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9
|
||||
#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA
|
||||
#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB
|
||||
#define GL_DSDT_MAG_INTENSITY_NV 0x86DC
|
||||
#define GL_SHADER_CONSISTENT_NV 0x86DD
|
||||
#define GL_TEXTURE_SHADER_NV 0x86DE
|
||||
#define GL_SHADER_OPERATION_NV 0x86DF
|
||||
#define GL_CULL_MODES_NV 0x86E0
|
||||
#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1
|
||||
#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2
|
||||
#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3
|
||||
#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV
|
||||
#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV
|
||||
#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV
|
||||
#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4
|
||||
#define GL_CONST_EYE_NV 0x86E5
|
||||
#define GL_PASS_THROUGH_NV 0x86E6
|
||||
#define GL_CULL_FRAGMENT_NV 0x86E7
|
||||
#define GL_OFFSET_TEXTURE_2D_NV 0x86E8
|
||||
#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9
|
||||
#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA
|
||||
#define GL_DOT_PRODUCT_NV 0x86EC
|
||||
#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED
|
||||
#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE
|
||||
#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0
|
||||
#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1
|
||||
#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2
|
||||
#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3
|
||||
#define GL_HILO_NV 0x86F4
|
||||
#define GL_DSDT_NV 0x86F5
|
||||
#define GL_DSDT_MAG_NV 0x86F6
|
||||
#define GL_DSDT_MAG_VIB_NV 0x86F7
|
||||
#define GL_HILO16_NV 0x86F8
|
||||
#define GL_SIGNED_HILO_NV 0x86F9
|
||||
#define GL_SIGNED_HILO16_NV 0x86FA
|
||||
#define GL_SIGNED_RGBA_NV 0x86FB
|
||||
#define GL_SIGNED_RGBA8_NV 0x86FC
|
||||
#define GL_SIGNED_RGB_NV 0x86FE
|
||||
#define GL_SIGNED_RGB8_NV 0x86FF
|
||||
#define GL_SIGNED_LUMINANCE_NV 0x8701
|
||||
#define GL_SIGNED_LUMINANCE8_NV 0x8702
|
||||
#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703
|
||||
#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704
|
||||
#define GL_SIGNED_ALPHA_NV 0x8705
|
||||
#define GL_SIGNED_ALPHA8_NV 0x8706
|
||||
#define GL_SIGNED_INTENSITY_NV 0x8707
|
||||
#define GL_SIGNED_INTENSITY8_NV 0x8708
|
||||
#define GL_DSDT8_NV 0x8709
|
||||
#define GL_DSDT8_MAG8_NV 0x870A
|
||||
#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B
|
||||
#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C
|
||||
#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D
|
||||
#define GL_HI_SCALE_NV 0x870E
|
||||
#define GL_LO_SCALE_NV 0x870F
|
||||
#define GL_DS_SCALE_NV 0x8710
|
||||
#define GL_DT_SCALE_NV 0x8711
|
||||
#define GL_MAGNITUDE_SCALE_NV 0x8712
|
||||
#define GL_VIBRANCE_SCALE_NV 0x8713
|
||||
#define GL_HI_BIAS_NV 0x8714
|
||||
#define GL_LO_BIAS_NV 0x8715
|
||||
#define GL_DS_BIAS_NV 0x8716
|
||||
#define GL_DT_BIAS_NV 0x8717
|
||||
#define GL_MAGNITUDE_BIAS_NV 0x8718
|
||||
#define GL_VIBRANCE_BIAS_NV 0x8719
|
||||
#define GL_TEXTURE_BORDER_VALUES_NV 0x871A
|
||||
#define GL_TEXTURE_HI_SIZE_NV 0x871B
|
||||
#define GL_TEXTURE_LO_SIZE_NV 0x871C
|
||||
#define GL_TEXTURE_DS_SIZE_NV 0x871D
|
||||
#define GL_TEXTURE_DT_SIZE_NV 0x871E
|
||||
#define GL_TEXTURE_MAG_SIZE_NV 0x871F
|
||||
#endif
|
||||
/* GL_NV_texture_shader2 */
|
||||
#ifndef GL_NV_texture_shader2
|
||||
#define GL_NV_texture_shader2 1
|
||||
#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF
|
||||
#endif
|
||||
/* GL_NV_texture_shader3 */
|
||||
#ifndef GL_NV_texture_shader3
|
||||
#define GL_NV_texture_shader3 1
|
||||
#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850
|
||||
#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851
|
||||
#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852
|
||||
#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853
|
||||
#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854
|
||||
#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855
|
||||
#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856
|
||||
#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857
|
||||
#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858
|
||||
#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859
|
||||
#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A
|
||||
#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B
|
||||
#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C
|
||||
#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D
|
||||
#define GL_HILO8_NV 0x885E
|
||||
#define GL_SIGNED_HILO8_NV 0x885F
|
||||
#define GL_FORCE_BLUE_TO_ONE_NV 0x8860
|
||||
#endif
|
||||
|
||||
/*******
|
||||
* OpenGL Official Version
|
||||
|
@ -458,6 +647,7 @@ typedef enum _GL_SupportedExt {
|
|||
EXT_PALETTED_TEXTURE,
|
||||
EXT_POINT_PARAMETERS,
|
||||
EXT_SECONDARY_COLOR,
|
||||
EXT_STENCIL_WRAP,
|
||||
EXT_TEXTURE_COMPRESSION_S3TC,
|
||||
EXT_TEXTURE_FILTER_ANISOTROPIC,
|
||||
EXT_TEXTURE_LOD,
|
||||
|
@ -467,9 +657,15 @@ typedef enum _GL_SupportedExt {
|
|||
EXT_TEXTURE_ENV_DOT3,
|
||||
EXT_VERTEX_WEIGHTING,
|
||||
/* NVIDIA */
|
||||
NV_TEXTURE_ENV_COMBINE4,
|
||||
NV_FRAGMENT_PROGRAM,
|
||||
NV_FOG_DISTANCE,
|
||||
NV_FRAGMENT_PROGRAM,
|
||||
NV_REGISTER_COMBINERS,
|
||||
NV_REGISTER_COMBINERS2,
|
||||
NV_TEXGEN_REFLECTION,
|
||||
NV_TEXTURE_ENV_COMBINE4,
|
||||
NV_TEXTURE_SHADER,
|
||||
NV_TEXTURE_SHADER2,
|
||||
NV_TEXTURE_SHADER3,
|
||||
NV_VERTEX_PROGRAM,
|
||||
/* ATI */
|
||||
ATI_TEXTURE_ENV_COMBINE3,
|
||||
|
@ -519,18 +715,24 @@ typedef enum _GL_PSVersion {
|
|||
#define MAKEDWORD_VERSION(maj, min) ((maj & 0x0000FFFF) << 16) | (min & 0x0000FFFF)
|
||||
|
||||
#define GL_EXT_FUNCS_GEN \
|
||||
/** ARB Extensions **/ \
|
||||
/* GL_ARB_texture_compression */ \
|
||||
USE_GL_FUNC(PGLFNCOMPRESSEDTEXIMAGE2DPROC, glCompressedTexImage2DARB); \
|
||||
USE_GL_FUNC(PGLFNCOMPRESSEDTEXIMAGE3DPROC, glCompressedTexImage3DARB); \
|
||||
USE_GL_FUNC(PGLFNCOMPRESSEDTEXSUBIMAGE2DPROC, glCompressedTexSubImage2DARB); \
|
||||
USE_GL_FUNC(PGLFNCOMPRESSEDTEXSUBIMAGE3DPROC, glCompressedTexSubImage3DARB); \
|
||||
/** EXT Extensions **/ \
|
||||
/* GL_EXT_fog_coord */ \
|
||||
/* GL_EXT_paletted_texture */ \
|
||||
USE_GL_FUNC(PGLFNGLCOLORTABLEEXTPROC, glColorTableEXT); \
|
||||
USE_GL_FUNC(PGLFNGLCOLORTABLEEXTPROC, glColorTableEXT); \
|
||||
/* GL_EXT_point_parameters */ \
|
||||
USE_GL_FUNC(PGLFNGLPOINTPARAMETERFEXTPROC, glPointParameterfEXT); \
|
||||
USE_GL_FUNC(PGLFNGLPOINTPARAMETERFVEXTPROC, glPointParameterfvEXT); \
|
||||
USE_GL_FUNC(PGLFNGLPOINTPARAMETERFEXTPROC, glPointParameterfEXT); \
|
||||
USE_GL_FUNC(PGLFNGLPOINTPARAMETERFVEXTPROC, glPointParameterfvEXT); \
|
||||
/* GL_EXT_secondary_color */ \
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3UBEXTPROC, glSecondaryColor3ubEXT); \
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3FEXTPROC, glSecondaryColor3fEXT); \
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3FVEXTPROC, glSecondaryColor3fvEXT); \
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLORPOINTEREXTPROC, glSecondaryColorPointerEXT); \
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3UBEXTPROC, glSecondaryColor3ubEXT); \
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3FEXTPROC, glSecondaryColor3fEXT); \
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3FVEXTPROC, glSecondaryColor3fvEXT); \
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLORPOINTEREXTPROC, glSecondaryColorPointerEXT); \
|
||||
/* GL_EXT_secondary_color */ \
|
||||
USE_GL_FUNC(PGLFNGENPROGRAMSARBPROC, glGenProgramsARB); \
|
||||
USE_GL_FUNC(PGLFNBINDPROGRAMARBPROC, glBindProgramARB); \
|
||||
|
@ -632,7 +834,7 @@ typedef struct _GL_Info {
|
|||
GL_VSVersion vs_nv_version;
|
||||
GL_VSVersion vs_ati_version;
|
||||
|
||||
BOOL supported[40];
|
||||
BOOL supported[50];
|
||||
|
||||
/** OpenGL EXT and ARB functions ptr */
|
||||
GL_EXT_FUNCS_GEN;
|
||||
|
|
|
@ -2975,6 +2975,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
|
|||
}
|
||||
|
||||
case D3DRS_COLORWRITEENABLE :
|
||||
{
|
||||
TRACE("Color mask: r(%d) g(%d) b(%d) a(%d)\n",
|
||||
Value & D3DCOLORWRITEENABLE_RED ? 1 : 0,
|
||||
Value & D3DCOLORWRITEENABLE_GREEN ? 1 : 0,
|
||||
|
@ -2985,7 +2986,16 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
|
|||
Value & D3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
|
||||
Value & D3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE);
|
||||
checkGLcall("glColorMask(...)");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case D3DRS_LOCALVIEWER :
|
||||
{
|
||||
GLint state = (Value) ? 1 : 0;
|
||||
TRACE("Local Viewer Enable to %ul\n", (BOOL) Value);
|
||||
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, state);
|
||||
}
|
||||
break;
|
||||
|
||||
/* Unhandled yet...! */
|
||||
case D3DRS_LASTPIXEL :
|
||||
|
@ -2999,7 +3009,6 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
|
|||
case D3DRS_WRAP5 :
|
||||
case D3DRS_WRAP6 :
|
||||
case D3DRS_WRAP7 :
|
||||
case D3DRS_LOCALVIEWER :
|
||||
case D3DRS_SOFTWAREVERTEXPROCESSING :
|
||||
case D3DRS_POINTSPRITEENABLE :
|
||||
case D3DRS_MULTISAMPLEANTIALIAS :
|
||||
|
@ -3450,8 +3459,13 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(LPDIRECT3DDEVICE8 ifa
|
|||
checkGLcall("Disable GL_TEXTURE_1D");
|
||||
}
|
||||
if (This->StateBlock->textureDimensions[Stage] == GL_TEXTURE_2D) {
|
||||
if (GL_SUPPORT(NV_TEXTURE_SHADER) && This->texture_shader_active) {
|
||||
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
|
||||
checkGLcall("Enable GL_TEXTURE_2D");
|
||||
} else {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
checkGLcall("Enable GL_TEXTURE_2D");
|
||||
}
|
||||
} else {
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
checkGLcall("Disable GL_TEXTURE_2D");
|
||||
|
@ -3637,74 +3651,73 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(LPDIRECT3DDEVICE8 ifa
|
|||
}
|
||||
break;
|
||||
|
||||
#if defined(GL_ARB_texture_cube_map) || defined(GL_NV_texgen_reflection)
|
||||
case D3DTSS_TCI_CAMERASPACENORMAL:
|
||||
{
|
||||
float s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
|
||||
float t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
|
||||
float r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
|
||||
float q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
|
||||
TRACE("D3DTSS_TCI_CAMERASPACEPOSITION - Set eye plane\n");
|
||||
if (GL_SUPPORT(GL_NV_texgen_reflection)) {
|
||||
float s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
|
||||
float t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
|
||||
float r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
|
||||
float q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
|
||||
TRACE("D3DTSS_TCI_CAMERASPACEPOSITION - Set eye plane\n");
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
||||
glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
||||
glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
||||
glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
||||
glPopMatrix();
|
||||
|
||||
glEnable(GL_TEXTURE_GEN_S);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_S);");
|
||||
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);
|
||||
checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB)");
|
||||
glEnable(GL_TEXTURE_GEN_T);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_T);");
|
||||
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);
|
||||
checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB)");
|
||||
glEnable(GL_TEXTURE_GEN_R);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_R);");
|
||||
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);
|
||||
checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB)");
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
||||
glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
||||
glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
||||
glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
||||
glPopMatrix();
|
||||
|
||||
glEnable(GL_TEXTURE_GEN_S);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_S);");
|
||||
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
||||
checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
|
||||
glEnable(GL_TEXTURE_GEN_T);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_T);");
|
||||
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
||||
checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
|
||||
glEnable(GL_TEXTURE_GEN_R);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_R);");
|
||||
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
||||
checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(GL_ARB_texture_cube_map) || defined(GL_NV_texgen_reflection)
|
||||
case D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR:
|
||||
{
|
||||
|
||||
float s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
|
||||
float t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
|
||||
float r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
|
||||
float q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
|
||||
TRACE("D3DTSS_TCI_CAMERASPACEPOSITION - Set eye plane\n");
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
||||
glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
||||
glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
||||
glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
||||
glPopMatrix();
|
||||
|
||||
glEnable(GL_TEXTURE_GEN_S);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_S);");
|
||||
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
|
||||
checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB)");
|
||||
glEnable(GL_TEXTURE_GEN_T);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_T);");
|
||||
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
|
||||
checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB)");
|
||||
glEnable(GL_TEXTURE_GEN_R);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_R);");
|
||||
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
|
||||
checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB)");
|
||||
if (GL_SUPPORT(GL_NV_texgen_reflection)) {
|
||||
float s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
|
||||
float t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
|
||||
float r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
|
||||
float q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
|
||||
TRACE("D3DTSS_TCI_CAMERASPACEPOSITION - Set eye plane\n");
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
||||
glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
||||
glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
||||
glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
||||
glPopMatrix();
|
||||
|
||||
glEnable(GL_TEXTURE_GEN_S);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_S);");
|
||||
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
||||
checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
|
||||
glEnable(GL_TEXTURE_GEN_T);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_T);");
|
||||
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
||||
checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
|
||||
glEnable(GL_TEXTURE_GEN_R);
|
||||
checkGLcall("glEnable(GL_TEXTURE_GEN_R);");
|
||||
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
||||
checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
/* Unhandled types: */
|
||||
default:
|
||||
|
@ -3720,22 +3733,31 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(LPDIRECT3DDEVICE8 ifa
|
|||
break;
|
||||
|
||||
/* Unhandled */
|
||||
case D3DTSS_BUMPENVMAT00 :
|
||||
case D3DTSS_BUMPENVMAT01 :
|
||||
TRACE("BUMPENVMAT0%u Still a stub, Stage=%ld, Type=%d, Value =%ld\n", Type - D3DTSS_BUMPENVMAT00, Stage, Type, Value);
|
||||
break;
|
||||
case D3DTSS_BUMPENVMAT10 :
|
||||
case D3DTSS_BUMPENVMAT11 :
|
||||
TRACE("BUMPENVMAT1%u Still a stub, Stage=%ld, Type=%d, Value =%ld\n", Type - D3DTSS_BUMPENVMAT10, Stage, Type, Value);
|
||||
break;
|
||||
|
||||
case D3DTSS_TEXTURETRANSFORMFLAGS :
|
||||
set_texture_matrix((float *)&This->StateBlock->transforms[D3DTS_TEXTURE0 + Stage].u.m[0][0], Value);
|
||||
break;
|
||||
|
||||
case D3DTSS_BUMPENVMAT00 :
|
||||
case D3DTSS_BUMPENVMAT01 :
|
||||
TRACE("BUMPENVMAT0%u Stage=%ld, Type=%d, Value =%ld\n", Type - D3DTSS_BUMPENVMAT00, Stage, Type, Value);
|
||||
break;
|
||||
case D3DTSS_BUMPENVMAT10 :
|
||||
case D3DTSS_BUMPENVMAT11 :
|
||||
TRACE("BUMPENVMAT1%u Stage=%ld, Type=%d, Value =%ld\n", Type - D3DTSS_BUMPENVMAT10, Stage, Type, Value);
|
||||
break;
|
||||
|
||||
case D3DTSS_BUMPENVLSCALE :
|
||||
TRACE("BUMPENVLSCALE Stage=%ld, Type=%d, Value =%ld\n", Stage, Type, Value);
|
||||
break;
|
||||
|
||||
case D3DTSS_BUMPENVLOFFSET :
|
||||
TRACE("BUMPENVLOFFSET Stage=%ld, Type=%d, Value =%ld\n", Stage, Type, Value);
|
||||
break;
|
||||
|
||||
case D3DTSS_RESULTARG :
|
||||
TRACE("RESULTARG Still a stub, Stage=%ld, Type=%d, Value =%ld\n", Stage, Type, Value);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Put back later: FIXME("(%p) : stub, Stage=%ld, Type=%d, Value =%ld\n", This, Stage, Type, Value); */
|
||||
TRACE("Still a stub, Stage=%ld, Type=%d, Value =%ld\n", Stage, Type, Value);
|
||||
|
|
|
@ -439,7 +439,7 @@ HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 iface,
|
|||
case D3DFMT_DXT5:
|
||||
case D3DFMT_X8L8V8U8:
|
||||
case D3DFMT_L6V5U5:
|
||||
case D3DFMT_V8U8:
|
||||
/*case D3DFMT_V8U8:*/
|
||||
case D3DFMT_L8:
|
||||
/* Since we do not support these formats right now, don't pretend to. */
|
||||
return D3DERR_NOTAVAILABLE;
|
||||
|
@ -660,10 +660,10 @@ HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D
|
|||
D3DSTENCILCAPS_KEEP |
|
||||
D3DSTENCILCAPS_REPLACE |
|
||||
D3DSTENCILCAPS_ZERO;
|
||||
#if defined(GL_VERSION_1_4) || defined(GL_EXT_stencil_wrap)
|
||||
pCaps->StencilCaps |= D3DSTENCILCAPS_DECR |
|
||||
D3DSTENCILCAPS_INCR;
|
||||
#endif
|
||||
if (GL_SUPPORT(EXT_STENCIL_WRAP)) {
|
||||
pCaps->StencilCaps |= D3DSTENCILCAPS_DECR |
|
||||
D3DSTENCILCAPS_INCR;
|
||||
}
|
||||
|
||||
pCaps->FVFCaps = D3DFVFCAPS_PSIZE | 0x80000;
|
||||
|
||||
|
@ -696,8 +696,8 @@ HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D
|
|||
D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA |
|
||||
D3DTEXOPCAPS_BLENDTEXTUREALPHAPM;
|
||||
}
|
||||
pCaps->TextureOpCaps |= D3DTEXOPCAPS_BUMPENVMAP;
|
||||
/* FIXME: Add
|
||||
D3DTEXOPCAPS_BUMPENVMAP
|
||||
D3DTEXOPCAPS_BUMPENVMAPLUMINANCE
|
||||
D3DTEXOPCAPS_PREMODULATE */
|
||||
|
||||
|
@ -745,9 +745,9 @@ HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D
|
|||
pCaps->VertexProcessingCaps = D3DVTXPCAPS_DIRECTIONALLIGHTS |
|
||||
D3DVTXPCAPS_MATERIALSOURCE7 |
|
||||
D3DVTXPCAPS_POSITIONALLIGHTS |
|
||||
D3DVTXPCAPS_LOCALVIEWER |
|
||||
D3DVTXPCAPS_TEXGEN;
|
||||
/* FIXME: Add
|
||||
D3DVTXPCAPS_LOCALVIEWER
|
||||
D3DVTXPCAPS_TWEENING */
|
||||
|
||||
pCaps->MaxPrimitiveCount = 0xFFFFFFFF;
|
||||
|
@ -932,6 +932,8 @@ static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) {
|
|||
} else if (strcmp(ThisExtn, "GL_ARB_texture_cube_map") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: ARB Texture Cube Map support\n");
|
||||
This->gl_info.supported[ARB_TEXTURE_CUBE_MAP] = TRUE;
|
||||
TRACE_(d3d_caps)(" IMPLIED: NVIDIA (NV) Texture Gen Reflection support\n");
|
||||
This->gl_info.supported[NV_TEXGEN_REFLECTION] = TRUE;
|
||||
} else if (strcmp(ThisExtn, "GL_ARB_texture_compression") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: ARB Texture Compression support\n");
|
||||
This->gl_info.supported[ARB_TEXTURE_COMPRESSION] = TRUE;
|
||||
|
@ -970,6 +972,9 @@ static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) {
|
|||
} else if (strcmp(ThisExtn, "GL_EXT_secondary_color") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: EXT Secondary coord support\n");
|
||||
This->gl_info.supported[EXT_SECONDARY_COLOR] = TRUE;
|
||||
} else if (strcmp(ThisExtn, "GL_EXT_stencil_wrap") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: EXT Stencil wrap support\n");
|
||||
This->gl_info.supported[EXT_STENCIL_WRAP] = TRUE;
|
||||
} else if (strcmp(ThisExtn, "GL_EXT_texture_compression_s3tc") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: EXT Texture S3TC compression support\n");
|
||||
This->gl_info.supported[EXT_TEXTURE_COMPRESSION_S3TC] = TRUE;
|
||||
|
@ -998,15 +1003,33 @@ static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) {
|
|||
/**
|
||||
* NVIDIA
|
||||
*/
|
||||
} else if (strcmp(ThisExtn, "GL_NV_texture_env_combine4") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Env combine (4) support\n");
|
||||
This->gl_info.supported[NV_TEXTURE_ENV_COMBINE4] = TRUE;
|
||||
} else if (strstr(ThisExtn, "GL_NV_fragment_program")) {
|
||||
This->gl_info.ps_nv_version = PS_VERSION_11;
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Pixel Shader support - version=%02x\n", This->gl_info.ps_nv_version);
|
||||
} else if (strstr(ThisExtn, "GL_NV_fog_distance")) {
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Fog Distance support\n");
|
||||
This->gl_info.supported[NV_FOG_DISTANCE] = TRUE;
|
||||
} else if (strstr(ThisExtn, "GL_NV_fragment_program")) {
|
||||
This->gl_info.ps_nv_version = PS_VERSION_11;
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Pixel Shader support - version=%02x\n", This->gl_info.ps_nv_version);
|
||||
} else if (strcmp(ThisExtn, "GL_NV_register_combiners") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Register combiners (1) support\n");
|
||||
This->gl_info.supported[NV_REGISTER_COMBINERS] = TRUE;
|
||||
} else if (strcmp(ThisExtn, "GL_NV_register_combiners2") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Register combiners (2) support\n");
|
||||
This->gl_info.supported[NV_REGISTER_COMBINERS2] = TRUE;
|
||||
} else if (strcmp(ThisExtn, "GL_NV_texgen_reflection") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Gen Reflection support\n");
|
||||
This->gl_info.supported[NV_TEXGEN_REFLECTION] = TRUE;
|
||||
} else if (strcmp(ThisExtn, "GL_NV_texture_env_combine4") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Env combine (4) support\n");
|
||||
This->gl_info.supported[NV_TEXTURE_ENV_COMBINE4] = TRUE;
|
||||
} else if (strcmp(ThisExtn, "GL_NV_texture_shader") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (1) support\n");
|
||||
This->gl_info.supported[NV_TEXTURE_SHADER] = TRUE;
|
||||
} else if (strcmp(ThisExtn, "GL_NV_texture_shader2") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (2) support\n");
|
||||
This->gl_info.supported[NV_TEXTURE_SHADER2] = TRUE;
|
||||
} else if (strcmp(ThisExtn, "GL_NV_texture_shader3") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (3) support\n");
|
||||
This->gl_info.supported[NV_TEXTURE_SHADER3] = TRUE;
|
||||
} else if (strstr(ThisExtn, "GL_NV_vertex_program")) {
|
||||
This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program1_1")) ? VS_VERSION_11 : VS_VERSION_10);
|
||||
This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program2")) ? VS_VERSION_20 : VS_VERSION_10);
|
||||
|
|
|
@ -533,12 +533,12 @@ void draw_vertex(LPDIRECT3DDEVICE8 iface, /* interf
|
|||
|
||||
/* Specular Colour ------------------------------------------*/
|
||||
if (isSpecular == TRUE) {
|
||||
#if defined(GL_EXT_secondary_color)
|
||||
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
||||
GL_EXTCALL(glSecondaryColor3fvEXT(sRGB));
|
||||
VTRACE(("glSecondaryColor4f: r,g,b=%f,%f,%f\n", sRGB[0], sRGB[1], sRGB[2]));
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
VTRACE(("Specular color extensions not supplied\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/* Normal -------------------------------- */
|
||||
|
@ -794,44 +794,29 @@ void drawStridedFast(LPDIRECT3DDEVICE8 iface, Direct3DVertexStridedData *sd,
|
|||
sd->u.s.specular.dwStride,
|
||||
sd->u.s.specular.lpData));
|
||||
|
||||
#if defined(GL_VERSION_1_4)
|
||||
glSecondaryColorPointer(4, GL_UNSIGNED_BYTE,
|
||||
sd->u.s.specular.dwStride,
|
||||
sd->u.s.specular.lpData);
|
||||
vcheckGLcall("glSecondaryColorPointer(4, GL_UNSIGNED_BYTE, ...)");
|
||||
glEnableClientState(GL_SECONDARY_COLOR_ARRAY);
|
||||
vcheckGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY)");
|
||||
#elif defined(GL_EXT_secondary_color)
|
||||
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
||||
GL_EXTCALL(glSecondaryColorPointerEXT)(4, GL_UNSIGNED_BYTE,
|
||||
sd->u.s.specular.dwStride,
|
||||
sd->u.s.specular.lpData);
|
||||
checkGLcall("glSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, ...)");
|
||||
vcheckGLcall("glSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, ...)");
|
||||
glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
|
||||
checkGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
|
||||
}
|
||||
#else
|
||||
/* Missing specular color is not critical, no warnings */
|
||||
VTRACE(("Specular colour is not supported in this GL implementation\n"));
|
||||
#endif
|
||||
vcheckGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
|
||||
} else {
|
||||
/* Missing specular color is not critical, no warnings */
|
||||
VTRACE(("Specular colour is not supported in this GL implementation\n"));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
#if defined(GL_VERSION_1_4)
|
||||
glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
|
||||
checkGLcall("glDisableClientState(GL_SECONDARY_COLOR_ARRAY)");
|
||||
glSecondaryColor3f(0, 0, 0);
|
||||
checkGLcall("glSecondaryColor3f(0, 0, 0)");
|
||||
#elif defined(GL_EXT_secondary_color)
|
||||
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
||||
glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
|
||||
checkGLcall("glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
|
||||
GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
|
||||
checkGLcall("glSecondaryColor3fEXT(0, 0, 0)");
|
||||
}
|
||||
#else
|
||||
/* Do not worry if specular colour missing and disable request */
|
||||
#endif
|
||||
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
||||
glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
|
||||
checkGLcall("glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
|
||||
GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
|
||||
checkGLcall("glSecondaryColor3fEXT(0, 0, 0)");
|
||||
} else {
|
||||
/* Missing specular color is not critical, no warnings */
|
||||
VTRACE(("Specular colour is not supported in this GL implementation\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/* Texture coords -------------------------------------------*/
|
||||
|
@ -1187,40 +1172,31 @@ void drawStridedSlow(LPDIRECT3DDEVICE8 iface, Direct3DVertexStridedData *sd,
|
|||
if (vx_index == 0) glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* Specular ------------------------------- */
|
||||
if (sd->u.s.diffuse.lpData != NULL) {
|
||||
VTRACE(("glSecondaryColor4ub: r,g,b=%f,%f,%f\n",
|
||||
((specularColor >> 16) & 0xFF) / 255.0f,
|
||||
((specularColor >> 8) & 0xFF) / 255.0f,
|
||||
((specularColor >> 0) & 0xFF) / 255.0f));
|
||||
#if defined(GL_VERSION_1_4)
|
||||
glSecondaryColor3ub((specularColor >> 16) & 0xFF,
|
||||
(specularColor >> 8) & 0xFF,
|
||||
(specularColor >> 0) & 0xFF);
|
||||
#elif defined(GL_EXT_secondary_color)
|
||||
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
||||
GL_EXTCALL(glSecondaryColor3ubEXT)(
|
||||
(specularColor >> 16) & 0xFF,
|
||||
(specularColor >> 8) & 0xFF,
|
||||
(specularColor >> 0) & 0xFF);
|
||||
}
|
||||
#else
|
||||
/* Do not worry if specular colour missing and disable request */
|
||||
VTRACE(("Specular color extensions not supplied\n"));
|
||||
#endif
|
||||
} else {
|
||||
/* Do not worry if specular colour missing and disable request */
|
||||
VTRACE(("Specular color extensions not supplied\n"));
|
||||
}
|
||||
} else {
|
||||
#if defined(GL_VERSION_1_4)
|
||||
if (vx_index == 0) glSecondaryColor3f(0, 0, 0);
|
||||
#elif defined(GL_EXT_secondary_color)
|
||||
if (vx_index == 0 && GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
||||
if (vx_index == 0) {
|
||||
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
||||
GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
|
||||
}
|
||||
#else
|
||||
/* Do not worry if specular colour missing and disable request */
|
||||
#endif
|
||||
} else {
|
||||
/* Do not worry if specular colour missing and disable request */
|
||||
VTRACE(("Specular color extensions not supplied\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Normal -------------------------------- */
|
||||
if (sd->u.s.normal.lpData != NULL) {
|
||||
|
|
|
@ -574,14 +574,14 @@ HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, GLenu
|
|||
|
||||
ENTER_GL();
|
||||
|
||||
glCompressedTexImage2D(gl_target,
|
||||
gl_level,
|
||||
D3DFmt2GLIntFmt(This->Device, This->myDesc.Format),
|
||||
This->myDesc.Width,
|
||||
This->myDesc.Height,
|
||||
0,
|
||||
This->myDesc.Size,
|
||||
This->allocatedMemory);
|
||||
GL_EXTCALL_DEV(glCompressedTexImage2DARB, This->Device)(gl_target,
|
||||
gl_level,
|
||||
D3DFmt2GLIntFmt(This->Device, This->myDesc.Format),
|
||||
This->myDesc.Width,
|
||||
This->myDesc.Height,
|
||||
0,
|
||||
This->myDesc.Size,
|
||||
This->allocatedMemory);
|
||||
checkGLcall("glCommpressedTexTexImage2D");
|
||||
|
||||
LEAVE_GL();
|
||||
|
|
|
@ -378,6 +378,7 @@ SHORT D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
|||
/* color buffer */
|
||||
case D3DFMT_P8: retVal = 1; break;
|
||||
case D3DFMT_R3G3B2: retVal = 1; break;
|
||||
case D3DFMT_V8U8: retVal = 2; break;
|
||||
case D3DFMT_R5G6B5: retVal = 2; break;
|
||||
case D3DFMT_X1R5G5B5: retVal = 2; break;
|
||||
case D3DFMT_A4R4G4B4: retVal = 2; break;
|
||||
|
@ -432,6 +433,7 @@ GLint D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
|||
switch (fmt) {
|
||||
case D3DFMT_P8: retVal = GL_COLOR_INDEX8_EXT; break;
|
||||
case D3DFMT_A8P8: retVal = GL_COLOR_INDEX8_EXT; break;
|
||||
case D3DFMT_V8U8: retVal = GL_COLOR_INDEX8_EXT; break;
|
||||
|
||||
case D3DFMT_A4R4G4B4: retVal = GL_RGBA4; break;
|
||||
case D3DFMT_A8R8G8B8: retVal = GL_RGBA8; break;
|
||||
|
@ -466,6 +468,7 @@ GLenum D3DFmt2GLFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
|||
switch (fmt) {
|
||||
case D3DFMT_P8: retVal = GL_COLOR_INDEX; break;
|
||||
case D3DFMT_A8P8: retVal = GL_COLOR_INDEX; break;
|
||||
case D3DFMT_V8U8: retVal = GL_COLOR_INDEX; break;
|
||||
|
||||
case D3DFMT_A4R4G4B4: retVal = GL_BGRA; break;
|
||||
case D3DFMT_A8R8G8B8: retVal = GL_BGRA; break;
|
||||
|
@ -500,7 +503,8 @@ GLenum D3DFmt2GLType(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
|||
if (retVal == 0) {
|
||||
switch (fmt) {
|
||||
case D3DFMT_P8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
case D3DFMT_A8P8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
case D3DFMT_A8P8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
case D3DFMT_V8U8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
|
||||
case D3DFMT_A4R4G4B4: retVal = GL_UNSIGNED_SHORT_4_4_4_4_REV; break;
|
||||
case D3DFMT_A8R8G8B8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
|
@ -582,18 +586,8 @@ GLenum StencilOp(DWORD op) {
|
|||
case D3DSTENCILOP_INCRSAT : return GL_INCR;
|
||||
case D3DSTENCILOP_DECRSAT : return GL_DECR;
|
||||
case D3DSTENCILOP_INVERT : return GL_INVERT;
|
||||
#if defined(GL_VERSION_1_4)
|
||||
case D3DSTENCILOP_INCR : return GL_INCR_WRAP;
|
||||
case D3DSTENCILOP_DECR : return GL_DECR_WRAP;
|
||||
#elif defined(GL_EXT_stencil_wrap)
|
||||
case D3DSTENCILOP_INCR : return GL_INCR_WRAP_EXT;
|
||||
case D3DSTENCILOP_DECR : return GL_DECR_WRAP_EXT;
|
||||
#else
|
||||
case D3DSTENCILOP_INCR : FIXME("Unsupported stencil op D3DSTENCILOP_INCR\n");
|
||||
return GL_INCR; /* Fixme - needs to support wrap */
|
||||
case D3DSTENCILOP_DECR : FIXME("Unsupported stencil op D3DSTENCILOP_DECR\n");
|
||||
return GL_DECR; /* Fixme - needs to support wrap */
|
||||
#endif
|
||||
default:
|
||||
FIXME("Invalid stencil op %ld\n", op);
|
||||
return GL_ALWAYS;
|
||||
|
@ -1275,6 +1269,49 @@ void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP o
|
|||
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
||||
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
||||
break;
|
||||
|
||||
case D3DTOP_BUMPENVMAP:
|
||||
{
|
||||
if (GL_SUPPORT(NV_TEXTURE_SHADER)) {
|
||||
/*
|
||||
texture unit 0: GL_TEXTURE_2D
|
||||
texture unit 1: GL_DOT_PRODUCT_NV
|
||||
texture unit 2: GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV
|
||||
texture unit 3: GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV
|
||||
*/
|
||||
float m[2][2];
|
||||
|
||||
union {
|
||||
float f;
|
||||
DWORD d;
|
||||
} tmpvalue;
|
||||
|
||||
tmpvalue.d = This->StateBlock->texture_state[Stage][D3DTSS_BUMPENVMAT00];
|
||||
m[0][0] = tmpvalue.f;
|
||||
tmpvalue.d = This->StateBlock->texture_state[Stage][D3DTSS_BUMPENVMAT01];
|
||||
m[0][1] = tmpvalue.f;
|
||||
tmpvalue.d = This->StateBlock->texture_state[Stage][D3DTSS_BUMPENVMAT10];
|
||||
m[1][0] = tmpvalue.f;
|
||||
tmpvalue.d = This->StateBlock->texture_state[Stage][D3DTSS_BUMPENVMAT11];
|
||||
m[1][1] = tmpvalue.f;
|
||||
|
||||
if (FALSE == This->texture_shader_active) {
|
||||
This->texture_shader_active = TRUE;
|
||||
glEnable(GL_TEXTURE_SHADER_NV);
|
||||
}
|
||||
/*
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + Stage - 1);
|
||||
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
|
||||
*/
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB + Stage);
|
||||
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_OFFSET_TEXTURE_2D_NV);
|
||||
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB + Stage - 1);
|
||||
glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, (float*)&m[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case D3DTOP_BUMPENVMAPLUMINANCE:
|
||||
|
||||
default:
|
||||
Handled = FALSE;
|
||||
|
|
Loading…
Reference in New Issue