mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
formally remove pandadx7 support
This commit is contained in:
parent
14374eef99
commit
c9b27bd436
@ -1,23 +0,0 @@
|
||||
#define BUILD_DIRECTORY $[HAVE_DX]
|
||||
|
||||
// DIR_TYPE "metalib" indicates we are building a shared library that
|
||||
// consists mostly of references to other shared libraries. Under
|
||||
// Windows, this directly produces a DLL (as opposed to the regular
|
||||
// src libraries, which don't produce anything but a pile of OBJ files
|
||||
// under Windows).
|
||||
|
||||
#define DIR_TYPE metalib
|
||||
#define BUILDING_DLL BUILDING_PANDADX
|
||||
|
||||
#define COMPONENT_LIBS \
|
||||
dxgsg7
|
||||
#define LOCAL_LIBS gsgbase display express
|
||||
#define OTHER_LIBS dtoolconfig dtool
|
||||
|
||||
#begin metalib_target
|
||||
#define TARGET pandadx7
|
||||
#define SOURCES pandadx7.cxx
|
||||
#define WIN_SYS_LIBS \
|
||||
ddraw.lib dxguid.lib winmm.lib \
|
||||
kernel32.lib gdi32.lib user32.lib $[WIN_SYS_LIBS]
|
||||
#end metalib_target
|
@ -1,27 +0,0 @@
|
||||
// Filename: pandadx7.cxx
|
||||
// Created by: drose (15May00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pandadx7.h"
|
||||
|
||||
#include "config_dxgsg7.h"
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime
|
||||
// attempts to load libpandadx7.dll will fail if they
|
||||
// inadvertently link with the wrong version of libdtool.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: init_libpandadx7
|
||||
// Description: Initializes the library. This must be called at
|
||||
// least once before any of the functions or classes in
|
||||
// this library can be used. Normally it will be
|
||||
// called by the static initializers and need not be
|
||||
// called explicitly, but special cases exist.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
init_libpandadx7() {
|
||||
init_libdxgsg7();
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Filename: pandadx7.h
|
||||
// Created by: drose (2Jan01)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PANDADX7_H
|
||||
#define PANDADX7_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
EXPCL_PANDADX void init_libpandadx7();
|
||||
|
||||
#endif
|
@ -1,36 +0,0 @@
|
||||
#define BUILD_DIRECTORY $[HAVE_DX]
|
||||
|
||||
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
|
||||
dtoolutil:c dtoolbase:c dtool:m
|
||||
#define USE_PACKAGES dx
|
||||
|
||||
// We link with the DX8 libraries, because they're a superset of DX7
|
||||
// anyway, and it means we don't need to have the DX7 SDK available.
|
||||
#define WIN_SYS_LIBS \
|
||||
d3d8.lib d3dx8.lib dxerr8.lib
|
||||
|
||||
#begin lib_target
|
||||
|
||||
#define TARGET dxgsg7
|
||||
#define LOCAL_LIBS \
|
||||
gsgmisc gsgbase gobj display windisplay \
|
||||
putil linmath mathutil pnmimage event
|
||||
|
||||
#define COMBINED_SOURCES $[TARGET]_composite1.cxx
|
||||
|
||||
#define SOURCES \
|
||||
dxGraphicsStateGuardian7.cxx \
|
||||
dxGeomMunger7.I dxGeomMunger7.h \
|
||||
dxTextureContext7.I dxTextureContext7.h \
|
||||
wdxGraphicsPipe7.I wdxGraphicsPipe7.h \
|
||||
wdxGraphicsWindow7.I wdxGraphicsWindow7.h
|
||||
$[INSTALL_HEADERS]
|
||||
|
||||
#define INCLUDED_SOURCES \
|
||||
config_dxgsg7.cxx \
|
||||
dxgsg7base.cxx \
|
||||
dxGeomMunger7.cxx \
|
||||
dxTextureContext7.cxx \
|
||||
wdxGraphicsPipe7.cxx wdxGraphicsWindow7.cxx
|
||||
|
||||
#end lib_target
|
@ -1,139 +0,0 @@
|
||||
// Filename: config_dxgsg.cxx
|
||||
// Created by: drose (06Oct99)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "config_dxgsg7.h"
|
||||
#include "dxGraphicsStateGuardian7.h"
|
||||
#include "dxTextureContext7.h"
|
||||
#include "dxGeomMunger7.h"
|
||||
#include "wdxGraphicsPipe7.h"
|
||||
#include "wdxGraphicsWindow7.h"
|
||||
#include "graphicsPipeSelection.h"
|
||||
#include "pandaSystem.h"
|
||||
|
||||
#include "dconfig.h"
|
||||
|
||||
Configure(config_dxgsg7);
|
||||
NotifyCategoryDef(dxgsg7, ":display:gsg");
|
||||
NotifyCategoryDef(wdxdisplay7, "display");
|
||||
|
||||
// Configure this to TRUE if you want DirectX to control the entire screen,
|
||||
// If false, it will just blit into a window.
|
||||
ConfigVariableBool dx_full_screen
|
||||
("dx-full-screen", false);
|
||||
|
||||
// enable this to turn on full-screen anti-aliasing, if the HW supports it
|
||||
// this var is also used in wdxGraphicsWindows.cxx
|
||||
ConfigVariableBool dx_full_screen_antialiasing
|
||||
("dx-antialias", false);
|
||||
|
||||
// if true, if card only supports per-vertex fog, it will be treated as no-HW fog capability
|
||||
ConfigVariableBool dx_no_vertex_fog
|
||||
("dx-no-vertex-fog", false);
|
||||
|
||||
#ifndef NDEBUG
|
||||
// debugging flag
|
||||
// values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW
|
||||
ConfigVariableInt dx_force_backface_culling
|
||||
("dx-force-backface-culling", 0);
|
||||
#endif
|
||||
|
||||
ConfigVariableBool dx_mipmap_everything
|
||||
("dx-mipmap-everything", false);
|
||||
ConfigVariableBool dx_ignore_mipmaps
|
||||
("dx-ignore-mipmaps", false);
|
||||
|
||||
// if this is set, more accurate but more expensive fog computations are performed
|
||||
ConfigVariableBool dx_use_rangebased_fog
|
||||
("dx-use-rangebased-fog", false);
|
||||
ConfigVariableBool dx_force_16bpptextures
|
||||
("dx-force-16bpptextures", false);
|
||||
ConfigVariableBool dx_no_dithering
|
||||
("dx-no-dithering", false);
|
||||
ConfigVariableBool dx_force_16bpp_zbuffer
|
||||
("dx-force-16bpp-zbuffer", false);
|
||||
ConfigVariableBool dx_do_vidmemsize_check
|
||||
("do-vidmemsize-check", true);
|
||||
// Setting this true theoretically hinders render performance, because
|
||||
// it forces the FPU to go through some extra work to clean itself up
|
||||
// after rendering a frame, but the performance cost seems to be
|
||||
// small. On the other hand, setting it false can force the
|
||||
// application to run in single-precision arithmetic mode, even if
|
||||
// it believes it is using double-precision variables.
|
||||
ConfigVariableBool dx_preserve_fpu_state
|
||||
("dx-preserve-fpu-state", true);
|
||||
|
||||
ConfigVariableBool dx_broken_max_index
|
||||
("dx-broken-max-index", false,
|
||||
PRC_DESC("Configure this true if you have a buggy graphics driver that "
|
||||
"doesn't correctly implement the third parameter, NumVertices, "
|
||||
"of DrawIndexedPrimitive(). In particular, the NVIDIA Quadro "
|
||||
"driver version 6.14.10.7184 seems to treat this as a maximum "
|
||||
"vertex index, rather than a delta between the maximum and "
|
||||
"minimum vertex index. Turn this on if you are seeing stray "
|
||||
"triangles, or you are not seeing all of your triangles. Enabling "
|
||||
"this should work around this bug, at the cost of some additional "
|
||||
"rendering overhead on the GPU."));
|
||||
|
||||
#ifdef _DEBUG
|
||||
ConfigVariableDouble dx_global_miplevel_bias
|
||||
("dx-global-miplevel-bias", 0.0);
|
||||
ConfigVariableBool dx_debug_view_mipmaps
|
||||
("dx-debug-view-mipmaps", false);
|
||||
ConfigVariableBool dx_force_anisotropic_filtering
|
||||
("dx-force-anisotropic-filtering", false);
|
||||
#endif
|
||||
|
||||
// set 'retained-mode #t' and this to have prepare_geom concatenate all tristrips within a geom
|
||||
// together using degenerate tris
|
||||
ConfigVariableBool link_tristrips
|
||||
("link-tristrips", false);
|
||||
|
||||
ConfigureFn(config_dxgsg7) {
|
||||
init_libdxgsg7();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: init_libdxgsg7
|
||||
// Description: Initializes the library. This must be called at
|
||||
// least once before any of the functions or classes in
|
||||
// this library can be used. Normally it will be
|
||||
// called by the static initializers and need not be
|
||||
// called explicitly, but special cases exist.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
init_libdxgsg7() {
|
||||
static bool initialized = false;
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
initialized = true;
|
||||
|
||||
DXGraphicsStateGuardian7::init_type();
|
||||
DXTextureContext7::init_type();
|
||||
DXGeomMunger7::init_type();
|
||||
|
||||
wdxGraphicsPipe7::init_type();
|
||||
wdxGraphicsWindow7::init_type();
|
||||
|
||||
GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr();
|
||||
selection->add_pipe_type(wdxGraphicsPipe7::get_class_type(),
|
||||
wdxGraphicsPipe7::pipe_constructor);
|
||||
|
||||
PandaSystem *ps = PandaSystem::get_global_ptr();
|
||||
ps->add_system("DirectX7");
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
// Filename: config_dxgsg7.h
|
||||
// Created by: drose (06Oct99)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CONFIG_DXGSG7_H
|
||||
#define CONFIG_DXGSG7_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "notifyCategoryProxy.h"
|
||||
#include "configVariableBool.h"
|
||||
#include "configVariableInt.h"
|
||||
#include "configVariableDouble.h"
|
||||
|
||||
NotifyCategoryDecl(dxgsg7, EXPCL_PANDADX, EXPTP_PANDADX);
|
||||
NotifyCategoryDecl(wdxdisplay7, EXPCL_PANDADX, EXPTP_PANDADX);
|
||||
|
||||
extern ConfigVariableBool dx_full_screen;
|
||||
extern ConfigVariableBool dx_no_vertex_fog;
|
||||
extern ConfigVariableBool dx_full_screen_antialiasing;
|
||||
extern ConfigVariableBool dx_use_rangebased_fog;
|
||||
extern ConfigVariableBool link_tristrips;
|
||||
|
||||
// debug flags we might want to use in full optimized build
|
||||
extern ConfigVariableBool dx_ignore_mipmaps;
|
||||
extern ConfigVariableBool dx_mipmap_everything;
|
||||
extern ConfigVariableBool dx_force_16bpptextures;
|
||||
extern ConfigVariableBool dx_no_dithering;
|
||||
extern ConfigVariableBool dx_force_16bpp_zbuffer;
|
||||
extern ConfigVariableBool dx_do_vidmemsize_check;
|
||||
extern ConfigVariableBool dx_preserve_fpu_state;
|
||||
|
||||
#ifndef NDEBUG
|
||||
extern ConfigVariableInt dx_force_backface_culling;
|
||||
#endif
|
||||
|
||||
extern ConfigVariableBool dx_broken_max_index;
|
||||
|
||||
#ifdef _DEBUG
|
||||
extern ConfigVariableDouble dx_global_miplevel_bias;
|
||||
extern ConfigVariableBool dx_debug_view_mipmaps;
|
||||
extern ConfigVariableBool dx_force_anisotropic_filtering;
|
||||
#endif
|
||||
|
||||
extern EXPCL_PANDADX void init_libdxgsg7();
|
||||
|
||||
#endif
|
@ -1,46 +0,0 @@
|
||||
// Filename: dxGeomMunger7.I
|
||||
// Created by: drose (11Mar05)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DXGeomMunger7::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE DXGeomMunger7::
|
||||
DXGeomMunger7(GraphicsStateGuardian *gsg, const RenderState *state) :
|
||||
StandardMunger(gsg, state, 1, NT_packed_dabc, C_color),
|
||||
_texture(state->get_texture()),
|
||||
_tex_gen(state->get_tex_gen())
|
||||
{
|
||||
if (_texture != (TextureAttrib *)NULL) {
|
||||
_texture = _texture->filter_to_max(gsg->get_max_texture_stages());
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DXGeomMunger7::operator new
|
||||
// Access: Public
|
||||
// Description: Calls up to do_operator_new() to implement the
|
||||
// low-overhead allocation/deallocation for this type of
|
||||
// GeomMunger.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void *DXGeomMunger7::
|
||||
operator new(size_t size) {
|
||||
return do_operator_new(size, &_deleted_chain);
|
||||
}
|
@ -1,156 +0,0 @@
|
||||
// Filename: dxGeomMunger7.cxx
|
||||
// Created by: drose (11Mar05)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dxGeomMunger7.h"
|
||||
#include "geomVertexReader.h"
|
||||
#include "geomVertexWriter.h"
|
||||
#include "config_dxgsg7.h"
|
||||
|
||||
GeomMunger *DXGeomMunger7::_deleted_chain = NULL;
|
||||
TypeHandle DXGeomMunger7::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DXGeomMunger7::munge_format_impl
|
||||
// Access: Protected, Virtual
|
||||
// Description: Given a source GeomVertexFormat, converts it if
|
||||
// necessary to the appropriate format for rendering.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
CPT(GeomVertexFormat) DXGeomMunger7::
|
||||
munge_format_impl(const GeomVertexFormat *orig,
|
||||
const GeomVertexAnimationSpec &animation) {
|
||||
nassertr(animation.get_animation_type() != AT_hardware, NULL);
|
||||
|
||||
// We have to build a completely new format that includes only the
|
||||
// appropriate components, in the appropriate order, in just one
|
||||
// array.
|
||||
PT(GeomVertexFormat) new_format = new GeomVertexFormat(*orig);
|
||||
PT(GeomVertexArrayFormat) new_array_format = new GeomVertexArrayFormat;
|
||||
|
||||
const GeomVertexColumn *vertex_type = orig->get_vertex_column();
|
||||
const GeomVertexColumn *normal_type = orig->get_normal_column();
|
||||
const GeomVertexColumn *color_type = orig->get_color_column();
|
||||
|
||||
if (vertex_type != (const GeomVertexColumn *)NULL) {
|
||||
new_array_format->add_column
|
||||
(InternalName::get_vertex(), 3, NT_float32,
|
||||
vertex_type->get_contents());
|
||||
new_format->remove_column(vertex_type->get_name());
|
||||
|
||||
} else {
|
||||
// If we don't have a vertex type, not much we can do.
|
||||
return orig;
|
||||
}
|
||||
|
||||
if (normal_type != (const GeomVertexColumn *)NULL) {
|
||||
new_array_format->add_column
|
||||
(InternalName::get_normal(), 3, NT_float32, C_vector);
|
||||
new_format->remove_column(normal_type->get_name());
|
||||
}
|
||||
|
||||
if (color_type != (const GeomVertexColumn *)NULL) {
|
||||
new_array_format->add_column
|
||||
(InternalName::get_color(), 1, NT_packed_dabc, C_color);
|
||||
new_format->remove_column(color_type->get_name());
|
||||
}
|
||||
|
||||
// To support multitexture, we will need to add all of the relevant
|
||||
// texcoord types, and in the correct order.
|
||||
|
||||
// Now set up each of the active texture coordinate stages--or at
|
||||
// least those for which we're not generating texture coordinates
|
||||
// automatically.
|
||||
|
||||
// Now copy all of the texture coordinates in, in order by stage
|
||||
// index. But we have to reuse previous columns.
|
||||
if (_texture != (TextureAttrib *)NULL) {
|
||||
typedef pset<const InternalName *> UsedStages;
|
||||
UsedStages used_stages;
|
||||
|
||||
int num_stages = _texture->get_num_on_stages();
|
||||
for (int i = 0; i < num_stages; ++i) {
|
||||
TextureStage *stage = _texture->get_on_stage(i);
|
||||
|
||||
const InternalName *name = stage->get_texcoord_name();
|
||||
if (used_stages.insert(name).second) {
|
||||
// This is the first time we've encountered this texcoord name.
|
||||
const GeomVertexColumn *texcoord_type = orig->get_column(name);
|
||||
|
||||
if (texcoord_type != (const GeomVertexColumn *)NULL) {
|
||||
new_array_format->add_column
|
||||
(name, texcoord_type->get_num_values(), NT_float32, C_texcoord);
|
||||
} else {
|
||||
// We have to add something as a placeholder, even if the
|
||||
// texture coordinates aren't defined.
|
||||
new_array_format->add_column(name, 2, NT_float32, C_texcoord);
|
||||
}
|
||||
new_format->remove_column(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the FVF-style array we just built up is first in the
|
||||
// list.
|
||||
new_format->insert_array(0, new_array_format);
|
||||
|
||||
return GeomVertexFormat::register_format(new_format);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DXGeomMunger7::compare_to_impl
|
||||
// Access: Protected, Virtual
|
||||
// Description: Called to compare two GeomMungers who are known to be
|
||||
// of the same type, for an apples-to-apples comparison.
|
||||
// This will never be called on two pointers of a
|
||||
// different type.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DXGeomMunger7::
|
||||
compare_to_impl(const GeomMunger *other) const {
|
||||
const DXGeomMunger7 *om = DCAST(DXGeomMunger7, other);
|
||||
if (_texture != om->_texture) {
|
||||
return _texture < om->_texture ? -1 : 1;
|
||||
}
|
||||
if (_tex_gen != om->_tex_gen) {
|
||||
return _tex_gen < om->_tex_gen ? -1 : 1;
|
||||
}
|
||||
|
||||
return StandardMunger::compare_to_impl(other);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DXGeomMunger7::geom_compare_to_impl
|
||||
// Access: Protected, Virtual
|
||||
// Description: Called to compare two GeomMungers who are known to be
|
||||
// of the same type, for an apples-to-apples comparison.
|
||||
// This will never be called on two pointers of a
|
||||
// different type.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DXGeomMunger7::
|
||||
geom_compare_to_impl(const GeomMunger *other) const {
|
||||
// Unlike GLGeomMunger, we do consider _texture and _tex_gen
|
||||
// important for this purpose, since they control the number and
|
||||
// order of texture coordinates we might put into the FVF.
|
||||
const DXGeomMunger7 *om = DCAST(DXGeomMunger7, other);
|
||||
if (_texture != om->_texture) {
|
||||
return _texture < om->_texture ? -1 : 1;
|
||||
}
|
||||
if (_tex_gen != om->_tex_gen) {
|
||||
return _tex_gen < om->_tex_gen ? -1 : 1;
|
||||
}
|
||||
|
||||
return StandardMunger::geom_compare_to_impl(other);
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
// Filename: dxGeomMunger7.h
|
||||
// Created by: drose (11Mar05)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DXGEOMMUNGER7_H
|
||||
#define DXGEOMMUNGER7_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "standardMunger.h"
|
||||
#include "graphicsStateGuardian.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DXGeomMunger7
|
||||
// Description : This specialization on GeomMunger finesses vertices
|
||||
// for DirectX rendering. In particular, it makes sure
|
||||
// colors are stored in DirectX's packed_argb format,
|
||||
// and that all relevant components are packed into a
|
||||
// single array, in the correct order.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDADX DXGeomMunger7 : public StandardMunger {
|
||||
public:
|
||||
INLINE DXGeomMunger7(GraphicsStateGuardian *gsg, const RenderState *state);
|
||||
|
||||
protected:
|
||||
virtual CPT(GeomVertexFormat) munge_format_impl(const GeomVertexFormat *orig,
|
||||
const GeomVertexAnimationSpec &animation);
|
||||
|
||||
virtual int compare_to_impl(const GeomMunger *other) const;
|
||||
virtual int geom_compare_to_impl(const GeomMunger *other) const;
|
||||
|
||||
public:
|
||||
INLINE void *operator new(size_t size);
|
||||
|
||||
private:
|
||||
CPT(TextureAttrib) _texture;
|
||||
CPT(TexGenAttrib) _tex_gen;
|
||||
|
||||
static GeomMunger *_deleted_chain;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
StandardMunger::init_type();
|
||||
register_type(_type_handle, "DXGeomMunger7",
|
||||
StandardMunger::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "dxGeomMunger7.I"
|
||||
|
||||
#endif
|
@ -1,130 +0,0 @@
|
||||
// Filename: dxGraphicsStateGuardian7.I
|
||||
// Created by: mike (02Feb99)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DXGraphicsStateGuardian7::Colorf_to_D3DCOLOR
|
||||
// Access: Public, Static
|
||||
// Description: Converts Panda's floating-point Colorf structure to
|
||||
// DirectX's D3DCOLOR packed structure.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE DWORD DXGraphicsStateGuardian7::
|
||||
Colorf_to_D3DCOLOR(const Colorf &cColorf) {
|
||||
// MS VC defines _M_IX86 for x86. gcc should define _X86_
|
||||
#if defined(_M_IX86) || defined(_X86_)
|
||||
DWORD d3dcolor,tempcolorval=255;
|
||||
|
||||
// note the default FPU rounding mode will give 255*0.5f=0x80, not 0x7F as VC would force it to by resetting rounding mode
|
||||
// dont think this makes much difference
|
||||
|
||||
__asm {
|
||||
push ebx ; want to save this in case this fn is inlined
|
||||
push ecx
|
||||
mov ecx, cColorf
|
||||
fild tempcolorval
|
||||
fld DWORD PTR [ecx]
|
||||
fmul ST(0),ST(1)
|
||||
fistp tempcolorval ; no way to store directly to int register
|
||||
mov eax, tempcolorval
|
||||
shl eax, 16
|
||||
|
||||
fld DWORD PTR [ecx+4] ;grn
|
||||
fmul ST(0),ST(1)
|
||||
fistp tempcolorval
|
||||
mov ebx,tempcolorval
|
||||
shl ebx, 8
|
||||
or eax,ebx
|
||||
|
||||
fld DWORD PTR [ecx+8] ;blue
|
||||
fmul ST(0),ST(1)
|
||||
fistp tempcolorval
|
||||
or eax,tempcolorval
|
||||
|
||||
fld DWORD PTR [ecx+12] ;alpha
|
||||
fmul ST(0),ST(1)
|
||||
fistp tempcolorval
|
||||
; simulate pop 255.0 off FP stack w/o store, mark top as empty and increment stk ptr
|
||||
ffree ST(0)
|
||||
fincstp
|
||||
mov ebx,tempcolorval
|
||||
shl ebx, 24
|
||||
or eax,ebx
|
||||
mov d3dcolor,eax
|
||||
pop ecx
|
||||
pop ebx
|
||||
}
|
||||
|
||||
// dxgsg7_cat.debug() << (void*)d3dcolor << endl;
|
||||
return d3dcolor;
|
||||
#else //!_X86_
|
||||
return MY_D3DRGBA(cColorf[0], cColorf[1], cColorf[2], cColorf[3]);
|
||||
#endif //!_X86_
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DXGraphicsStateGuardian7::get_texture_wrap_mode
|
||||
// Access: Protected, Static
|
||||
// Description: Maps from the Texture's internal wrap mode symbols to
|
||||
// GL's.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE D3DTEXTUREADDRESS DXGraphicsStateGuardian7::
|
||||
get_texture_wrap_mode(Texture::WrapMode wm) {
|
||||
switch (wm) {
|
||||
case Texture::WM_clamp:
|
||||
return D3DTADDRESS_CLAMP;
|
||||
case Texture::WM_repeat:
|
||||
return D3DTADDRESS_WRAP;
|
||||
case Texture::WM_mirror:
|
||||
return D3DTADDRESS_MIRROR;
|
||||
case Texture::WM_mirror_once:
|
||||
return D3DTADDRESS_BORDER;
|
||||
case Texture::WM_border_color:
|
||||
return D3DTADDRESS_BORDER;
|
||||
}
|
||||
dxgsg7_cat.error() << "Invalid Texture::Mode value" << endl;
|
||||
return D3DTADDRESS_WRAP;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DXGraphicsStateGuardian7::get_fog_mode_type
|
||||
// Access: Protected, Static
|
||||
// Description: Maps from the fog types to gl version
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE D3DFOGMODE DXGraphicsStateGuardian7::
|
||||
get_fog_mode_type(Fog::Mode m) {
|
||||
switch (m) {
|
||||
case Fog::M_linear:
|
||||
return D3DFOG_LINEAR;
|
||||
case Fog::M_exponential:
|
||||
return D3DFOG_EXP;
|
||||
case Fog::M_exponential_squared:
|
||||
return D3DFOG_EXP2;
|
||||
}
|
||||
dxgsg7_cat.error() << "Invalid Fog::Mode value" << endl;
|
||||
return D3DFOG_EXP;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DXGraphicsStateGuardian7::get_tex_mat_sym
|
||||
// Access: Protected, Static
|
||||
// Description: Returns the nth D3DTRANSFORMSTATE_TEXTURE(n) constant.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE D3DTRANSFORMSTATETYPE DXGraphicsStateGuardian7::
|
||||
get_tex_mat_sym(int stage_index) {
|
||||
return (D3DTRANSFORMSTATETYPE)(D3DTRANSFORMSTATE_TEXTURE0 + stage_index);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,239 +0,0 @@
|
||||
// Filename: dxGraphicsStateGuardian7.h
|
||||
// Created by: mike (02Feb99)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DXGRAPHICSSTATEGUARDIAN7_H
|
||||
#define DXGRAPHICSSTATEGUARDIAN7_H
|
||||
|
||||
#include "dxgsg7base.h"
|
||||
#include "dxTextureContext7.h"
|
||||
#include "config_dxgsg7.h"
|
||||
|
||||
#include "graphicsStateGuardian.h"
|
||||
#include "texture.h"
|
||||
#include "displayRegion.h"
|
||||
#include "material.h"
|
||||
#include "depthTestAttrib.h"
|
||||
#include "cullFaceAttrib.h"
|
||||
#include "renderModeAttrib.h"
|
||||
#include "fog.h"
|
||||
#include "pointerToArray.h"
|
||||
|
||||
class Light;
|
||||
|
||||
class DXVertexBufferContext7;
|
||||
class DXIndexBufferContext7;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DXGraphicsStateGuardian7
|
||||
// Description : A GraphicsStateGuardian for rendering into DirectX7
|
||||
// contexts.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDADX DXGraphicsStateGuardian7 : public GraphicsStateGuardian {
|
||||
public:
|
||||
DXGraphicsStateGuardian7(const FrameBufferProperties &properties);
|
||||
~DXGraphicsStateGuardian7();
|
||||
|
||||
virtual TextureContext *prepare_texture(Texture *tex);
|
||||
void apply_texture(int i, TextureContext *tc);
|
||||
virtual void release_texture(TextureContext *tc);
|
||||
|
||||
virtual PT(GeomMunger) make_geom_munger(const RenderState *state);
|
||||
|
||||
virtual void set_color_clear_value(const Colorf &value);
|
||||
|
||||
virtual void do_clear(const RenderBuffer &buffer);
|
||||
|
||||
virtual void prepare_display_region();
|
||||
virtual bool prepare_lens();
|
||||
|
||||
virtual bool begin_frame();
|
||||
virtual bool begin_scene();
|
||||
virtual void end_scene();
|
||||
virtual void end_frame();
|
||||
|
||||
virtual bool begin_draw_primitives(const Geom *geom,
|
||||
const GeomMunger *munger,
|
||||
const GeomVertexData *vertex_data);
|
||||
void determine_fvf();
|
||||
virtual void draw_triangles(const GeomTriangles *primitive);
|
||||
virtual void draw_lines(const GeomLines *primitive);
|
||||
virtual void draw_points(const GeomPoints *primitive);
|
||||
virtual void end_draw_primitives();
|
||||
|
||||
virtual void framebuffer_copy_to_texture(Texture *tex, int z, const DisplayRegion *dr,
|
||||
const RenderBuffer &rb);
|
||||
virtual bool framebuffer_copy_to_ram(Texture *tex, int z, const DisplayRegion *dr,
|
||||
const RenderBuffer &rb);
|
||||
|
||||
virtual void reset();
|
||||
|
||||
virtual void apply_fog(Fog *fog);
|
||||
|
||||
virtual void bind_light(PointLight *light_obj, const NodePath &light,
|
||||
int light_id);
|
||||
virtual void bind_light(DirectionalLight *light_obj, const NodePath &light,
|
||||
int light_id);
|
||||
virtual void bind_light(Spotlight *light_obj, const NodePath &light,
|
||||
int light_id);
|
||||
|
||||
INLINE static DWORD Colorf_to_D3DCOLOR(const Colorf &cColorf);
|
||||
|
||||
virtual void set_state_and_transform(const RenderState *state,
|
||||
const TransformState *transform);
|
||||
|
||||
protected:
|
||||
void do_issue_transform();
|
||||
void do_issue_alpha_test();
|
||||
void do_issue_render_mode();
|
||||
void do_issue_rescale_normal();
|
||||
void do_issue_color_write();
|
||||
void do_issue_depth_test();
|
||||
void do_issue_depth_write();
|
||||
void do_issue_cull_face();
|
||||
void do_issue_fog();
|
||||
void do_issue_depth_offset();
|
||||
void do_issue_tex_gen();
|
||||
void do_issue_shade_model();
|
||||
void do_issue_material();
|
||||
void do_issue_texture();
|
||||
void do_issue_blending();
|
||||
|
||||
virtual void enable_lighting(bool enable);
|
||||
virtual void set_ambient_light(const Colorf &color);
|
||||
virtual void enable_light(int light_id, bool enable);
|
||||
|
||||
virtual void enable_clip_plane(int plane_id, bool enable);
|
||||
virtual void bind_clip_plane(const NodePath &plane, int plane_id);
|
||||
|
||||
void free_nondx_resources();
|
||||
void free_d3d_device();
|
||||
|
||||
void set_draw_buffer(const RenderBuffer &rb);
|
||||
void set_read_buffer(const RenderBuffer &rb);
|
||||
|
||||
void do_auto_rescale_normal();
|
||||
|
||||
protected:
|
||||
INLINE static D3DTEXTUREADDRESS get_texture_wrap_mode(Texture::WrapMode wm);
|
||||
INLINE static D3DFOGMODE get_fog_mode_type(Fog::Mode m);
|
||||
const D3DCOLORVALUE &get_light_color(Light *light) const;
|
||||
INLINE static D3DTRANSFORMSTATETYPE get_tex_mat_sym(int stage_index);
|
||||
|
||||
static D3DBLEND get_blend_func(ColorBlendAttrib::Operand operand);
|
||||
void report_texmgr_stats();
|
||||
|
||||
void set_context(DXScreenData *new_context);
|
||||
void set_render_target();
|
||||
|
||||
void set_texture_blend_mode(int i, const TextureStage *stage);
|
||||
|
||||
void dx_cleanup();
|
||||
|
||||
bool check_cooperative_level();
|
||||
|
||||
void show_frame();
|
||||
void show_full_screen_frame();
|
||||
void show_windowed_frame();
|
||||
|
||||
void copy_pres_reset(DXScreenData *new_context);
|
||||
|
||||
static D3DTEXTUREMINFILTER get_d3d_min_type(Texture::FilterType filter_type);
|
||||
static D3DTEXTUREMIPFILTER get_d3d_mip_type(Texture::FilterType filter_type);
|
||||
static D3DTEXTUREOP get_texture_operation(TextureStage::CombineMode mode, int scale);
|
||||
static DWORD get_texture_argument(TextureStage::CombineSource source,
|
||||
TextureStage::CombineOperand operand);
|
||||
static DWORD get_texture_argument_modifier(TextureStage::CombineOperand operand);
|
||||
|
||||
static HRESULT CALLBACK enum_tex_formats_callback(LPDDPIXELFORMAT pddpf, void *param);
|
||||
|
||||
protected:
|
||||
DXScreenData *_screen;
|
||||
LPDIRECT3DDEVICE7 _d3d_device; // same as _screen->_d3d_device, cached for spd
|
||||
|
||||
bool _dx_is_ready;
|
||||
HRESULT _last_testcooplevel_result;
|
||||
|
||||
bool _vertex_blending_enabled;
|
||||
|
||||
RenderBuffer::Type _cur_read_pixel_buffer; // source for copy_pixel_buffer operation
|
||||
bool _auto_rescale_normal;
|
||||
|
||||
D3DCOLOR _d3dcolor_clear_value;
|
||||
UINT _color_writemask;
|
||||
|
||||
float _material_ambient;
|
||||
float _material_diffuse;
|
||||
float _material_specular;
|
||||
float _material_shininess;
|
||||
float _material_emission;
|
||||
|
||||
enum DxgsgFogType {
|
||||
None,
|
||||
PerVertexFog=D3DRENDERSTATE_FOGVERTEXMODE,
|
||||
PerPixelFog=D3DRENDERSTATE_FOGTABLEMODE
|
||||
};
|
||||
DxgsgFogType _do_fog_type;
|
||||
|
||||
DWORD _clip_plane_bits;
|
||||
CullFaceAttrib::Mode _cull_face_mode;
|
||||
RenderModeAttrib::Mode _current_fill_mode; //point/wireframe/solid
|
||||
|
||||
LMatrix4f _projection_mat;
|
||||
|
||||
CPT(DisplayRegion) _actual_display_region;
|
||||
const DXVertexBufferContext7 *_active_vbuffer;
|
||||
const DXIndexBufferContext7 *_active_ibuffer;
|
||||
|
||||
bool _tex_stats_retrieval_impossible;
|
||||
|
||||
int _fvf;
|
||||
LPDDPIXELFORMAT _tex_formats;
|
||||
int _num_tex_formats;
|
||||
|
||||
static D3DMATRIX _d3d_ident_mat;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
|
||||
public:
|
||||
static void init_type() {
|
||||
GraphicsStateGuardian::init_type();
|
||||
register_type(_type_handle, "DXGraphicsStateGuardian7",
|
||||
GraphicsStateGuardian::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
|
||||
friend class wdxGraphicsWindow7;
|
||||
friend class wdxGraphicsPipe7;
|
||||
friend class wdxGraphicsWindowGroup7;
|
||||
friend class DXTextureContext7;
|
||||
};
|
||||
|
||||
#include "dxGraphicsStateGuardian7.I"
|
||||
|
||||
#endif
|
||||
|
@ -1,29 +0,0 @@
|
||||
// Filename: dxTextureContext7.I
|
||||
// Created by: drose (26Oct05)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DXTextureContext7::has_mipmaps
|
||||
// Access: Public
|
||||
// Description: Returns true if the texture was created with mipmaps,
|
||||
// false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool DXTextureContext7::
|
||||
has_mipmaps() const {
|
||||
return _has_mipmaps;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,78 +0,0 @@
|
||||
// Filename: dxTextureContext7.h
|
||||
// Created by: drose (07Oct99)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DXTEXTURECONTEXT7_H
|
||||
#define DXTEXTURECONTEXT7_H
|
||||
|
||||
#include "dxgsg7base.h"
|
||||
|
||||
#include "texture.h"
|
||||
#include "textureContext.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DXTextureContext7
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDADX DXTextureContext7 : public TextureContext {
|
||||
friend class DXGraphicsStateGuardian7;
|
||||
friend class wdxGraphicsWindow7;
|
||||
|
||||
public:
|
||||
DXTextureContext7(Texture *tex);
|
||||
~DXTextureContext7();
|
||||
|
||||
LPDIRECTDRAWSURFACE7 _surface;
|
||||
Texture *_tex; // ptr to parent, primarily for access to namestr
|
||||
|
||||
// static is_unused_texpixelformat(DDPIXELFORMAT *)
|
||||
|
||||
LPDIRECTDRAWSURFACE7 create_texture(LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, DDPIXELFORMAT *pTexFmts,LPD3DDEVICEDESC7 pD3DDevDesc);
|
||||
void delete_texture();
|
||||
|
||||
INLINE bool has_mipmaps() const;
|
||||
|
||||
bool _has_mipmaps;
|
||||
DWORD _PixBufConversionType; // enum ConversionType
|
||||
|
||||
HRESULT FillDDSurfTexturePixels();
|
||||
|
||||
protected:
|
||||
unsigned int get_bits_per_pixel(Texture::Format format, int *alphbits);
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
TextureContext::init_type();
|
||||
register_type(_type_handle, "DXTextureContext7",
|
||||
TextureContext::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "dxTextureContext7.I"
|
||||
|
||||
#endif
|
||||
|
@ -1 +0,0 @@
|
||||
#include "dxgsg7_composite1.cxx"
|
@ -1,7 +0,0 @@
|
||||
#include "dxgsg7base.h"
|
||||
#include "dxgsg7base.cxx"
|
||||
#include "config_dxgsg7.cxx"
|
||||
#include "dxGeomMunger7.cxx"
|
||||
#include "dxTextureContext7.cxx"
|
||||
#include "wdxGraphicsPipe7.cxx"
|
||||
#include "wdxGraphicsWindow7.cxx"
|
File diff suppressed because it is too large
Load Diff
@ -1,129 +0,0 @@
|
||||
// Filename: dxTextureContext7.h
|
||||
// Created by: drose (07Oct99)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DXGSGBASE_H
|
||||
#define DXGSGBASE_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // get rid of mfc win32 hdr stuff
|
||||
#ifndef STRICT
|
||||
// enable strict type checking in windows.h, see msdn
|
||||
#define STRICT
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <ddraw.h>
|
||||
|
||||
#define D3D_OVERLOADS // get D3DVECTOR '+' operator, etc from d3dtypes.h
|
||||
#include <d3d.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#if DIRECT3D_VERSION != 0x0700
|
||||
#error DX7 headers not available, you need to install MS Platform SDK or DirectX 8+ SDK!
|
||||
#endif
|
||||
|
||||
#define D3DERRORSTRING(HRESULT) " at (" << __FILE__ << ":" << __LINE__ << "), hr=" << ConvD3DErrorToString(HRESULT) << endl
|
||||
|
||||
// disable nameless struct 'warning'
|
||||
#pragma warning (disable : 4201)
|
||||
|
||||
#define MAX_DX_TEXPIXFMTS 20 // should be enough for any card
|
||||
|
||||
#define ISPOW2(X) (((X) & ((X)-1))==0)
|
||||
|
||||
#define DX_DECLARE_CLEAN(type, var) \
|
||||
type var; \
|
||||
ZeroMemory(&var, sizeof(type)); \
|
||||
var.dwSize = sizeof(type);
|
||||
|
||||
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
|
||||
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
|
||||
#define SAFE_FREELIB(hDLL) { if(hDLL!=NULL) { FreeLibrary(hDLL); hDLL = NULL; } }
|
||||
#define IS_VALID_PTR(PTR) (!IsBadWritePtr(PTR,sizeof(void*)))
|
||||
|
||||
// this is bDoDownToZero argument to RELEASE()
|
||||
#define RELEASE_DOWN_TO_ZERO true
|
||||
#define RELEASE_ONCE false
|
||||
|
||||
#define DEBUG_RELEASES
|
||||
|
||||
#ifdef DEBUG_RELEASES
|
||||
#define RELEASE(OBJECT,MODULE,DBGSTR,bDoDownToZero) { \
|
||||
ULONG refcnt; \
|
||||
if(((OBJECT)!=NULL)&&(!IsBadWritePtr((OBJECT),4))) { \
|
||||
refcnt = (OBJECT)->Release(); \
|
||||
MODULE##_cat.debug() << DBGSTR << " released, refcnt = " << refcnt << endl; \
|
||||
if((bDoDownToZero) && (refcnt>0)) { \
|
||||
MODULE##_cat.warning() << DBGSTR << " released but still has a non-zero refcnt(" << refcnt << "), multi-releasing it down to zero!\n"; \
|
||||
do { \
|
||||
refcnt = (OBJECT)->Release(); \
|
||||
} while(refcnt>0); \
|
||||
} \
|
||||
(OBJECT) = NULL; \
|
||||
} else { \
|
||||
MODULE##_cat.debug() << DBGSTR << " not released, ptr == NULL" << endl; \
|
||||
} }
|
||||
|
||||
#define PRINTREFCNT(OBJECT,STR) { (OBJECT)->AddRef(); dxgsg7_cat.debug() << STR << " refcnt = " << (OBJECT)->Release() << endl; }
|
||||
#else
|
||||
#define RELEASE(OBJECT,MODULE,DBGSTR,bDoDownToZero) { \
|
||||
ULONG refcnt; \
|
||||
if(((OBJECT)!=NULL)&&(!IsBadWritePtr((OBJECT),4))) { \
|
||||
refcnt=(OBJECT)->Release(); \
|
||||
if((bDoDownToZero) && (refcnt>0)) { \
|
||||
MODULE##_cat.warning() << DBGSTR << " released but still has a non-zero refcnt(" << refcnt << "), multi-releasing it down to zero!\n"; \
|
||||
do { \
|
||||
refcnt = (OBJECT)->Release(); \
|
||||
} while(refcnt>0); \
|
||||
} \
|
||||
(OBJECT) = NULL; \
|
||||
} }
|
||||
|
||||
#define PRINTREFCNT(OBJECT,STR)
|
||||
#endif
|
||||
|
||||
#ifdef DO_PSTATS
|
||||
#define DO_PSTATS_STUFF(XX) XX;
|
||||
#else
|
||||
#define DO_PSTATS_STUFF(XX)
|
||||
#endif
|
||||
|
||||
const char *ConvD3DErrorToString(HRESULT error);
|
||||
|
||||
typedef struct {
|
||||
LPDIRECT3DDEVICE7 pD3DDevice;
|
||||
LPDIRECTDRAW7 pDD;
|
||||
LPDIRECT3D7 pD3D;
|
||||
LPDIRECTDRAWSURFACE7 pddsPrimary,pddsBack,pddsZBuf;
|
||||
HWND hWnd;
|
||||
HMONITOR hMon;
|
||||
DWORD dwRenderWidth,dwRenderHeight,dwFullScreenBitDepth;
|
||||
RECT view_rect,clip_rect;
|
||||
DWORD MaxAvailVidMem;
|
||||
bool bIsLowVidMemCard;
|
||||
bool bIsTNLDevice;
|
||||
bool bIsSWRast;
|
||||
bool bIsFullScreen;
|
||||
WORD depth_buffer_bitdepth; //GetSurfaceDesc is not reliable so must store this explicitly
|
||||
WORD CardIDNum; // its posn in DisplayArray, for dbgprint purposes
|
||||
DDDEVICEIDENTIFIER2 DXDeviceID;
|
||||
D3DDEVICEDESC7 D3DDevDesc;
|
||||
} DXScreenData;
|
||||
#endif
|
||||
|
@ -1,17 +0,0 @@
|
||||
// Filename: wdxGraphicsPipe7.I
|
||||
// Created by: drose (20Dec02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
@ -1,126 +0,0 @@
|
||||
// Filename: wdxGraphicsPipe7.cxx
|
||||
// Created by: drose (20Dec02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wdxGraphicsPipe7.h"
|
||||
#include "wdxGraphicsWindow7.h"
|
||||
#include "config_dxgsg7.h"
|
||||
|
||||
TypeHandle wdxGraphicsPipe7::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: wdxGraphicsPipe7::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
wdxGraphicsPipe7::
|
||||
wdxGraphicsPipe7() {
|
||||
_hDDrawDLL = NULL;
|
||||
_is_valid = init();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: wdxGraphicsPipe7::Destructor
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
wdxGraphicsPipe7::
|
||||
~wdxGraphicsPipe7() {
|
||||
SAFE_FREELIB(_hDDrawDLL);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: wdxGraphicsPipe7::get_interface_name
|
||||
// Access: Published, Virtual
|
||||
// Description: Returns the name of the rendering interface
|
||||
// associated with this GraphicsPipe. This is used to
|
||||
// present to the user to allow him/her to choose
|
||||
// between several possible GraphicsPipes available on a
|
||||
// particular platform, so the name should be meaningful
|
||||
// and unique for a given platform.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
string wdxGraphicsPipe7::
|
||||
get_interface_name() const {
|
||||
return "DirectX7";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: wdxGraphicsPipe7::pipe_constructor
|
||||
// Access: Public, Static
|
||||
// Description: This function is passed to the GraphicsPipeSelection
|
||||
// object to allow the user to make a default
|
||||
// wdxGraphicsPipe7.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PT(GraphicsPipe) wdxGraphicsPipe7::
|
||||
pipe_constructor() {
|
||||
return new wdxGraphicsPipe7;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: wdxGraphicsPipe7::make_window
|
||||
// Access: Protected, Virtual
|
||||
// Description: Creates a new window on the pipe, if possible.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PT(GraphicsWindow) wdxGraphicsPipe7::
|
||||
make_window(GraphicsStateGuardian *gsg, const string &name) {
|
||||
// thanks to the dumb threading requirements this constructor actually does nothing but create an empty c++ object
|
||||
// no windows are really opened until wdxGraphicsWindow8->open_window() is called
|
||||
|
||||
return new wdxGraphicsWindow7(this, gsg, name);
|
||||
}
|
||||
|
||||
|
||||
PT(GraphicsStateGuardian) wdxGraphicsPipe7::
|
||||
make_gsg(const FrameBufferProperties &properties,
|
||||
GraphicsStateGuardian *share_with) {
|
||||
if (share_with != (GraphicsStateGuardian *)NULL) {
|
||||
wdxdisplay7_cat.error()
|
||||
<< "wdxGraphicsPipe7 does not presently support sharing texture contexts.\n";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// FrameBufferProperties really belongs as part of the window/renderbuffer specification
|
||||
// put here because of GLX multithreading requirement
|
||||
PT(DXGraphicsStateGuardian7) gsg = new DXGraphicsStateGuardian7(properties);
|
||||
return gsg.p();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: wdxGraphicsPipe7::init
|
||||
// Access: Private
|
||||
// Description: Performs some initialization steps to load up
|
||||
// function pointers from the relevant DLL's, and
|
||||
// determine the number and type of available graphics
|
||||
// adapters, etc. Returns true on success, false on
|
||||
// failure.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool wdxGraphicsPipe7::
|
||||
init() {
|
||||
|
||||
if(!MyLoadLib(_hDDrawDLL,"ddraw.dll")) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if(!MyGetProcAddr(_hDDrawDLL, (FARPROC*)&_DirectDrawCreateEx, "DirectDrawCreateEx")) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
return false;
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
// Filename: wdxGraphicsPipe7.h
|
||||
// Created by: drose (20Dec02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef WDXGRAPHICSPIPE7_H
|
||||
#define WDXGRAPHICSPIPE7_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "winGraphicsPipe.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : wdxGraphicsPipe7
|
||||
// Description : This graphics pipe represents the interface for
|
||||
// creating DirectX graphics windows.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDADX wdxGraphicsPipe7 : public WinGraphicsPipe {
|
||||
public:
|
||||
wdxGraphicsPipe7();
|
||||
virtual ~wdxGraphicsPipe7();
|
||||
|
||||
virtual string get_interface_name() const;
|
||||
static PT(GraphicsPipe) pipe_constructor();
|
||||
virtual PT(GraphicsStateGuardian) make_gsg(const FrameBufferProperties &properties,
|
||||
GraphicsStateGuardian *share_with);
|
||||
|
||||
protected:
|
||||
virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg, const string &name);
|
||||
|
||||
private:
|
||||
bool init();
|
||||
|
||||
private:
|
||||
HINSTANCE _hDDrawDLL;
|
||||
|
||||
typedef HRESULT (WINAPI * LPDIRECTDRAWCREATEEX)(GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid, IUnknown FAR *pUnkOuter);
|
||||
LPDIRECTDRAWCREATEEX _DirectDrawCreateEx;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
WinGraphicsPipe::init_type();
|
||||
register_type(_type_handle, "wdxGraphicsPipe7",
|
||||
WinGraphicsPipe::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
|
||||
friend class wdxGraphicsWindow7;
|
||||
};
|
||||
|
||||
#include "wdxGraphicsPipe7.I"
|
||||
|
||||
#endif
|
@ -1,17 +0,0 @@
|
||||
// Filename: wdxGraphicsWindow7.I
|
||||
// Created by: drose (20Dec02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
File diff suppressed because it is too large
Load Diff
@ -1,87 +0,0 @@
|
||||
// Filename: wdxGraphicsWindow7.h
|
||||
// Created by: drose (20Dec02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef WDXGRAPHICSWINDOW7_H
|
||||
#define WDXGRAPHICSWINDOW7_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "winGraphicsWindow.h"
|
||||
#include "pvector.h"
|
||||
|
||||
class DXGraphicsStateGuardian7;
|
||||
|
||||
typedef struct {
|
||||
char szDriver[MAX_DDDEVICEID_STRING];
|
||||
char szDescription[MAX_DDDEVICEID_STRING];
|
||||
GUID guidDeviceIdentifier;
|
||||
HMONITOR hMon;
|
||||
} DXDeviceInfo;
|
||||
typedef pvector<DXDeviceInfo> DXDeviceInfoVec;
|
||||
|
||||
typedef HRESULT (WINAPI * LPDIRECTDRAWCREATEEX)(GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid,IUnknown FAR *pUnkOuter);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : wdxGraphicsWindow7
|
||||
// Description : A single graphics window for rendering DirectX under
|
||||
// Microsoft Windows.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDADX wdxGraphicsWindow7 : public WinGraphicsWindow {
|
||||
public:
|
||||
wdxGraphicsWindow7(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
||||
const string &name);
|
||||
virtual ~wdxGraphicsWindow7();
|
||||
virtual void end_flip();
|
||||
virtual void make_current();
|
||||
virtual bool open_window();
|
||||
|
||||
protected:
|
||||
virtual void fullscreen_restored(WindowProperties &properties);
|
||||
virtual void handle_reshape();
|
||||
virtual bool do_fullscreen_resize(int x_size, int y_size);
|
||||
|
||||
private:
|
||||
bool set_to_temp_rendertarget();
|
||||
void create_screen_buffers_and_device(DXScreenData &Display,
|
||||
bool force_16bpp_zbuffer);
|
||||
bool choose_device(int devnum, DXDeviceInfo *pDevinfo);
|
||||
void set_coop_levels_and_display_modes();
|
||||
|
||||
DXGraphicsStateGuardian7 *_dxgsg;
|
||||
DXScreenData _wcontext;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
WinGraphicsWindow::init_type();
|
||||
register_type(_type_handle, "wdxGraphicsWindow7",
|
||||
WinGraphicsWindow::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "wdxGraphicsWindow7.I"
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user