Compare commits
179
Commits
qmc
...
openscenegraph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
886b70e368 | ||
|
|
1ea5ae5d52 | ||
|
|
1f430a0706 | ||
|
|
86fda4f51d | ||
|
|
a3885cc38d | ||
|
|
f1402f58bd | ||
|
|
98a4a76a5c | ||
|
|
61bf8aabf8 | ||
|
|
aaee10184b | ||
|
|
ca1650ef1f | ||
|
|
99f53ef3df | ||
|
|
1401cfc0bd | ||
|
|
f65436fe1d | ||
|
|
d563cdc45b | ||
|
|
c2d70803a5 | ||
|
|
610c6417d6 | ||
|
|
9763433049 | ||
|
|
9f5071dde5 | ||
|
|
60112b7b24 | ||
|
|
218a985607 | ||
|
|
393564081d | ||
|
|
d7bb6151b0 | ||
|
|
7e4bace245 | ||
|
|
b15b6dce0d | ||
|
|
686476d8d8 | ||
|
|
fc484a7a23 | ||
|
|
79ca22bef0 | ||
|
|
52e6af3c7d | ||
|
|
341f39cb65 | ||
|
|
f7d58c8b92 | ||
|
|
4696066120 | ||
|
|
af5bef8f55 | ||
|
|
a93aa35694 | ||
|
|
fc6c6e6070 | ||
|
|
d46f6c43a2 | ||
|
|
61ddf58bb6 | ||
|
|
c66a30cfcd | ||
|
|
a892d0cafb | ||
|
|
24a67c84dd | ||
|
|
f862563508 | ||
|
|
22c1a5fa24 | ||
|
|
054f10f441 | ||
|
|
6305fd62c6 | ||
|
|
f57da7657a | ||
|
|
8dbe178bcf | ||
|
|
c420dcdf7a | ||
|
|
6a2259bfe1 | ||
|
|
4be09016bd | ||
|
|
2827b3e64a | ||
|
|
df9f5b0284 | ||
|
|
30df746994 | ||
|
|
e60dc093c4 | ||
|
|
f0a6e49602 | ||
|
|
d7836eb000 | ||
|
|
3913cf1329 | ||
|
|
3850863d77 | ||
|
|
7db4b4e1d1 | ||
|
|
6832ec7c59 | ||
|
|
54b360c09b | ||
|
|
52b3930a00 | ||
|
|
d1a743b1c2 | ||
|
|
8ffa458d41 | ||
|
|
8667711182 | ||
|
|
dfea3de197 | ||
|
|
59163dda54 | ||
|
|
e08387ee22 | ||
|
|
3d5891a189 | ||
|
|
8f5e52ddda | ||
|
|
9a292b5c5d | ||
|
|
726e6afc6c | ||
|
|
e4d29a0bb1 | ||
|
|
05870b90b4 | ||
|
|
11f8eb9ee1 | ||
|
|
a6764c30a4 | ||
|
|
8e04d302b9 | ||
|
|
f0abe54b35 | ||
|
|
339a31761d | ||
|
|
0942dd4637 | ||
|
|
92ec3d50cf | ||
|
|
03c1812419 | ||
|
|
53c6cadf9e | ||
|
|
377e723626 | ||
|
|
af31fcf2d1 | ||
|
|
1d636113a6 | ||
|
|
c70a08cfe2 | ||
|
|
6389261030 | ||
|
|
bcb99fef20 | ||
|
|
03491cc292 | ||
|
|
9a7f9d9fe7 | ||
|
|
c5bad9ee8f | ||
|
|
7fb3ffc06a | ||
|
|
136b05aad8 | ||
|
|
21ec992873 | ||
|
|
fe29ccffb6 | ||
|
|
97f6308802 | ||
|
|
a8b1b7a12e | ||
|
|
6dc5f0c51e | ||
|
|
f3af66ceb4 | ||
|
|
43f7a1c0bb | ||
|
|
fd9db0bcd1 | ||
|
|
e1876e44fc | ||
|
|
cf6003cd7b | ||
|
|
34c87c92b5 | ||
|
|
034099941c | ||
|
|
49ea1cadff | ||
|
|
8546c732b0 | ||
|
|
32054f46e8 | ||
|
|
b8d5549bc1 | ||
|
|
8c65e301ae | ||
|
|
edb126f437 | ||
|
|
67a8229819 | ||
|
|
ce21726491 | ||
|
|
06d4c1fae9 | ||
|
|
c8e94b4828 | ||
|
|
fb9777c30f | ||
|
|
ab721a2a2a | ||
|
|
a9ca7bf6b6 | ||
|
|
ff38c1d539 | ||
|
|
88e6e6b909 | ||
|
|
c8afe450a1 | ||
|
|
4b492e7265 | ||
|
|
fa2a67b474 | ||
|
|
6972c6e320 | ||
|
|
d3a5d42f73 | ||
|
|
c76351701c | ||
|
|
b598a97354 | ||
|
|
79ed8a47d0 | ||
|
|
302a9934b3 | ||
|
|
df152a236a | ||
|
|
ed47df2764 | ||
|
|
1591774202 | ||
|
|
7e832087a2 | ||
|
|
dd0e1f849b | ||
|
|
01564ca94d | ||
|
|
debbb511b5 | ||
|
|
d34bfe0c53 | ||
|
|
f2d0e559f6 | ||
|
|
9774c5f54d | ||
|
|
0f9b3f290a | ||
|
|
51d544a4df | ||
|
|
c72b47fa36 | ||
|
|
49ab312465 | ||
|
|
ebbfb428c8 | ||
|
|
3893af2623 | ||
|
|
025d6f777d | ||
|
|
05de27e9cf | ||
|
|
cbb9896d98 | ||
|
|
606fad0fd8 | ||
|
|
e3e6546910 | ||
|
|
d86a7cb8b2 | ||
|
|
0102156c00 | ||
|
|
4701a865bc | ||
|
|
a4728cd8bf | ||
|
|
36434e5872 | ||
|
|
aad0e5f4ba | ||
|
|
bea445c1ad | ||
|
|
bc4074edd4 | ||
|
|
3b81aedd8a | ||
|
|
02e76b2ac2 | ||
|
|
1f58a8c17a | ||
|
|
5bd0d47da1 | ||
|
|
3bf51c71ee | ||
|
|
c8bc2b9778 | ||
|
|
449ba9d0e9 | ||
|
|
2b0806c8f8 | ||
|
|
24f8b9b9d5 | ||
|
|
60ef7d2830 | ||
|
|
dbe768fd3b | ||
|
|
8f07b0709a | ||
|
|
a3dc872218 | ||
|
|
13aff3993f | ||
|
|
e93fd6b1b0 | ||
|
|
69d073d86a | ||
|
|
6674908a4c | ||
|
|
f2c427d6e4 | ||
|
|
804f5dd8f2 | ||
|
|
0dc8ea3087 | ||
|
|
ca821a6530 | ||
|
|
ce414501d0 |
+10
-8
@@ -1027,15 +1027,11 @@ endif(NOT Qt5Widgets_FOUND AND BRLCAD_ENABLE_QT)
|
||||
mark_as_advanced(Qt5Widgets_DIR)
|
||||
|
||||
# Enable features requiring OpenSceneGraph
|
||||
option(BRLCAD_ENABLE_OSG "Enable features requiring OpenSceneGraph" OFF)
|
||||
option(BRLCAD_ENABLE_OSG "Enable features requiring OpenSceneGraph" ON)
|
||||
mark_as_advanced(BRLCAD_ENABLE_OSG)
|
||||
if(BRLCAD_ENABLE_OSG)
|
||||
find_package(OpenSceneGraph 3.2.0 REQUIRED osgText osgViewer)
|
||||
if(NOT OSG_LIBRARY)
|
||||
message("OpenSceneGraph interface requested, but OSG is not found - disabling")
|
||||
set(BRLCAD_ENABLE_OSG OFF)
|
||||
endif(NOT OSG_LIBRARY)
|
||||
endif(BRLCAD_ENABLE_OSG)
|
||||
#if(BRLCAD_ENABLE_OSG)
|
||||
# find_package(OpenSceneGraph 3.2.0 REQUIRED osgText osgViewer)
|
||||
#endif(BRLCAD_ENABLE_OSG)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# The following are fine-grained options for enabling/disabling compiler
|
||||
@@ -1795,6 +1791,7 @@ BRLCAD_INCLUDE_FILE(sys/prctl.h HAVE_SYS_PRCTL_H)
|
||||
BRLCAD_INCLUDE_FILE(sys/resource.h HAVE_SYS_RESOURCE_H)
|
||||
BRLCAD_INCLUDE_FILE(sys/sched.h HAVE_SYS_SCHED_H)
|
||||
BRLCAD_INCLUDE_FILE(sys/select.h HAVE_SYS_SELECT_H)
|
||||
BRLCAD_INCLUDE_FILE(sys/shm.h HAVE_SYS_SHM_H)
|
||||
BRLCAD_INCLUDE_FILE(sys/socket.h HAVE_SYS_SOCKET_H)
|
||||
BRLCAD_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
|
||||
BRLCAD_INCLUDE_FILE(sys/sysctl.h HAVE_SYS_SYSCTL_H)
|
||||
@@ -1933,6 +1930,10 @@ BRLCAD_FUNCTION_EXISTS(realpath HAVE_REALPATH)
|
||||
BRLCAD_FUNCTION_EXISTS(setenv HAVE_SETENV)
|
||||
BRLCAD_FUNCTION_EXISTS(setpgid HAVE_SETPGID)
|
||||
BRLCAD_FUNCTION_EXISTS(setpriority HAVE_SETPRIORITY)
|
||||
BRLCAD_FUNCTION_EXISTS(shmctl HAVE_SHMCTL)
|
||||
BRLCAD_FUNCTION_EXISTS(shmat HAVE_SHMAT)
|
||||
BRLCAD_FUNCTION_EXISTS(shmdt HAVE_SHMDT)
|
||||
BRLCAD_FUNCTION_EXISTS(shmget HAVE_SHMGET)
|
||||
BRLCAD_FUNCTION_EXISTS(srand48 HAVE_SRAND48)
|
||||
BRLCAD_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
|
||||
BRLCAD_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
|
||||
@@ -1943,6 +1944,7 @@ BRLCAD_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY)
|
||||
BRLCAD_FUNCTION_EXISTS(strsep HAVE_STRSEP)
|
||||
BRLCAD_FUNCTION_EXISTS(strtok HAVE_STRTOK)
|
||||
BRLCAD_FUNCTION_EXISTS(sync HAVE_SYNC)
|
||||
BRLCAD_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
|
||||
BRLCAD_FUNCTION_EXISTS(sysctl HAVE_SYSCTL)
|
||||
BRLCAD_FUNCTION_EXISTS(sysmp HAVE_SYSMP)
|
||||
BRLCAD_FUNCTION_EXISTS(vfork HAVE_VFORK)
|
||||
|
||||
@@ -536,6 +536,16 @@ first for a system version if BRLCAD_BUNDLED_LIBS is also AUTO.
|
||||
Aliases: ENABLE_ZLIB, ENABLE_LIBZ
|
||||
|
||||
|
||||
--- BRLCAD_FREETYPE ---
|
||||
|
||||
Option for enabling and disabling compilation of the FreeType
|
||||
libraries provided with BRL-CAD's source code. Default is AUTO, responsive to
|
||||
the toplevel BRLCAD_BUNDLED_LIBS option and testing first for a system
|
||||
version if BRLCAD_BUNDLED_LIBS is also AUTO.
|
||||
|
||||
Aliases: ENABLE_FREETYPE
|
||||
|
||||
|
||||
--- BRLCAD_TERMLIB ---
|
||||
|
||||
Option for enabling and disabling compilation of the termlib library
|
||||
@@ -703,6 +713,16 @@ AUTO.
|
||||
Aliases: ENABLE_VDS
|
||||
|
||||
|
||||
--- BRLCAD_OSG ---
|
||||
|
||||
Option for enabling and disabling compilation of the OpenSceneGraph
|
||||
libraries provided with BRL-CAD's source code. Default is AUTO, responsive to
|
||||
the toplevel BRLCAD_BUNDLED_LIBS option and testing first for a system
|
||||
version if BRLCAD_BUNDLED_LIBS is also AUTO.
|
||||
|
||||
Aliases: ENABLE_OPENSCENEGRAPH
|
||||
|
||||
|
||||
--- BRLCAD_GDIAM ---
|
||||
|
||||
Option for enabling and disabling compilation of the libgdiam approximate
|
||||
|
||||
@@ -67,6 +67,8 @@ THESE TASKS SHOULD HAPPEN WITHIN TWO RELEASE ITERATIONS
|
||||
THESE ARE UNSCHEDULED BACKLOG TASKS
|
||||
-----------------------------------
|
||||
|
||||
* See if we can use pkg_conn on Windows instead of Tcl_Channel in MGED
|
||||
|
||||
* geometry symbolic links (hard and soft links)
|
||||
|
||||
* investigate INFINITY spatial partitioning issue.
|
||||
|
||||
@@ -126,6 +126,10 @@ do
|
||||
shift;;
|
||||
--disable-libz) options="$options -DBRLCAD_ZLIB=SYSTEM";
|
||||
shift;;
|
||||
--enable-freetype) options="$options -DBRLCAD_FREETYPE=BUNDLED";
|
||||
shift;;
|
||||
--disable-freetype) options="$options -DBRLCAD_FREETYPE=SYSTEM";
|
||||
shift;;
|
||||
--enable-termlib) options="$options -DBRLCAD_TERMLIB=BUNDLED";
|
||||
shift;;
|
||||
--disable-termlib) options="$options -DBRLCAD_TERMLIB=SYSTEM";
|
||||
@@ -190,6 +194,10 @@ do
|
||||
shift;;
|
||||
--disable-vds) options="$options -DBRLCAD_VDS=SYSTEM";
|
||||
shift;;
|
||||
--enable-openscenegraph) options="$options -DBRLCAD_OSG=BUNDLED";
|
||||
shift;;
|
||||
--disable-openscenegraph) options="$options -DBRLCAD_OSG=SYSTEM";
|
||||
shift;;
|
||||
--enable-gdiam) options="$options -DBRLCAD_GDIAM=BUNDLED";
|
||||
shift;;
|
||||
--disable-gdiam) options="$options -DBRLCAD_GDIAM=SYSTEM";
|
||||
|
||||
@@ -27,7 +27,6 @@ set(public_hdrs
|
||||
dm.h
|
||||
dvec.h
|
||||
fb.h
|
||||
fbio.h
|
||||
fbserv_obj.h
|
||||
fft.h
|
||||
gcv.h
|
||||
|
||||
+168
-450
@@ -29,15 +29,17 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "vmath.h"
|
||||
#include "ged.h"
|
||||
#include "icv.h"
|
||||
|
||||
#include "./dm/defines.h"
|
||||
|
||||
#if 0
|
||||
#define USE_FBSERV 1
|
||||
|
||||
#ifdef USE_FBSERV
|
||||
# include "fbserv_obj.h"
|
||||
#endif
|
||||
|
||||
#include "./dm/defines.h"
|
||||
|
||||
#define DM_NULL (struct dm *)NULL
|
||||
#define DM_MIN (-2048)
|
||||
@@ -69,94 +71,6 @@
|
||||
# define NOISE 16 /* Size of dead spot on knob */
|
||||
#endif
|
||||
|
||||
/* the font used depends on the size of the window opened */
|
||||
#define FONTBACK "-adobe-courier-medium-r-normal--10-100-75-75-m-60-iso8859-1"
|
||||
#define FONT5 "5x7"
|
||||
#define FONT6 "6x10"
|
||||
#define FONT7 "7x13"
|
||||
#define FONT8 "8x13"
|
||||
#define FONT9 "9x15"
|
||||
#define FONT10 "10x20"
|
||||
#define FONT12 "12x24"
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
# define DM_VALID_FONT_SIZE(_size) (14 <= (_size) && (_size) <= 29)
|
||||
#else
|
||||
# define DM_VALID_FONT_SIZE(_size) (5 <= (_size) && (_size) <= 12 && (_size) != 11)
|
||||
# define DM_FONT_SIZE_TO_NAME(_size) (((_size) == 5) ? FONT5 : (((_size) == 6) ? FONT6 : (((_size) == 7) ? FONT7 : (((_size) == 8) ? FONT8 : (((_size) == 9) ? FONT9 : (((_size) == 10) ? FONT10 : FONT12))))))
|
||||
#endif
|
||||
|
||||
/* Display Manager Types */
|
||||
#define DM_TYPE_BAD -1
|
||||
#define DM_TYPE_NULL 0
|
||||
#define DM_TYPE_PLOT 1
|
||||
#define DM_TYPE_PS 2
|
||||
#define DM_TYPE_X 3
|
||||
#define DM_TYPE_OGL 4
|
||||
#define DM_TYPE_GLX 5
|
||||
#define DM_TYPE_PEX 6
|
||||
#define DM_TYPE_WGL 7
|
||||
#define DM_TYPE_TK 8
|
||||
#define DM_TYPE_RTGL 9
|
||||
#define DM_TYPE_TXT 10
|
||||
#define DM_TYPE_QT 11
|
||||
#define DM_TYPE_OSG 12
|
||||
|
||||
/* Line Styles */
|
||||
#define DM_SOLID_LINE 0
|
||||
#define DM_DASHED_LINE 1
|
||||
|
||||
#define IS_DM_TYPE_NULL(_t) ((_t) == DM_TYPE_NULL)
|
||||
#define IS_DM_TYPE_PLOT(_t) ((_t) == DM_TYPE_PLOT)
|
||||
#define IS_DM_TYPE_PS(_t) ((_t) == DM_TYPE_PS)
|
||||
#define IS_DM_TYPE_X(_t) ((_t) == DM_TYPE_X)
|
||||
#define IS_DM_TYPE_TK(_t) ((_t) == DM_TYPE_TK)
|
||||
#define IS_DM_TYPE_OGL(_t) ((_t) == DM_TYPE_OGL)
|
||||
#define IS_DM_TYPE_GLX(_t) ((_t) == DM_TYPE_GLX)
|
||||
#define IS_DM_TYPE_PEX(_t) ((_t) == DM_TYPE_PEX)
|
||||
#define IS_DM_TYPE_WGL(_t) ((_t) == DM_TYPE_WGL)
|
||||
#define IS_DM_TYPE_RTGL(_t) ((_t) == DM_TYPE_RTGL)
|
||||
#define IS_DM_TYPE_TXT(_t) ((_t) == DM_TYPE_TXT)
|
||||
#define IS_DM_TYPE_QT(_t) ((_t) == DM_TYPE_QT)
|
||||
#define IS_DM_TYPE_OSG(_t) ((_t) == DM_TYPE_OSG)
|
||||
|
||||
#define GET_DM(p, structure, w, hp) { \
|
||||
register struct structure *tp; \
|
||||
for (BU_LIST_FOR(tp, structure, hp)) { \
|
||||
if (w == tp->win) { \
|
||||
(p) = tp; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if (BU_LIST_IS_HEAD(tp, hp)) \
|
||||
p = (struct structure *)NULL; \
|
||||
}
|
||||
|
||||
|
||||
/* Colors */
|
||||
#define DM_COLOR_HI ((short)230)
|
||||
#define DM_COLOR_LOW ((short)0)
|
||||
#define DM_BLACK_R DM_COLOR_LOW
|
||||
#define DM_BLACK_G DM_COLOR_LOW
|
||||
#define DM_BLACK_B DM_COLOR_LOW
|
||||
#define DM_RED_R DM_COLOR_HI
|
||||
#define DM_RED_G DM_COLOR_LOW
|
||||
#define DM_RED_B DM_COLOR_LOW
|
||||
#define DM_BLUE_R DM_COLOR_LOW
|
||||
#define DM_BLUE_G DM_COLOR_LOW
|
||||
#define DM_BLUE_B DM_COLOR_HI
|
||||
#define DM_YELLOW_R DM_COLOR_HI
|
||||
#define DM_YELLOW_G DM_COLOR_HI
|
||||
#define DM_YELLOW_B DM_COLOR_LOW
|
||||
#define DM_WHITE_R DM_COLOR_HI
|
||||
#define DM_WHITE_G DM_COLOR_HI
|
||||
#define DM_WHITE_B DM_COLOR_HI
|
||||
#define DM_BLACK DM_BLACK_R, DM_BLACK_G, DM_BLACK_B
|
||||
#define DM_RED DM_RED_R, DM_RED_G, DM_RED_B
|
||||
#define DM_BLUE DM_BLUE_R, DM_BLUE_G, DM_BLUE_B
|
||||
#define DM_YELLOW DM_YELLOW_R, DM_YELLOW_G, DM_YELLOW_B
|
||||
#define DM_WHITE DM_WHITE_R, DM_WHITE_G, DM_WHITE_B
|
||||
#define DM_COPY_COLOR(_dr, _dg, _db, _sr, _sg, _sb) {\
|
||||
(_dr) = (_sr);\
|
||||
(_dg) = (_sg);\
|
||||
@@ -165,7 +79,6 @@
|
||||
(_dr) == (_sr) &&\
|
||||
(_dg) == (_sg) &&\
|
||||
(_db) == (_sb))
|
||||
#if defined(DM_X) || defined(DM_OGL)
|
||||
#define DM_REVERSE_COLOR_BYTE_ORDER(_shift, _mask) { \
|
||||
_shift = 24 - _shift; \
|
||||
switch (_shift) { \
|
||||
@@ -183,380 +96,185 @@
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
/* Do nothing */
|
||||
#define DM_REVERSE_COLOR_BYTE_ORDER(_shift, _mask)
|
||||
#endif
|
||||
|
||||
/* Command parameter to dmr_viewchange() */
|
||||
#define DM_CHGV_REDO 0 /* Display has changed substantially */
|
||||
#define DM_CHGV_ADD 1 /* Add an object to the display */
|
||||
#define DM_CHGV_DEL 2 /* Delete an object from the display */
|
||||
#define DM_CHGV_REPL 3 /* Replace an object */
|
||||
#define DM_CHGV_ILLUM 4 /* Make new object the illuminated object */
|
||||
|
||||
/*
|
||||
* Definitions for dealing with the buttons and lights.
|
||||
* BV are for viewing, and BE are for editing functions.
|
||||
*/
|
||||
#define LIGHT_OFF 0
|
||||
#define LIGHT_ON 1
|
||||
#define LIGHT_RESET 2 /* all lights out */
|
||||
|
||||
struct dm_vars {
|
||||
void *pub_vars;
|
||||
void *priv_vars;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Interface to a specific Display Manager
|
||||
*/
|
||||
struct dm {
|
||||
int (*dm_close)(struct dm *dmp);
|
||||
int (*dm_drawBegin)(struct dm *dmp); /**< @brief formerly dmr_prolog */
|
||||
int (*dm_drawEnd)(struct dm *dmp); /**< @brief formerly dmr_epilog */
|
||||
int (*dm_normal)(struct dm *dmp);
|
||||
int (*dm_loadMatrix)(struct dm *dmp, fastf_t *mat, int which_eye);
|
||||
int (*dm_loadPMatrix)(struct dm *dmp, fastf_t *mat);
|
||||
int (*dm_drawString2D)(struct dm *dmp, const char *str, fastf_t x, fastf_t y, int size, int use_aspect); /**< @brief formerly dmr_puts */
|
||||
int (*dm_drawLine2D)(struct dm *dmp, fastf_t x_1, fastf_t y_1, fastf_t x_2, fastf_t y_2); /**< @brief formerly dmr_2d_line */
|
||||
int (*dm_drawLine3D)(struct dm *dmp, point_t pt1, point_t pt2);
|
||||
int (*dm_drawLines3D)(struct dm *dmp, int npoints, point_t *points, int sflag);
|
||||
int (*dm_drawPoint2D)(struct dm *dmp, fastf_t x, fastf_t y);
|
||||
int (*dm_drawPoint3D)(struct dm *dmp, point_t point);
|
||||
int (*dm_drawPoints3D)(struct dm *dmp, int npoints, point_t *points);
|
||||
int (*dm_drawVList)(struct dm *dmp, struct bn_vlist *vp);
|
||||
int (*dm_drawVListHiddenLine)(struct dm *dmp, register struct bn_vlist *vp);
|
||||
int (*dm_draw)(struct dm *dmp, struct bn_vlist *(*callback_function)(void *), void **data); /**< @brief formerly dmr_object */
|
||||
int (*dm_setFGColor)(struct dm *dmp, unsigned char r, unsigned char g, unsigned char b, int strict, fastf_t transparency);
|
||||
int (*dm_setBGColor)(struct dm *, unsigned char, unsigned char, unsigned char);
|
||||
int (*dm_setLineAttr)(struct dm *dmp, int width, int style); /**< @brief currently - linewidth, (not-)dashed */
|
||||
int (*dm_configureWin)(struct dm *dmp, int force);
|
||||
int (*dm_setWinBounds)(struct dm *dmp, fastf_t *w);
|
||||
int (*dm_setLight)(struct dm *dmp, int light_on);
|
||||
int (*dm_setTransparency)(struct dm *dmp, int transparency_on);
|
||||
int (*dm_setDepthMask)(struct dm *dmp, int depthMask_on);
|
||||
int (*dm_setZBuffer)(struct dm *dmp, int zbuffer_on);
|
||||
int (*dm_debug)(struct dm *dmp, int lvl); /**< @brief Set DM debug level */
|
||||
int (*dm_logfile)(struct dm *dmp, const char *filename); /**< @brief Set DM log file */
|
||||
int (*dm_beginDList)(struct dm *dmp, unsigned int list);
|
||||
int (*dm_endDList)(struct dm *dmp);
|
||||
void (*dm_drawDList)(unsigned int list);
|
||||
int (*dm_freeDLists)(struct dm *dmp, unsigned int list, int range);
|
||||
int (*dm_genDLists)(struct dm *dmp, size_t range);
|
||||
int (*dm_getDisplayImage)(struct dm *dmp, unsigned char **image);
|
||||
void (*dm_reshape)(struct dm *dmp, int width, int height);
|
||||
int (*dm_makeCurrent)(struct dm *dmp);
|
||||
int (*dm_openFb)(struct dm *dmp, FBIO *ifp);
|
||||
unsigned long dm_id; /**< @brief window id */
|
||||
int dm_displaylist; /**< @brief !0 means device has displaylist */
|
||||
int dm_stereo; /**< @brief stereo flag */
|
||||
double dm_bound; /**< @brief zoom-in limit */
|
||||
int dm_boundFlag;
|
||||
const char *dm_name; /**< @brief short name of device */
|
||||
const char *dm_lname; /**< @brief long name of device */
|
||||
int dm_type; /**< @brief display manager type */
|
||||
int dm_top; /**< @brief !0 means toplevel window */
|
||||
int dm_width;
|
||||
int dm_height;
|
||||
int dm_bytes_per_pixel;
|
||||
int dm_bits_per_channel; /* bits per color channel */
|
||||
int dm_lineWidth;
|
||||
int dm_lineStyle;
|
||||
fastf_t dm_aspect;
|
||||
fastf_t *dm_vp; /**< @brief (FIXME: ogl still depends on this) Viewscale pointer */
|
||||
struct dm_vars dm_vars; /**< @brief display manager dependent variables */
|
||||
struct bu_vls dm_pathName; /**< @brief full Tcl/Tk name of drawing window */
|
||||
struct bu_vls dm_tkName; /**< @brief short Tcl/Tk name of drawing window */
|
||||
struct bu_vls dm_dName; /**< @brief Display name */
|
||||
unsigned char dm_bg[3]; /**< @brief background color */
|
||||
unsigned char dm_fg[3]; /**< @brief foreground color */
|
||||
vect_t dm_clipmin; /**< @brief minimum clipping vector */
|
||||
vect_t dm_clipmax; /**< @brief maximum clipping vector */
|
||||
int dm_debugLevel; /**< @brief !0 means debugging */
|
||||
struct bu_vls dm_log; /**< @brief !NULL && !empty means log debug output to the file */
|
||||
int dm_perspective; /**< @brief !0 means perspective on */
|
||||
int dm_light; /**< @brief !0 means lighting on */
|
||||
int dm_transparency; /**< @brief !0 means transparency on */
|
||||
int dm_depthMask; /**< @brief !0 means depth buffer is writable */
|
||||
int dm_zbuffer; /**< @brief !0 means zbuffer on */
|
||||
int dm_zclip; /**< @brief !0 means zclipping */
|
||||
int dm_clearBufferAfter; /**< @brief 1 means clear back buffer after drawing and swap */
|
||||
int dm_fontsize; /**< @brief !0 override's the auto font size */
|
||||
Tcl_Interp *dm_interp; /**< @brief Tcl interpreter */
|
||||
};
|
||||
|
||||
/**********************************************************************************************/
|
||||
/** EXPERIMENTAL - considering a new design for the display
|
||||
* manager structure. DO NOT USE!! */
|
||||
#if 0
|
||||
|
||||
/* Will need bu_dlopen and bu_dlsym for a plugin system - look at how
|
||||
* liboptical's shaders are set up. */
|
||||
/* Display Manager Types */
|
||||
#define DM_TYPE_BAD -1
|
||||
#define DM_TYPE_NULL 0
|
||||
#define DM_TYPE_TXT 1
|
||||
#define DM_TYPE_QT 2
|
||||
#define DM_TYPE_OSG 3
|
||||
|
||||
/* Window management functions */
|
||||
struct dm_window_functions {
|
||||
int (*dm_open)(struct dm *dmp, void *data);
|
||||
int (*dm_close)(struct dm *dmp, void *data);
|
||||
void *(*dm_context)(struct dm *dmp, void *data);
|
||||
int (*dm_configureWin)(struct dm *dmp, int force);
|
||||
int (*dm_setWinBounds)(struct dm *dmp, fastf_t *w);
|
||||
}
|
||||
struct dm_window_state {
|
||||
struct bu_vls dm_fullName; /**< @brief full Tcl/Tk name of drawing window */
|
||||
struct bu_vls dm_shortName; /**< @brief short Tcl/Tk name of drawing window */
|
||||
int width;
|
||||
int height;
|
||||
#define DM_STYLE_TXT 0
|
||||
#define DM_STYLE_WIREFRAME 1
|
||||
#define DM_STYLE_POINTS 2
|
||||
#define DM_STYLE_TRIANGLES 3
|
||||
#define DM_STYLE_HIDDEN_LINE 4
|
||||
struct dm_db_obj {
|
||||
int draw_style; /**< @brief bitmask for points, wireframe, solid, hidden line, etc. */
|
||||
mat_t matrix; /**< @brief local matrix for individual in-memory object manipulation during editing, when per-change disk I/O is too expensive */
|
||||
};
|
||||
|
||||
#define DM_VIEW_OBJ_TYPE_3DLINES 0
|
||||
#define DM_VIEW_OBJ_TYPE_2DLINES 1
|
||||
#define DM_VIEW_OBJ_TYPE_TRIANGLES 2
|
||||
#define DM_VIEW_OBJ_TYPE_TEXT 4
|
||||
#define DM_VIEW_OBJ_TYPE_FB 5
|
||||
struct dm_view_obj {
|
||||
int draw_type; /**< @brief obj type - framebuffer, 2D lines, 3D lines, triangles, text, grouping object, etc. */
|
||||
struct bn_vlist *vlist; /**< @brief If the object defines specific linear or triangular geometry for drawing
|
||||
(text may but is not required to, and a framebuffer uses image data) it is here. */
|
||||
struct bu_ptbl *obj_set; /**< @brief A grouping object may define a union of other objects (view and/or db) on which actions will be performed */
|
||||
void *image_data;
|
||||
mat_t matrix;
|
||||
};
|
||||
|
||||
|
||||
/* Use a union to allow the display list object to hold both types */
|
||||
#define DM_DB_OBJ 1
|
||||
#define DM_VIEW_OBJ 2
|
||||
union dm_object {
|
||||
struct dm_db_obj db_obj;
|
||||
struct dm_view_obj view_obj;
|
||||
};
|
||||
|
||||
struct dm_display_list {
|
||||
int obj_type;
|
||||
union dm_object obj;
|
||||
struct bu_vls *handle; /**< @brief For non-geometry view objects, need a string handle. For geometry objects, full path string */
|
||||
int dirty_flag; /**< @brief If set, need to (re)generate the drawing content for this object */
|
||||
int visibility_flag; /**< @brief Allows users to hide/view objects without needing to recreate them */
|
||||
int highlight_flag; /**< @brief Identify whether the object is highlighted within the view */
|
||||
fastf_t draw_width; /**< @brief !0 override's the display manager's default Point radius/line width */
|
||||
int fontsize; /**< @brief !0 override's the display manager's default font size when obj labeling is performed */
|
||||
unsigned char rgb[3]; /**< @brief local color override */
|
||||
struct bu_attribute_value_set *obj_extra_settings; /**< @brief All settings (generic and DMTYPE specific) listed here. */
|
||||
void *client_data; /**< @brief Slot to allow applications to supply custom data */
|
||||
};
|
||||
|
||||
struct dm {
|
||||
uint32_t dm_magic;
|
||||
int dm_type; /**< @brief drawing canvas type (X, OSG, Qt, txt, etc.) currently in use by display manager */
|
||||
char *handle; /**< @brief short name of device */
|
||||
int perspective; /**< @brief !0 means perspective on */
|
||||
mat_t view_matrix; /**< @brief view matrix for the default camera */
|
||||
mat_t proj_matrix; /**< @brief projection matrix for the default camera */
|
||||
void *dm_data; /**< @brief pointer to the actual low level, platform specific data (X window, OSG viewer, internal lists, etc.) */
|
||||
int is_embedded; /**< @brief determine if the display manager is stand-alone or embedded (impacts event handling) */
|
||||
void *parent_info; /**< @brief if dm is embedded, parent_info must contain all the info necessary for libdm to embed the Window */
|
||||
struct bu_ptbl *dm_l; /**< @brief Display list for this view */
|
||||
int fontsize; /**< @brief !0 override's the auto font size */
|
||||
unsigned char dm_bg[3]; /**< @brief background color */
|
||||
unsigned char dm_fg[3]; /**< @brief default foreground color */
|
||||
fastf_t draw_width; /**< @brief Default point radius/line width */
|
||||
int width;
|
||||
int height;
|
||||
struct bu_attribute_value_set *dm_settings; /**< @brief All settings (generic and DMTYPE specific) listed here. */
|
||||
void *client_data; /**< @brief Slot to allow applications to store custom data */
|
||||
};
|
||||
|
||||
const char *dm_common_reserved_settings[] = {
|
||||
"perspective" "Enable/disable perspective mode. Specifics of the perspective mode are controlled by the projection matrix."
|
||||
"proj_mat" "Projection matrix, used for perspective mode."
|
||||
"view_mat" "View matrix - controls the \"camera\" position in space."
|
||||
"background_rgb" "Background color, specified using Red/Green/Blue color values"
|
||||
"foreground_rgb" "Default color for foreground objects, specified using Red/Green/Blue color values"
|
||||
"draw_width" "Default line width/point radius used when drawing objects."
|
||||
"fontsize" "Default font size for text rendering."
|
||||
"width" "Width of display window."
|
||||
"height" "Height of display window."
|
||||
"\0"
|
||||
}
|
||||
|
||||
/* Geometry view management functions */
|
||||
struct dm_view_state {
|
||||
int dm_zclip; /**< @brief !0 means zclipping */
|
||||
vect_t dm_clipmin; /**< @brief minimum clipping vector */
|
||||
vect_t dm_clipmax; /**< @brief maximum clipping vector */
|
||||
int dm_perspective; /**< @brief !0 means perspective on */
|
||||
int dm_light; /**< @brief !0 means lighting on */
|
||||
int dm_transparency; /**< @brief !0 means transparency on */
|
||||
int dm_depthMask; /**< @brief !0 means depth buffer is writable */
|
||||
int dm_zbuffer; /**< @brief !0 means zbuffer on */
|
||||
int dm_fontsize; /**< @brief !0 override's the auto font size */
|
||||
int dm_displaylist; /**< @brief !0 means device has displaylist */
|
||||
int dm_stereo; /**< @brief stereo flag */
|
||||
unsigned char dm_bg[3]; /**< @brief background color */
|
||||
unsigned char dm_fg[3]; /**< @brief foreground color */
|
||||
int width;
|
||||
int height;
|
||||
double fov;
|
||||
double aspect;
|
||||
double near_l;
|
||||
double far_l;
|
||||
}
|
||||
struct dm_view_functions {
|
||||
int (*dm_normal)(struct dm *dmp);
|
||||
int (*dm_set_perspective_view)(struct dm *dmp, double fov, double aspect, double near_l, double far_l);
|
||||
int (*dm_loadMatrix)(struct dm *dmp, fastf_t *mat, int which_eye);
|
||||
int (*dm_loadPMatrix)(struct dm *dmp, fastf_t *mat);
|
||||
int (*dm_setFGColor)(struct dm *dmp, unsigned char r, unsigned char g, unsigned char b, int strict, fastf_t transparency);
|
||||
int (*dm_setBGColor)(struct dm *, unsigned char, unsigned char, unsigned char);
|
||||
int (*dm_setLineAttr)(struct dm *dmp, int width, int style); /**< @brief currently - linewidth, (not-)dashed */
|
||||
int (*dm_setTransparency)(struct dm *dmp, int transparency_on);
|
||||
int (*dm_setDepthMask)(struct dm *dmp, int depthMask_on);
|
||||
int (*dm_setZBuffer)(struct dm *dmp, int zbuffer_on);
|
||||
void (*dm_reshape)(struct dm *dmp, int width, int height);
|
||||
const char *dm_obj_common_reserved_settings[] = {
|
||||
"local_mat" "Local positioning matrix, used (for example) during object editing manipulations."
|
||||
"rgb" "Object color, specified using Red/Green/Blue color values. Defaults to geometry object color, if present."
|
||||
"draw_width" "Local line width/point radius used when drawing objects."
|
||||
"fontsize" "Local font size for text rendering."
|
||||
"dirty" "Flag telling the display manager that the object state is out of sync with the visible state."
|
||||
"visible" "Flag telling the display manager that the object is (or isn't) supposed to be visible in the view."
|
||||
"highlight" "Flag telling the display manager to highlight this object."
|
||||
"\0"
|
||||
}
|
||||
|
||||
/* Structure of dm will (hopefully) be internal to libdm, so use a typedef for the functions */
|
||||
typdef struct dm dm_s;
|
||||
|
||||
/* Geometry drawing functions */
|
||||
struct dm_draw_state {
|
||||
struct bu_list *objects;
|
||||
}
|
||||
|
||||
struct dm_draw_functions {
|
||||
int (*dm_drawBegin)(struct dm *dmp); /**< @brief formerly dmr_prolog */
|
||||
int (*dm_drawEnd)(struct dm *dmp); /**< @brief formerly dmr_epilog */
|
||||
int (*dm_drawString2D)(struct dm *dmp, const char *str, fastf_t x, fastf_t y, int size, int use_aspect); /**< @brief formerly dmr_puts */
|
||||
int (*dm_drawLine2D)(struct dm *dmp, fastf_t x_1, fastf_t y_1, fastf_t x_2, fastf_t y_2); /**< @brief formerly dmr_2d_line */
|
||||
int (*dm_drawLine3D)(struct dm *dmp, point_t pt1, point_t pt2);
|
||||
int (*dm_drawLines3D)(struct dm *dmp, int npoints, point_t *points, int sflag);
|
||||
int (*dm_drawPoint2D)(struct dm *dmp, fastf_t x, fastf_t y);
|
||||
int (*dm_drawPoint3D)(struct dm *dmp, point_t point);
|
||||
int (*dm_drawPoints3D)(struct dm *dmp, int npoints, point_t *points);
|
||||
int (*dm_drawVList)(struct dm *dmp, struct bn_vlist *vp);
|
||||
int (*dm_drawVListHiddenLine)(struct dm *dmp, register struct bn_vlist *vp);
|
||||
int (*dm_draw)(struct dm *dmp, struct bn_vlist *(*callback_function)(void *), void **data); /**< @brief formerly dmr_object */
|
||||
int (*dm_beginDList)(struct dm *dmp, unsigned int list);
|
||||
int (*dm_endDList)(struct dm *dmp);
|
||||
void (*dm_drawDList)(unsigned int list);
|
||||
int (*dm_freeDLists)(struct dm *dmp, unsigned int list, int range);
|
||||
int (*dm_genDLists)(struct dm *dmp, size_t range);
|
||||
}
|
||||
|
||||
struct display_manager {
|
||||
struct dm_window_state *dm_win_s;
|
||||
struct dm_window_functions *dm_win_f;
|
||||
struct dm_view_state *dm_view_s;
|
||||
struct dm_view_functions *dm_view_f;
|
||||
struct dm_draw_state *dm_draw_s;
|
||||
struct dm_draw_functions *dm_draw_f;
|
||||
const char *dm_name; /**< @brief short name of device */
|
||||
const char *dm_lname; /**< @brief long name of device */
|
||||
int (*dm_debug)(struct dm *dmp, int lvl); /**< @brief Set DM debug level */
|
||||
int (*dm_getDisplayImage)(struct dm *dmp, unsigned char **image);
|
||||
void *dm_interp;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**********************************************************************************************/
|
||||
/* Generic functions for all display managers */
|
||||
DM_EXPORT extern void dm_set_handle(dm_s *dmp, const char *handle);
|
||||
DM_EXPORT extern char *dm_get_handle(dm_s *dmp);
|
||||
DM_EXPORT extern void dm_set_perspective(dm_s *dmp, int perspective_flag);
|
||||
DM_EXPORT extern int dm_get_perspective(dm_s *dmp);
|
||||
DM_EXPORT extern void dm_set_proj_mat(dm_s *dmp, mat_t pmat);
|
||||
DM_EXPORT extern matp_t dm_get_proj_mat(dm_s *dmp);
|
||||
DM_EXPORT extern void dm_set_view_mat(dm_s *dmp, mat_t vmat);
|
||||
DM_EXPORT extern matp_t dm_get_view_mat(dm_s *dmp);
|
||||
DM_EXPORT extern void dm_set_background_rgb(dm_s *dmp, unsigned char r, unsigned char g, unsigned char b);
|
||||
DM_EXPORT extern unsigned char *dm_get_background_rgb(dm_s *dmp);
|
||||
DM_EXPORT extern void dm_set_foreground_rgb(dm_s *dmp, unsigned char r, unsigned char g, unsigned char b);
|
||||
DM_EXPORT extern unsigned char *dm_get_foreground_rgb(dm_s *dmp);
|
||||
DM_EXPORT extern void dm_set_default_draw_width(dm_s *dmp, fastf_t draw_width);
|
||||
DM_EXPORT extern fastf_t dm_get_default_draw_width(dm_s *dmp, fastf_t draw_width);
|
||||
DM_EXPORT extern void dm_set_default_fontsize(dm_s *dmp, int fontsize);
|
||||
DM_EXPORT extern int dm_get_default_fontsize(dm_s *dmp);
|
||||
DM_EXPORT extern void dm_set_width(dm_s *dmp, int width);
|
||||
DM_EXPORT extern int dm_get_width(dm_s *dmp);
|
||||
DM_EXPORT extern void dm_set_height(dm_s *dmp, int height);
|
||||
DM_EXPORT extern int dm_get_height(dm_s *dmp);
|
||||
|
||||
|
||||
DM_EXPORT extern const char **dm_get_reserved_settings(dm_s *dmp); /* Will be a combination of global and dm specific reserved settings */
|
||||
DM_EXPORT extern int dm_is_reserved_setting(dm_s *dmp, const char *key);
|
||||
DM_EXPORT extern const char *dm_about_reserved_setting(dm_s *dmp, const char *key);
|
||||
DM_EXPORT extern struct bu_attribute_value_set *dm_get_settings(dm_s *dmp, const char *key);
|
||||
DM_EXPORT extern int dm_set_setting(dm_s *dmp, const char *key, const char *val);
|
||||
DM_EXPORT extern const char *dm_get_setting(dm_s *dmp, const char *key);
|
||||
|
||||
/* Object manipulators */
|
||||
DM_EXPORT extern int dm_obj_add(dm_s *dmp, const char *handle, int style_type, struct bn_vlist *vlist, struct bu_ptbl *obj_set);
|
||||
DM_EXPORT extern int dm_obj_find(dm_s *dmp, const char *handle);
|
||||
DM_EXPORT extern void dm_obj_remove(dm_s *dmp, const char *handle);
|
||||
|
||||
DM_EXPORT extern void dm_set_obj_localmat(dm_s *dmp, const char *handle, mat_t matrix);
|
||||
DM_EXPORT extern matp_t dm_get_obj_localmat(dm_s *dmp, const char *handle);
|
||||
DM_EXPORT extern void dm_set_obj_rgb(dm_s *dmp, const char *handle, unsigned char r, unsigned char g, unsigned char b);
|
||||
DM_EXPORT extern unsigned char *dm_get_obj_rgb(dm_s *dmp, const char *handle);
|
||||
DM_EXPORT extern void dm_set_obj_draw_width(dm_s *dmp, const char *handle, fastf_t draw_width);
|
||||
DM_EXPORT extern fastf_t dm_get_obj_draw_width(dm_s *dmp, const char *handle);
|
||||
DM_EXPORT extern void dm_set_obj_fontsize(dm_s *dmp, const char *handle, int fontsize);
|
||||
DM_EXPORT extern int dm_get_obj_fontsize(dm_s *dmp, const char *handle);
|
||||
DM_EXPORT extern void dm_set_obj_dirty(dm_s *dmp, const char *handle, int flag);
|
||||
DM_EXPORT extern int dm_get_obj_dirty(dm_s *dmp, const char *handle);
|
||||
DM_EXPORT extern void dm_set_obj_visible(dm_s *dmp, const char *handle, int flag);
|
||||
DM_EXPORT extern int dm_get_obj_visible(dm_s *dmp, const char *handle);
|
||||
DM_EXPORT extern void dm_set_obj_highlight(dm_s *dmp, const char *handle, int flag);
|
||||
DM_EXPORT extern int dm_get_obj_highlight(dm_s *dmp, const char *handle);
|
||||
|
||||
DM_EXPORT extern const char **dm_get_obj_reserved_settings(dm_s *dmp); /* Will be a combination of global and dm specific reserved settings */
|
||||
DM_EXPORT extern int dm_is_obj_reserved_setting(dm_s *dmp, const char *key);
|
||||
DM_EXPORT extern const char *dm_about_obj_reserved_setting(dm_s *dmp, const char *key);
|
||||
DM_EXPORT extern struct bu_attribute_value_set *dm_get_obj_settings(dm_s *dmp, const char *handle);
|
||||
DM_EXPORT extern int dm_set_obj_setting(dm_s *dmp, const char *handle, const char *key, const char *val);
|
||||
DM_EXPORT extern const char *dm_get_obj_setting(dm_s *dmp, const char *handle, const char *key);
|
||||
|
||||
/* TODO The visibility of the framebuffer is handled like any other object, but it is likely necessary
|
||||
* to expose more of the details of the object to allow libfb to work properly?*/
|
||||
/* Idle though - could an ascii raytrace (like the old GIFT output) be useful for "txt mode" debugging of raytracing? */
|
||||
DM_EXPORT extern void *dm_get_framebuffer(dm_s *dmp);
|
||||
|
||||
|
||||
#define DM_OPEN(_interp, _type, _argc, _argv) dm_open(_interp, _type, _argc, _argv)
|
||||
#define DM_CLOSE(_dmp) _dmp->dm_close(_dmp)
|
||||
#define DM_DRAW_BEGIN(_dmp) _dmp->dm_drawBegin(_dmp)
|
||||
#define DM_DRAW_END(_dmp) _dmp->dm_drawEnd(_dmp)
|
||||
#define DM_NORMAL(_dmp) _dmp->dm_normal(_dmp)
|
||||
#define DM_LOADMATRIX(_dmp, _mat, _eye) _dmp->dm_loadMatrix(_dmp, _mat, _eye)
|
||||
#define DM_LOADPMATRIX(_dmp, _mat) _dmp->dm_loadPMatrix(_dmp, _mat)
|
||||
#define DM_DRAW_STRING_2D(_dmp, _str, _x, _y, _size, _use_aspect) _dmp->dm_drawString2D(_dmp, _str, _x, _y, _size, _use_aspect)
|
||||
#define DM_DRAW_LINE_2D(_dmp, _x1, _y1, _x2, _y2) _dmp->dm_drawLine2D(_dmp, _x1, _y1, _x2, _y2)
|
||||
#define DM_DRAW_LINE_3D(_dmp, _pt1, _pt2) _dmp->dm_drawLine3D(_dmp, _pt1, _pt2)
|
||||
#define DM_DRAW_LINES_3D(_dmp, _npoints, _points, _sflag) _dmp->dm_drawLines3D(_dmp, _npoints, _points, _sflag)
|
||||
#define DM_DRAW_POINT_2D(_dmp, _x, _y) _dmp->dm_drawPoint2D(_dmp, _x, _y)
|
||||
#define DM_DRAW_POINT_3D(_dmp, _pt) _dmp->dm_drawPoint3D(_dmp, _pt)
|
||||
#define DM_DRAW_POINTS_3D(_dmp, _npoints, _points) _dmp->dm_drawPoints3D(_dmp, _npoints, _points)
|
||||
#define DM_DRAW_VLIST(_dmp, _vlist) _dmp->dm_drawVList(_dmp, _vlist)
|
||||
#define DM_DRAW_VLIST_HIDDEN_LINE(_dmp, _vlist) _dmp->dm_drawVListHiddenLine(_dmp, _vlist)
|
||||
#define DM_DRAW(_dmp, _callback, _data) _dmp->dm_draw(_dmp, _callback, _data)
|
||||
#define DM_SET_FGCOLOR(_dmp, _r, _g, _b, _strict, _transparency) _dmp->dm_setFGColor(_dmp, _r, _g, _b, _strict, _transparency)
|
||||
#define DM_SET_BGCOLOR(_dmp, _r, _g, _b) _dmp->dm_setBGColor(_dmp, _r, _g, _b)
|
||||
#define DM_SET_LINE_ATTR(_dmp, _width, _dashed) _dmp->dm_setLineAttr(_dmp, _width, _dashed)
|
||||
#define DM_CONFIGURE_WIN(_dmp, _force) _dmp->dm_configureWin((_dmp), (_force))
|
||||
#define DM_SET_WIN_BOUNDS(_dmp, _w) _dmp->dm_setWinBounds(_dmp, _w)
|
||||
#define DM_SET_LIGHT(_dmp, _on) _dmp->dm_setLight(_dmp, _on)
|
||||
#define DM_SET_TRANSPARENCY(_dmp, _on) _dmp->dm_setTransparency(_dmp, _on)
|
||||
#define DM_SET_DEPTH_MASK(_dmp, _on) _dmp->dm_setDepthMask(_dmp, _on)
|
||||
#define DM_SET_ZBUFFER(_dmp, _on) _dmp->dm_setZBuffer(_dmp, _on)
|
||||
#define DM_DEBUG(_dmp, _lvl) _dmp->dm_debug(_dmp, _lvl)
|
||||
#define DM_LOGFILE(_dmp, _lvl) _dmp->dm_logfile(_dmp, _lvl)
|
||||
#define DM_BEGINDLIST(_dmp, _list) _dmp->dm_beginDList(_dmp, _list)
|
||||
#define DM_ENDDLIST(_dmp) _dmp->dm_endDList(_dmp)
|
||||
#define DM_DRAWDLIST(_dmp, _list) _dmp->dm_drawDList(_list)
|
||||
#define DM_FREEDLISTS(_dmp, _list, _range) _dmp->dm_freeDLists(_dmp, _list, _range)
|
||||
#define DM_GEN_DLISTS(_dmp, _range) _dmp->dm_genDLists(_dmp, _range)
|
||||
#define DM_GET_DISPLAY_IMAGE(_dmp, _image) _dmp->dm_getDisplayImage(_dmp, _image)
|
||||
#define DM_MAKE_CURRENT(_dmp) _dmp->dm_makeCurrent(_dmp)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
DM_EXPORT extern struct dm dm_ogl;
|
||||
DM_EXPORT extern struct dm dm_plot;
|
||||
DM_EXPORT extern struct dm dm_ps;
|
||||
DM_EXPORT extern struct dm dm_rtgl;
|
||||
DM_EXPORT extern struct dm dm_tk;
|
||||
DM_EXPORT extern struct dm dm_wgl;
|
||||
DM_EXPORT extern struct dm dm_X;
|
||||
DM_EXPORT extern struct dm dm_txt;
|
||||
DM_EXPORT extern struct dm dm_qt;
|
||||
|
||||
DM_EXPORT extern int Dm_Init(void *interp);
|
||||
DM_EXPORT extern struct dm *dm_open(Tcl_Interp *interp,
|
||||
int type,
|
||||
int argc,
|
||||
const char *argv[]);
|
||||
DM_EXPORT extern int dm_share_dlist(struct dm *dmp1,
|
||||
struct dm *dmp2);
|
||||
DM_EXPORT extern fastf_t dm_Xx2Normal(struct dm *dmp,
|
||||
int x);
|
||||
DM_EXPORT extern int dm_Normal2Xx(struct dm *dmp,
|
||||
fastf_t f);
|
||||
DM_EXPORT extern fastf_t dm_Xy2Normal(struct dm *dmp,
|
||||
int y,
|
||||
int use_aspect);
|
||||
DM_EXPORT extern int dm_Normal2Xy(struct dm *dmp,
|
||||
fastf_t f,
|
||||
int use_aspect);
|
||||
DM_EXPORT extern void dm_fogHint(struct dm *dmp,
|
||||
int fastfog);
|
||||
DM_EXPORT extern int dm_processOptions(struct dm *dmp, struct bu_vls *init_proc_vls, int argc, char **argv);
|
||||
DM_EXPORT extern int dm_limit(int i);
|
||||
DM_EXPORT extern int dm_unlimit(int i);
|
||||
DM_EXPORT extern fastf_t dm_wrap(fastf_t f);
|
||||
|
||||
/* adc.c */
|
||||
DM_EXPORT extern void dm_draw_adc(struct dm *dmp,
|
||||
struct ged_view *gvp);
|
||||
|
||||
/* axes.c */
|
||||
DM_EXPORT extern void dm_draw_data_axes(struct dm *dmp,
|
||||
fastf_t viewSize,
|
||||
struct ged_data_axes_state *gdasp);
|
||||
|
||||
DM_EXPORT extern void dm_draw_axes(struct dm *dmp,
|
||||
fastf_t viewSize,
|
||||
const mat_t rmat,
|
||||
struct ged_axes_state *gasp);
|
||||
|
||||
/* clip.c */
|
||||
DM_EXPORT extern int clip(fastf_t *,
|
||||
fastf_t *,
|
||||
fastf_t *,
|
||||
fastf_t *);
|
||||
DM_EXPORT extern int vclip(fastf_t *,
|
||||
fastf_t *,
|
||||
fastf_t *,
|
||||
fastf_t *);
|
||||
|
||||
/* grid.c */
|
||||
DM_EXPORT extern void dm_draw_grid(struct dm *dmp,
|
||||
struct ged_grid_state *ggsp,
|
||||
struct ged_view *gvp,
|
||||
fastf_t base2local);
|
||||
|
||||
/* labels.c */
|
||||
DM_EXPORT extern int dm_draw_labels(struct dm *dmp,
|
||||
struct rt_wdb *wdbp,
|
||||
const char *name,
|
||||
mat_t viewmat,
|
||||
int *labelsColor,
|
||||
int (*labelsHook)(struct dm *dmp_arg, struct rt_wdb *wdbp_arg,
|
||||
const char *name_arg, mat_t viewmat_arg,
|
||||
int *labelsColor_arg, ClientData labelsHookClientdata_arg),
|
||||
ClientData labelsHookClientdata);
|
||||
|
||||
/* rect.c */
|
||||
DM_EXPORT extern void dm_draw_rect(struct dm *dmp,
|
||||
struct ged_rect_state *grsp);
|
||||
|
||||
/* scale.c */
|
||||
DM_EXPORT extern void dm_draw_scale(struct dm *dmp,
|
||||
fastf_t viewSize,
|
||||
int *lineColor,
|
||||
int *textColor);
|
||||
|
||||
/* vers.c */
|
||||
DM_EXPORT extern const char *dm_version(void);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/************************************************/
|
||||
/* dm-*.c macros for autogenerating common code */
|
||||
/************************************************/
|
||||
|
||||
#define HIDDEN_DM_FUNCTION_PROTOTYPES(_dmtype) \
|
||||
HIDDEN int _dmtype##_close(struct dm *dmp); \
|
||||
HIDDEN int _dmtype##_drawBegin(struct dm *dmp); \
|
||||
HIDDEN int _dmtype##_drawEnd(struct dm *dmp); \
|
||||
HIDDEN int _dmtype##_normal(struct dm *dmp); \
|
||||
HIDDEN int _dmtype##_loadMatrix(struct dm *dmp, fastf_t *mat, int which_eye); \
|
||||
HIDDEN int _dmtype##_drawString2D(struct dm *dmp, char *str, fastf_t x, fastf_t y, int size, int use_aspect); \
|
||||
HIDDEN int _dmtype##_drawLine2D(struct dm *dmp, fastf_t x_1, fastf_t y_1, fastf_t x_2, fastf_t y_2); \
|
||||
HIDDEN int _dmtype##_drawLine3D(struct dm *dmp, point_t pt1, point_t pt2); \
|
||||
HIDDEN int _dmtype##_drawLines3D(struct dm *dmp, int npoints, point_t *points, int sflag); \
|
||||
HIDDEN int _dmtype##_drawPoint2D(struct dm *dmp, fastf_t x, fastf_t y); \
|
||||
HIDDEN int _dmtype##_drawPoint3D(struct dm *dmp, point_t point); \
|
||||
HIDDEN int _dmtype##_drawPoints3D(struct dm *dmp, int npoints, point_t *points); \
|
||||
HIDDEN int _dmtype##_drawVList(struct dm *dmp, struct bn_vlist *vp); \
|
||||
HIDDEN int _dmtype##_draw(struct dm *dmp, struct bn_vlist *(*callback_function)(void *), void **data); \
|
||||
HIDDEN int _dmtype##_setFGColor(struct dm *dmp, unsigned char r, unsigned char g, unsigned char b, int strict, fastf_t transparency); \
|
||||
HIDDEN int _dmtype##_setBGColor(struct dm *dmp, unsigned char r, unsigned char g, unsigned char b); \
|
||||
HIDDEN int _dmtype##_setLineAttr(struct dm *dmp, int width, int style); \
|
||||
HIDDEN int _dmtype##_configureWin_guts(struct dm *dmp, int force); \
|
||||
HIDDEN int _dmtype##_configureWin(struct dm *dmp, int force); \
|
||||
HIDDEN int _dmtype##_setLight(struct dm *dmp, int lighting_on); \
|
||||
HIDDEN int _dmtype##_setTransparency(struct dm *dmp, int transparency_on); \
|
||||
HIDDEN int _dmtype##_setDepthMask(struct dm *dmp, int depthMask_on); \
|
||||
HIDDEN int _dmtype##_setZBuffer(struct dm *dmp, int zbuffer_on); \
|
||||
HIDDEN int _dmtype##_setWinBounds(struct dm *dmp, fastf_t *w); \
|
||||
HIDDEN int _dmtype##_debug(struct dm *dmp, int lvl); \
|
||||
HIDDEN int _dmtype##_beginDList(struct dm *dmp, unsigned int list); \
|
||||
HIDDEN int _dmtype##_endDList(struct dm *dmp); \
|
||||
HIDDEN int _dmtype##_drawDList(struct dm *dmp, unsigned int list); \
|
||||
HIDDEN int _dmtype##_freeDLists(struct dm *dmp, unsigned int list, int range); \
|
||||
HIDDEN int _dmtype##_getDisplayImage(struct dm *dmp, unsigned char **image);
|
||||
/* Display Manager / OS type aware functions */
|
||||
DM_EXPORT extern int dm_init(dm_s *dmp, int dm_t, int embedded, void *parent_info); /* TODO - probably need an actual public struct to hold parent info */
|
||||
DM_EXPORT extern int dm_close(dm_s *dmp);
|
||||
DM_EXPORT extern int dm_refresh(dm_s *dmp);
|
||||
DM_EXPORT extern void *dm_canvas(dm_s *dmp); /* Exposes the low level drawing object (X window, OpenGL context, etc.) for custom drawing */
|
||||
DM_EXPORT extern int dm_get_type(dm_s *dmp);
|
||||
DM_EXPORT extern int dm_set_type(dm_s *dmp, int dm_t);
|
||||
DM_EXPORT extern int dm_get_image(dm_s *dmp, icv_image_t *image);
|
||||
DM_EXPORT extern int dm_get_obj_image(dm_s *dmp, const char *handle, icv_image_t *image);
|
||||
|
||||
#endif /* DM_H */
|
||||
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
set(dm_headers
|
||||
defines.h
|
||||
dm-Null.h
|
||||
dm-X.h
|
||||
dm-glx.h
|
||||
dm-ogl.h
|
||||
dm-osg.h
|
||||
dm-pex.h
|
||||
dm-plot.h
|
||||
dm-ps.h
|
||||
dm-qt.h
|
||||
dm-rtgl.h
|
||||
dm-tk.h
|
||||
dm-wgl.h
|
||||
dm_xvars.h
|
||||
)
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ null_processEvents(struct dm *dmp);
|
||||
|
||||
|
||||
DM_EXPORT extern int
|
||||
null_openFb(struct dm *dmp, FBIO *ifp);
|
||||
null_openFb(struct dm *dmp, fb *ifp);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/* D M - X . H
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 1993-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @addtogroup libdm */
|
||||
/** @{ */
|
||||
/** @file dm-X.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DM_X_H
|
||||
#define DM_X_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#define CMAP_BASE 40
|
||||
#define CUBE_DIMENSION 6
|
||||
#define NUM_PIXELS 216 /* CUBE_DIMENSION * CUBE_DIMENSION * CUBE_DIMENSION */
|
||||
#define ColormapNull (Colormap *)NULL
|
||||
|
||||
struct x_vars {
|
||||
GC gc;
|
||||
Pixmap pix;
|
||||
mat_t xmat;
|
||||
int is_trueColor;
|
||||
unsigned long bd, bg, fg; /* color of border, background, foreground */
|
||||
unsigned long pixels[NUM_PIXELS];
|
||||
};
|
||||
|
||||
#endif /* DM_X_H */
|
||||
/** @} */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,87 +0,0 @@
|
||||
/* D M - G L X . H
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 1993-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @addtogroup libdm */
|
||||
/** @{ */
|
||||
/** @file dm-glx.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DM_GLX_H
|
||||
#define DM_GLX_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* Map +/-2048 GED space into -1.0..+1.0 :: x/2048*/
|
||||
#define GED2IRIS(x) (((float)(x))*0.00048828125)
|
||||
|
||||
#define Glx_MV_O(_m) offsetof(struct modifiable_glx_vars, _m)
|
||||
|
||||
struct modifiable_glx_vars {
|
||||
int cueing_on;
|
||||
int zclipping_on;
|
||||
int zbuffer_on;
|
||||
int lighting_on;
|
||||
int debug;
|
||||
int zbuf;
|
||||
int rgb;
|
||||
int doublebuffer;
|
||||
int min_scr_z; /* based on getgdesc(GD_ZMIN) */
|
||||
int max_scr_z; /* based on getgdesc(GD_ZMAX) */
|
||||
};
|
||||
|
||||
struct glx_vars {
|
||||
struct bu_list l;
|
||||
Display *dpy;
|
||||
Window win;
|
||||
Tk_Window top;
|
||||
Tk_Window xtkwin;
|
||||
int depth;
|
||||
int omx, omy;
|
||||
unsigned int mb_mask;
|
||||
Colormap cmap;
|
||||
XVisualInfo *vip;
|
||||
int devmotionnotify;
|
||||
int devbuttonpress;
|
||||
int devbuttonrelease;
|
||||
int knobs[8];
|
||||
int stereo_is_on;
|
||||
int is_gt;
|
||||
struct modifiable_glx_vars mvars;
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern void glx_clearToBlack();
|
||||
extern struct glx_vars head_glx_vars;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* DM_GLX_H */
|
||||
|
||||
/** @} */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,94 +0,0 @@
|
||||
/* D M - O G L . H
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 1993-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @addtogroup libdm */
|
||||
/** @{ */
|
||||
/** @file dm-ogl.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DM_OGL_H
|
||||
#define DM_OGL_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef HAVE_GL_GLX_H
|
||||
# include <GL/glx.h>
|
||||
#endif
|
||||
#ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#include "bu/vls.h"
|
||||
|
||||
#define CMAP_BASE 40
|
||||
|
||||
/* Map +/-2048 GED space into -1.0..+1.0 :: x/2048*/
|
||||
#define GED2IRIS(x) (((float)(x))*0.00048828125)
|
||||
|
||||
#define Ogl_MV_O(_m) offsetof(struct modifiable_ogl_vars, _m)
|
||||
|
||||
struct modifiable_ogl_vars {
|
||||
int cueing_on;
|
||||
int zclipping_on;
|
||||
int zbuffer_on;
|
||||
int lighting_on;
|
||||
int transparency_on;
|
||||
int fastfog;
|
||||
double fogdensity;
|
||||
int zbuf;
|
||||
int rgb;
|
||||
int doublebuffer;
|
||||
int depth;
|
||||
int debug;
|
||||
struct bu_vls log;
|
||||
double bound;
|
||||
int boundFlag;
|
||||
};
|
||||
|
||||
struct ogl_vars {
|
||||
GLXContext glxc;
|
||||
GLdouble faceplate_mat[16];
|
||||
int face_flag;
|
||||
int *perspective_mode;
|
||||
int fontOffset;
|
||||
int ovec; /* Old color map entry number */
|
||||
char is_direct;
|
||||
GLclampf r, g, b;
|
||||
struct modifiable_ogl_vars mvars;
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern void ogl_fogHint();
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* DM_OGL_H */
|
||||
|
||||
/** @} */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
+17
-3
@@ -31,6 +31,7 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "bu/vls.h"
|
||||
#include "dm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <iostream>
|
||||
@@ -38,9 +39,14 @@
|
||||
#include <osg/GraphicsContext>
|
||||
#include <osg/Timer>
|
||||
|
||||
#include <osgViewer/api/X11/GraphicsWindowX11>
|
||||
#if defined(DM_WIN32)
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/CompositeViewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include <osgViewer/api/Win32/GraphicsWindowWin32>
|
||||
#else
|
||||
# include <osgViewer/api/X11/GraphicsWindowX11>
|
||||
#endif
|
||||
|
||||
#include <osgText/Font>
|
||||
@@ -91,12 +97,20 @@ struct osg_vars {
|
||||
#ifdef __cplusplus
|
||||
osg::ref_ptr<osg::GraphicsContext> graphicsContext;
|
||||
osg::Timer *timer;
|
||||
osgViewer::Viewer *testviewer;
|
||||
osg::Group *osg_root;
|
||||
#endif
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern void osg_fogHint();
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void osg_fogHint(struct dm *dmp, int fastfog);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
/* D M - R T G L . H
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 1993-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @addtogroup libdm */
|
||||
/** @{ */
|
||||
/** @file dm-rtgl.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DM_RTGL_H
|
||||
#define DM_RTGL_H
|
||||
|
||||
#include "common.h"
|
||||
#include "vmath.h"
|
||||
|
||||
#ifdef HAVE_GL_GLX_H
|
||||
# include <GL/glx.h>
|
||||
#endif
|
||||
#ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
#define CMAP_BASE 40
|
||||
|
||||
/* Map +/-2048 GED space into -1.0..+1.0 :: x/2048*/
|
||||
#define GED2IRIS(x) (((float)(x))*0.00048828125)
|
||||
|
||||
#define Rtgl_MV_O(_m) offsetof(struct modifiable_rtgl_vars, _m)
|
||||
|
||||
#define RTGL_MVARS (((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars)
|
||||
#define RTGL_GEDP RTGL_MVARS.gedp
|
||||
#define RTGL_DIRTY RTGL_MVARS.needRefresh
|
||||
|
||||
struct modifiable_rtgl_vars {
|
||||
struct ged *gedp; /* used to set up ray tracing */
|
||||
int needRefresh;
|
||||
int cueing_on;
|
||||
int zclipping_on;
|
||||
int zbuffer_on;
|
||||
int lighting_on;
|
||||
int transparency_on;
|
||||
int fastfog;
|
||||
double fogdensity;
|
||||
int zbuf;
|
||||
int rgb;
|
||||
int doublebuffer;
|
||||
int depth;
|
||||
int debug;
|
||||
double bound;
|
||||
int boundFlag;
|
||||
};
|
||||
|
||||
struct rtgl_vars {
|
||||
GLXContext glxc;
|
||||
GLdouble faceplate_mat[16];
|
||||
int face_flag;
|
||||
int *perspective_mode;
|
||||
int fontOffset;
|
||||
int ovec; /* Old color map entry number */
|
||||
char is_direct;
|
||||
GLclampf r, g, b;
|
||||
struct modifiable_rtgl_vars mvars;
|
||||
};
|
||||
|
||||
extern void rtgl_fogHint();
|
||||
|
||||
#define JOB_ARRAY_SIZE 1000
|
||||
|
||||
struct job {
|
||||
point_t pt;
|
||||
vect_t dir;
|
||||
};
|
||||
|
||||
struct jobList {
|
||||
struct bu_list l;
|
||||
int used;
|
||||
struct job jobs[JOB_ARRAY_SIZE];
|
||||
};
|
||||
|
||||
#define COPY_JOB(a, b) \
|
||||
VMOVE((a).pt, (b).pt); \
|
||||
VMOVE((a).dir, (b).dir);
|
||||
|
||||
#define START_TABLE_SIZE 64
|
||||
#define KEY_LENGTH 3
|
||||
#define PT_ARRAY_SIZE 999
|
||||
|
||||
struct ptInfoList {
|
||||
struct bu_list l;
|
||||
int used;
|
||||
float points[PT_ARRAY_SIZE];
|
||||
float norms[PT_ARRAY_SIZE];
|
||||
};
|
||||
|
||||
struct colorBin {
|
||||
float color[3];
|
||||
struct ptInfoList *list;
|
||||
};
|
||||
|
||||
struct objTree {
|
||||
char *name;
|
||||
int numChildren;
|
||||
struct objTree *children;
|
||||
struct objTree *parent;
|
||||
struct ptInfoList *ptInfo;
|
||||
};
|
||||
|
||||
#define INIT_OBJTREE(p) { \
|
||||
((struct objTree *)(p))->name = NULL; \
|
||||
((struct objTree *)(p))->numChildren = 0; \
|
||||
((struct objTree *)(p))->children = NULL; \
|
||||
((struct objTree *)(p))->parent = NULL; \
|
||||
((struct objTree *)(p))->ptInfo = NULL; \
|
||||
}
|
||||
|
||||
/**
|
||||
* Structure to hold information specific to running the incremental
|
||||
* ray firings and drawing events needed for rtgl
|
||||
*/
|
||||
struct rtglJobs {
|
||||
int controlClip;
|
||||
int calls;
|
||||
int jobsDone;
|
||||
char **oldTrees;
|
||||
size_t numTrees;
|
||||
size_t treeCapacity;
|
||||
struct bu_hash_tbl *colorTable;
|
||||
struct ptInfoList *currItem;
|
||||
struct jobList *currJob;
|
||||
size_t numJobs;
|
||||
int rtglWasClosed;
|
||||
};
|
||||
|
||||
|
||||
#endif /* DM_RTGL_H */
|
||||
|
||||
/** @} */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,54 +0,0 @@
|
||||
/* D M - T K . H
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 1993-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @addtogroup libdm */
|
||||
/** @{ */
|
||||
/** @file dm-tk.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DM_TK_H
|
||||
#define DM_TK_H
|
||||
|
||||
#define CMAP_BASE 40
|
||||
#define CUBE_DIMENSION 6
|
||||
#define NUM_PIXELS 216 /* CUBE_DIMENSION * CUBE_DIMENSION * CUBE_DIMENSION */
|
||||
#define ColormapNull (Colormap *)NULL
|
||||
|
||||
struct tk_vars {
|
||||
GC gc;
|
||||
Pixmap pix;
|
||||
mat_t xmat;
|
||||
int is_trueColor;
|
||||
unsigned long bd, bg, fg; /* color of border, background, foreground */
|
||||
unsigned long pixels[NUM_PIXELS];
|
||||
};
|
||||
|
||||
#endif /* DM_TK_H */
|
||||
|
||||
/** @} */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,92 +0,0 @@
|
||||
/* D M - W G L . H
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 1993-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
|
||||
/** @addtogroup libdm */
|
||||
/** @{ */
|
||||
/** @file dm-wgl.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DM_WGL_H
|
||||
#define DM_WGL_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#include "bu/vls.h"
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define CMAP_BASE 40
|
||||
|
||||
/* Map +/-2048 GED space into -1.0..+1.0 :: x/2048*/
|
||||
#define GED2IRIS(x) (((float)(x))*0.00048828125)
|
||||
|
||||
#define Wgl_MV_O(_m) offsetof(struct modifiable_wgl_vars, _m)
|
||||
|
||||
struct modifiable_wgl_vars {
|
||||
int cueing_on;
|
||||
int zclipping_on;
|
||||
int zbuffer_on;
|
||||
int lighting_on;
|
||||
int transparency_on;
|
||||
int fastfog;
|
||||
double fogdensity;
|
||||
int zbuf;
|
||||
int rgb;
|
||||
int doublebuffer;
|
||||
int depth;
|
||||
int debug;
|
||||
struct bu_vls log;
|
||||
double bound;
|
||||
int boundFlag;
|
||||
};
|
||||
|
||||
struct wgl_vars {
|
||||
HGLRC glxc;
|
||||
GLdouble faceplate_mat[16];
|
||||
int face_flag;
|
||||
int *perspective_mode;
|
||||
int fontOffset;
|
||||
int ovec; /* Old color map entry number */
|
||||
char is_direct;
|
||||
GLclampf r, g, b;
|
||||
struct modifiable_wgl_vars mvars;
|
||||
};
|
||||
|
||||
extern void wgl_fogHint();
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* DM_WGL_H */
|
||||
|
||||
/** @} */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -26,6 +26,7 @@
|
||||
#define DM_XVARS_H
|
||||
|
||||
#include "common.h"
|
||||
#include "bio.h"
|
||||
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
# include <X11/Xlib.h>
|
||||
@@ -63,16 +64,16 @@ struct dm_xvars {
|
||||
Tk_Window xtkwin;
|
||||
int depth;
|
||||
Colormap cmap;
|
||||
#ifdef IF_WGL
|
||||
#ifdef _WIN32
|
||||
PIXELFORMATDESCRIPTOR *vip;
|
||||
HFONT fontstruct;
|
||||
HDC hdc; /* device context of device that OpenGL calls are to be drawn on */
|
||||
#endif
|
||||
#if defined(DM_X) || defined (DM_OGL) || defined (DM_RTGL)
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
XVisualInfo *vip;
|
||||
XFontStruct *fontstruct;
|
||||
#endif
|
||||
#ifdef DM_TK
|
||||
#ifdef HAVE_TK
|
||||
int tkfontset;
|
||||
Tk_Font tkfontstruct;
|
||||
#endif
|
||||
@@ -80,7 +81,6 @@ struct dm_xvars {
|
||||
int devbuttonpress;
|
||||
int devbuttonrelease;
|
||||
};
|
||||
|
||||
#endif /* DM_XVARS_H */
|
||||
/** @} */
|
||||
/*
|
||||
|
||||
+109
-119
@@ -28,10 +28,17 @@
|
||||
#ifndef FB_H
|
||||
#define FB_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <limits.h> /* For INT_MAX */
|
||||
#include <stdlib.h>
|
||||
#ifndef FB_EXPORT
|
||||
# if defined(FB_DLL_EXPORTS) && defined(FB_DLL_IMPORTS)
|
||||
# error "Only FB_DLL_EXPORTS or FB_DLL_IMPORTS can be defined, not both."
|
||||
# elif defined(FB_DLL_EXPORTS)
|
||||
# define FB_EXPORT __declspec(dllexport)
|
||||
# elif defined(FB_DLL_IMPORTS)
|
||||
# define FB_EXPORT __declspec(dllimport)
|
||||
# else
|
||||
# define FB_EXPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Needed for fd_set, avoid including sys/select.h outright since it
|
||||
@@ -47,141 +54,124 @@
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "fbio.h"
|
||||
|
||||
#include "bu/bu_tcl.h"
|
||||
#include "bu/magic.h"
|
||||
#include "bu/vls.h"
|
||||
|
||||
/* Library entry points which are macros.
|
||||
*
|
||||
* FIXME: turn these into proper functions so we can appropriately
|
||||
* avoid dereferencing a NULL _ifp or calling an invalid callback.
|
||||
/**
|
||||
* Format of disk pixels is .pix raw image files. Formerly used as
|
||||
* arguments to many of the library routines, but has fallen into
|
||||
* disuse due to the difficulties with ANSI function prototypes, and
|
||||
* the fact that arrays are not real types in C. The most notable
|
||||
* problem is that of passing a pointer to an array of RGBpixel. It
|
||||
* looks doubly dimensioned, but isn't.
|
||||
*/
|
||||
#define fb_gettype(_ifp) (_ifp->if_type)
|
||||
#define fb_getwidth(_ifp) (_ifp->if_width)
|
||||
#define fb_getheight(_ifp) (_ifp->if_height)
|
||||
#define fb_poll(_ifp) (*_ifp->if_poll)(_ifp)
|
||||
#define fb_help(_ifp) (*_ifp->if_help)(_ifp)
|
||||
#define fb_free(_ifp) (*_ifp->if_free)(_ifp)
|
||||
#define fb_clear(_ifp, _pp) (*_ifp->if_clear)(_ifp, _pp)
|
||||
#define fb_read(_ifp, _x, _y, _pp, _ct) (*_ifp->if_read)(_ifp, _x, _y, _pp, _ct)
|
||||
#define fb_write(_ifp, _x, _y, _pp, _ct) (*_ifp->if_write)(_ifp, _x, _y, _pp, _ct)
|
||||
#define fb_rmap(_ifp, _cmap) (*_ifp->if_rmap)(_ifp, _cmap)
|
||||
#define fb_wmap(_ifp, _cmap) (*_ifp->if_wmap)(_ifp, _cmap)
|
||||
#define fb_view(_ifp, _xc, _yc, _xz, _yz) (*_ifp->if_view)(_ifp, _xc, _yc, _xz, _yz)
|
||||
#define fb_getview(_ifp, _xcp, _ycp, _xzp, _yzp) (*_ifp->if_getview)(_ifp, _xcp, _ycp, _xzp, _yzp)
|
||||
#define fb_setcursor(_ifp, _bits, _xb, _yb, _xo, _yo) (*_ifp->if_setcursor)(_ifp, _bits, _xb, _yb, _xo, _yo)
|
||||
#define fb_cursor(_ifp, _mode, _x, _y) (*_ifp->if_cursor)(_ifp, _mode, _x, _y)
|
||||
#define fb_getcursor(_ifp, _modep, _xp, _yp) (*_ifp->if_getcursor)(_ifp, _modep, _xp, _yp)
|
||||
#define fb_readrect(_ifp, _xmin, _ymin, _width, _height, _pp) (*_ifp->if_readrect)(_ifp, _xmin, _ymin, _width, _height, _pp)
|
||||
#define fb_writerect(_ifp, _xmin, _ymin, _width, _height, _pp) (*_ifp->if_writerect)(_ifp, _xmin, _ymin, _width, _height, _pp)
|
||||
#define fb_bwreadrect(_ifp, _xmin, _ymin, _width, _height, _pp) (*_ifp->if_bwreadrect)(_ifp, _xmin, _ymin, _width, _height, _pp)
|
||||
#define fb_bwwriterect(_ifp, _xmin, _ymin, _width, _height, _pp) (*_ifp->if_bwwriterect)(_ifp, _xmin, _ymin, _width, _height, _pp)
|
||||
typedef unsigned char RGBpixel[3];
|
||||
|
||||
|
||||
/**
|
||||
* These generic color maps have up to 16 bits of significance,
|
||||
* left-justified in a short. Think of this as fixed-point values
|
||||
* from 0 to 1.
|
||||
*/
|
||||
/* FIXME: ColorMap is same as RLEColorMap defined in 'orle.h' */
|
||||
typedef struct {
|
||||
unsigned short cm_red[256];
|
||||
unsigned short cm_green[256];
|
||||
unsigned short cm_blue[256];
|
||||
} ColorMap;
|
||||
|
||||
|
||||
#define PIXEL_NULL (unsigned char *) 0
|
||||
#define RGBPIXEL_NULL (unsigned char *) 0
|
||||
#define COLORMAP_NULL (ColorMap *) 0
|
||||
|
||||
/* Use a typedef to hide the details of the framebuffer structure */
|
||||
typedef struct fb_internal fb;
|
||||
#define FB_NULL (fb *) 0
|
||||
|
||||
/**
|
||||
* assert the integrity of an FBIO struct.
|
||||
*/
|
||||
#define FB_CK_FB(_p) BU_CKMAG(_p, FB_MAGIC, "FB")
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Library entry points which are true functions. */
|
||||
FB_EXPORT extern void fb_configureWindow(FBIO *, int, int);
|
||||
FB_EXPORT extern FBIO *fb_open(const char *file, int _width, int _height);
|
||||
FB_EXPORT extern int fb_close(FBIO *ifp);
|
||||
FB_EXPORT extern int fb_close_existing(FBIO *ifp);
|
||||
/* Library entry points */
|
||||
|
||||
FB_EXPORT fb *fb_get();
|
||||
FB_EXPORT void fb_put(fb *ifp);
|
||||
FB_EXPORT extern char *fb_gettype(fb *ifp);
|
||||
FB_EXPORT extern int fb_get_max_width(fb *ifp);
|
||||
FB_EXPORT extern int fb_get_max_height(fb *ifp);
|
||||
FB_EXPORT extern int fb_getwidth(fb *ifp);
|
||||
FB_EXPORT extern int fb_getheight(fb *ifp);
|
||||
FB_EXPORT extern int fb_poll(fb *ifp);
|
||||
FB_EXPORT extern int fb_help(fb *ifp);
|
||||
FB_EXPORT extern int fb_free(fb *ifp);
|
||||
FB_EXPORT extern int fb_clear(fb *ifp, unsigned char *pp);
|
||||
FB_EXPORT extern ssize_t fb_read(fb *ifp, int x, int y, unsigned char *pp, size_t count);
|
||||
FB_EXPORT extern ssize_t fb_write(fb *ifp, int x, int y, const unsigned char *pp, size_t count);
|
||||
FB_EXPORT extern int fb_rmap(fb *ifp, ColorMap *cmap);
|
||||
FB_EXPORT extern int fb_wmap(fb *ifp, const ColorMap *cmap);
|
||||
FB_EXPORT extern int fb_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom);
|
||||
FB_EXPORT extern int fb_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom);
|
||||
FB_EXPORT extern int fb_setcursor(fb *ifp, const unsigned char *bits, int xb, int yb, int xo, int yo);
|
||||
FB_EXPORT extern int fb_cursor(fb *ifp, int mode, int x, int y);
|
||||
FB_EXPORT extern int fb_getcursor(fb *ifp, int *mode, int *x, int *y);
|
||||
FB_EXPORT extern int fb_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp);
|
||||
FB_EXPORT extern int fb_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp);
|
||||
FB_EXPORT extern int fb_bwreadrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp);
|
||||
FB_EXPORT extern int fb_bwwriterect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp);
|
||||
|
||||
FB_EXPORT extern void fb_configureWindow(fb *, int, int);
|
||||
FB_EXPORT extern fb *fb_open(const char *file, int _width, int _height);
|
||||
FB_EXPORT extern int fb_close(fb *ifp);
|
||||
FB_EXPORT extern int fb_close_existing(fb *ifp);
|
||||
FB_EXPORT extern int fb_genhelp(void);
|
||||
FB_EXPORT extern int fb_ioinit(FBIO *ifp);
|
||||
FB_EXPORT extern int fb_seek(FBIO *ifp, int x, int y);
|
||||
FB_EXPORT extern int fb_tell(FBIO *ifp, int *xp, int *yp);
|
||||
FB_EXPORT extern int fb_rpixel(FBIO *ifp, unsigned char *pp);
|
||||
FB_EXPORT extern int fb_wpixel(FBIO *ifp, unsigned char *pp);
|
||||
FB_EXPORT extern int fb_flush(FBIO *ifp);
|
||||
FB_EXPORT extern int fb_ioinit(fb *ifp);
|
||||
FB_EXPORT extern int fb_seek(fb *ifp, int x, int y);
|
||||
FB_EXPORT extern int fb_tell(fb *ifp, int *xp, int *yp);
|
||||
FB_EXPORT extern int fb_rpixel(fb *ifp, unsigned char *pp);
|
||||
FB_EXPORT extern int fb_wpixel(fb *ifp, unsigned char *pp);
|
||||
FB_EXPORT extern int fb_flush(fb *ifp);
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
FB_EXPORT extern void fb_log(const char *fmt, ...) _BU_ATTR_PRINTF12;
|
||||
#endif
|
||||
FB_EXPORT extern int fb_null(FBIO *ifp);
|
||||
FB_EXPORT extern int fb_null_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig);
|
||||
FB_EXPORT extern int fb_null(fb *ifp);
|
||||
FB_EXPORT extern int fb_null_setcursor(fb *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig);
|
||||
|
||||
/* utility functions */
|
||||
FB_EXPORT extern int fb_common_file_size(size_t *widthp, size_t *heightp, const char *filename, int pixel_size);
|
||||
FB_EXPORT extern int fb_common_image_size(size_t *widthp, size_t *heightp, size_t npixels);
|
||||
FB_EXPORT extern int fb_common_name_size(size_t *widthp, size_t *heightp, const char *name);
|
||||
FB_EXPORT extern int fb_write_fp(FBIO *ifp, FILE *fp, int req_width, int req_height, int crunch, int inverse, struct bu_vls *result);
|
||||
FB_EXPORT extern int fb_read_fd(FBIO *ifp, int fd, int file_width, int file_height, int file_xoff, int file_yoff, int scr_width, int scr_height, int scr_xoff, int scr_yoff, int fileinput, char *file_name, int one_line_only, int multiple_lines, int autosize, int inverse, int clear, int zoom, struct bu_vls *result);
|
||||
FB_EXPORT extern int fb_write_fp(fb *ifp, FILE *fp, int req_width, int req_height, int crunch, int inverse, struct bu_vls *result);
|
||||
FB_EXPORT extern int fb_read_fd(fb *ifp, int fd, int file_width, int file_height, int file_xoff, int file_yoff, int scr_width, int scr_height, int scr_xoff, int scr_yoff, int fileinput, char *file_name, int one_line_only, int multiple_lines, int autosize, int inverse, int clear, int zoom, struct bu_vls *result);
|
||||
|
||||
FB_EXPORT extern void fb_set_interface(fb *ifp, const char *interface_type);
|
||||
FB_EXPORT extern void fb_set_name(fb *ifp, const char *name);
|
||||
FB_EXPORT extern char *fb_get_name(fb *ifp);
|
||||
FB_EXPORT extern void fb_set_magic(fb *ifp, uint32_t magic);
|
||||
FB_EXPORT extern long fb_get_pagebuffer_pixel_size(fb *ifp);
|
||||
|
||||
FB_EXPORT extern int fb_is_set_fd(fb *ifp, fd_set *infds);
|
||||
FB_EXPORT extern int fb_set_fd(fb *ifp, fd_set *select_list);
|
||||
FB_EXPORT extern int fb_clear_fd(fb *ifp, fd_set *select_list);
|
||||
|
||||
/* color mapping */
|
||||
FB_EXPORT extern int fb_is_linear_cmap(const ColorMap *cmap);
|
||||
FB_EXPORT extern void fb_make_linear_cmap(ColorMap *cmap);
|
||||
|
||||
/* open_existing functionality. */
|
||||
struct fb_platform_specific {uint32_t magic; void *data;};
|
||||
FB_EXPORT extern int fb_open_existing(fb *ifp, struct fb_platform_specific *fb_p);
|
||||
|
||||
/* backward compatibility hacks */
|
||||
FB_EXPORT extern int fb_reset(FBIO *ifp);
|
||||
FB_EXPORT extern int fb_viewport(FBIO *ifp, int left, int top, int right, int bottom);
|
||||
FB_EXPORT extern int fb_window(FBIO *ifp, int xcenter, int ycenter);
|
||||
FB_EXPORT extern int fb_zoom(FBIO *ifp, int xzoom, int yzoom);
|
||||
FB_EXPORT extern int fb_scursor(FBIO *ifp, int mode, int x, int y);
|
||||
|
||||
/*
|
||||
* Some functions and variables we couldn't hide.
|
||||
* Not for general consumption.
|
||||
*/
|
||||
FB_EXPORT extern int _fb_disk_enable;
|
||||
FB_EXPORT extern int fb_sim_readrect(FBIO *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp);
|
||||
FB_EXPORT extern int fb_sim_writerect(FBIO *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp);
|
||||
FB_EXPORT extern int fb_sim_bwreadrect(FBIO *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp);
|
||||
FB_EXPORT extern int fb_sim_bwwriterect(FBIO *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp);
|
||||
FB_EXPORT extern int fb_sim_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom);
|
||||
FB_EXPORT extern int fb_sim_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom);
|
||||
FB_EXPORT extern int fb_sim_cursor(FBIO *ifp, int mode, int x, int y);
|
||||
FB_EXPORT extern int fb_sim_getcursor(FBIO *ifp, int *mode, int *x, int *y);
|
||||
|
||||
/* FIXME: these IF_* sections need to die. they don't belong in a public header. */
|
||||
|
||||
#ifdef IF_X
|
||||
# ifdef HAVE_X11_XLIB_H
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xutil.h>
|
||||
# endif
|
||||
FB_EXPORT extern int _X24_open_existing(FBIO *ifp, Display *dpy, Window win, Window cwinp, Colormap cmap, XVisualInfo *vip, int width, int height, GC gc);
|
||||
#endif
|
||||
|
||||
#ifdef IF_OGL
|
||||
# ifdef HAVE_X11_XLIB_H
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xutil.h>
|
||||
# endif
|
||||
/* glx.h on Mac OS X (and perhaps elsewhere) defines a slew of
|
||||
* parameter names that shadow system symbols. protect the system
|
||||
* symbols by redefining the parameters prior to header inclusion.
|
||||
*/
|
||||
# define j1 J1
|
||||
# define y1 Y1
|
||||
# define read rd
|
||||
# define index idx
|
||||
# define access acs
|
||||
# define remainder rem
|
||||
# ifdef HAVE_GL_GLX_H
|
||||
# include <GL/glx.h>
|
||||
# endif
|
||||
# undef remainder
|
||||
# undef access
|
||||
# undef index
|
||||
# undef read
|
||||
# undef y1
|
||||
# undef j1
|
||||
# ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
# endif
|
||||
FB_EXPORT extern int _ogl_open_existing(FBIO *ifp, Display *dpy, Window win, Colormap cmap, XVisualInfo *vip, int width, int height, GLXContext glxc, int double_buffer, int soft_cmap);
|
||||
#endif
|
||||
|
||||
#ifdef IF_WGL
|
||||
# include <windows.h>
|
||||
# include <tk.h>
|
||||
# ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
# endif
|
||||
FB_EXPORT extern int _wgl_open_existing(FBIO *ifp, Display *dpy, Window win, Colormap cmap, PIXELFORMATDESCRIPTOR *vip, HDC hdc, int width, int height, HGLRC glxc, int double_buffer, int soft_cmap);
|
||||
#endif
|
||||
|
||||
#ifdef IF_QT
|
||||
FB_EXPORT extern int _qt_open_existing(FBIO *ifp, int width, int height, void *qapp, void *qwin, void *qpainter, void *draw, void **qimg);
|
||||
#endif
|
||||
FB_EXPORT extern int fb_reset(fb *ifp);
|
||||
FB_EXPORT extern int fb_viewport(fb *ifp, int left, int top, int right, int bottom);
|
||||
FB_EXPORT extern int fb_window(fb *ifp, int xcenter, int ycenter);
|
||||
FB_EXPORT extern int fb_zoom(fb *ifp, int xzoom, int yzoom);
|
||||
FB_EXPORT extern int fb_scursor(fb *ifp, int mode, int x, int y);
|
||||
|
||||
/*
|
||||
* Copy one RGB pixel to another.
|
||||
@@ -200,14 +190,14 @@ FB_EXPORT extern int _qt_open_existing(FBIO *ifp, int width, int height, void *q
|
||||
/* The presence of Tcl_Interp as an arg prevents giving arg list */
|
||||
FB_EXPORT extern void fb_tcl_setup(void);
|
||||
FB_EXPORT extern int Fb_Init(Tcl_Interp *interp);
|
||||
FB_EXPORT extern int fb_refresh(FBIO *ifp, int x, int y, int w, int h);
|
||||
|
||||
FB_EXPORT extern int fb_refresh(fb *ifp, int x, int y, int w, int h);
|
||||
|
||||
/**
|
||||
* report version information about LIBFB
|
||||
*/
|
||||
FB_EXPORT extern const char *fb_version(void);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* FB_H */
|
||||
|
||||
-185
@@ -1,185 +0,0 @@
|
||||
/* F B I O . H
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2005-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @addtogroup libfb */
|
||||
/** @{ */
|
||||
/** @file fbio.h
|
||||
*
|
||||
* BRL-CAD Framebuffer Library I/O Interfaces
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FBIO_H
|
||||
#define FBIO_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "bu/magic.h"
|
||||
|
||||
#ifndef FB_EXPORT
|
||||
# if defined(FB_DLL_EXPORTS) && defined(FB_DLL_IMPORTS)
|
||||
# error "Only FB_DLL_EXPORTS or FB_DLL_IMPORTS can be defined, not both."
|
||||
# elif defined(FB_DLL_EXPORTS)
|
||||
# define FB_EXPORT __declspec(dllexport)
|
||||
# elif defined(FB_DLL_IMPORTS)
|
||||
# define FB_EXPORT __declspec(dllimport)
|
||||
# else
|
||||
# define FB_EXPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Format of disk pixels is .pix raw image files. Formerly used as
|
||||
* arguments to many of the library routines, but has fallen into
|
||||
* disuse due to the difficulties with ANSI function prototypes, and
|
||||
* the fact that arrays are not real types in C. The most notable
|
||||
* problem is that of passing a pointer to an array of RGBpixel. It
|
||||
* looks doubly dimensioned, but isn't.
|
||||
*/
|
||||
typedef unsigned char RGBpixel[3];
|
||||
|
||||
|
||||
/**
|
||||
* These generic color maps have up to 16 bits of significance,
|
||||
* left-justified in a short. Think of this as fixed-point values
|
||||
* from 0 to 1.
|
||||
*/
|
||||
/* FIXME: ColorMap is same as RLEColorMap defined in 'orle.h' */
|
||||
typedef struct {
|
||||
unsigned short cm_red[256];
|
||||
unsigned short cm_green[256];
|
||||
unsigned short cm_blue[256];
|
||||
} ColorMap;
|
||||
|
||||
|
||||
#define PIXEL_NULL (unsigned char *) 0
|
||||
#define RGBPIXEL_NULL (unsigned char *) 0
|
||||
#define COLORMAP_NULL (ColorMap *) 0
|
||||
#define FBIO_NULL (FBIO *) 0
|
||||
|
||||
|
||||
/**
|
||||
*@brief
|
||||
* A frame-buffer IO structure.
|
||||
*
|
||||
* One of these is allocated for each active framebuffer. A pointer
|
||||
* to this structure is the first argument to all the library
|
||||
* routines.
|
||||
*/
|
||||
typedef struct FBIO_ {
|
||||
uint32_t if_magic;
|
||||
/* Static information: per device TYPE. */
|
||||
int (*if_open)(struct FBIO_ *ifp, const char *file, int _width, int _height); /**< @brief open device */
|
||||
int (*if_close)(struct FBIO_ *ifp); /**< @brief close device */
|
||||
int (*if_clear)(struct FBIO_ *ifp, unsigned char *pp); /**< @brief clear device */
|
||||
ssize_t (*if_read)(struct FBIO_ *ifp, int x, int y, unsigned char *pp, size_t count); /**< @brief read pixels */
|
||||
ssize_t (*if_write)(struct FBIO_ *ifp, int x, int y, const unsigned char *pp, size_t count); /**< @brief write pixels */
|
||||
int (*if_rmap)(struct FBIO_ *ifp, ColorMap *cmap); /**< @brief read colormap */
|
||||
int (*if_wmap)(struct FBIO_ *ifp, const ColorMap *cmap); /**< @brief write colormap */
|
||||
int (*if_view)(struct FBIO_ *ifp, int xcent, int ycent, int xzoom, int yzoom); /**< @brief set view */
|
||||
int (*if_getview)(struct FBIO_ *ifp, int *xcent, int *ycent, int *xzoom, int *yzoom); /**< @brief get view */
|
||||
int (*if_setcursor)(struct FBIO_ *ifp, const unsigned char *bits, int xb, int yb, int xo, int yo); /**< @brief define cursor */
|
||||
int (*if_cursor)(struct FBIO_ *ifp, int mode, int x, int y); /**< @brief set cursor */
|
||||
int (*if_getcursor)(struct FBIO_ *ifp, int *mode, int *x, int *y); /**< @brief get cursor */
|
||||
int (*if_readrect)(struct FBIO_ *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp); /**< @brief read rectangle */
|
||||
int (*if_writerect)(struct FBIO_ *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp); /**< @brief write rectangle */
|
||||
int (*if_bwreadrect)(struct FBIO_ *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp); /**< @brief read monochrome rectangle */
|
||||
int (*if_bwwriterect)(struct FBIO_ *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp); /**< @brief write rectangle */
|
||||
int (*if_poll)(struct FBIO_ *ifp); /**< @brief handle events */
|
||||
int (*if_flush)(struct FBIO_ *ifp); /**< @brief flush output */
|
||||
int (*if_free)(struct FBIO_ *ifp); /**< @brief free resources */
|
||||
int (*if_help)(struct FBIO_ *ifp); /**< @brief print useful info */
|
||||
char *if_type; /**< @brief what "open" calls it */
|
||||
int if_max_width; /**< @brief max device width */
|
||||
int if_max_height; /**< @brief max device height */
|
||||
/* Dynamic information: per device INSTANCE. */
|
||||
char *if_name; /**< @brief what the user called it */
|
||||
int if_width; /**< @brief current values */
|
||||
int if_height;
|
||||
int if_selfd; /**< @brief select(fd) for input events if >= 0 */
|
||||
/* Internal information: needed by the library. */
|
||||
int if_fd; /**< @brief internal file descriptor */
|
||||
int if_xzoom; /**< @brief zoom factors */
|
||||
int if_yzoom;
|
||||
int if_xcenter; /**< @brief pan position */
|
||||
int if_ycenter;
|
||||
int if_cursmode; /**< @brief cursor on/off */
|
||||
int if_xcurs; /**< @brief cursor position */
|
||||
int if_ycurs;
|
||||
unsigned char *if_pbase;/**< @brief Address of malloc()ed page buffer. */
|
||||
unsigned char *if_pcurp;/**< @brief Current pointer into page buffer. */
|
||||
unsigned char *if_pendp;/**< @brief End of page buffer. */
|
||||
int if_pno; /**< @brief Current "page" in memory. */
|
||||
int if_pdirty; /**< @brief Page modified flag. */
|
||||
long if_pixcur; /**< @brief Current pixel number in framebuffer. */
|
||||
long if_ppixels; /**< @brief Sizeof page buffer (pixels). */
|
||||
int if_debug; /**< @brief Buffered IO debug flag. */
|
||||
/* State variables for individual interface modules */
|
||||
union {
|
||||
char *p;
|
||||
size_t l;
|
||||
} u1, u2, u3, u4, u5, u6;
|
||||
} FBIO;
|
||||
|
||||
/**
|
||||
* assert the integrity of an FBIO struct.
|
||||
*/
|
||||
#define FB_CK_FBIO(_p) BU_CKMAG(_p, FB_MAGIC, "FBIO")
|
||||
|
||||
/* declare all the possible interfaces */
|
||||
#ifdef IF_REMOTE
|
||||
FB_EXPORT extern FBIO remote_interface; /* not in list[] */
|
||||
#endif
|
||||
|
||||
#ifdef IF_OGL
|
||||
FB_EXPORT extern FBIO ogl_interface;
|
||||
#endif
|
||||
|
||||
#ifdef IF_WGL
|
||||
FB_EXPORT extern FBIO wgl_interface;
|
||||
#endif
|
||||
|
||||
#ifdef IF_X
|
||||
FB_EXPORT extern FBIO X24_interface;
|
||||
FB_EXPORT extern FBIO X_interface;
|
||||
#endif
|
||||
|
||||
#ifdef IF_TK
|
||||
FB_EXPORT extern FBIO tk_interface;
|
||||
#endif
|
||||
|
||||
#ifdef IF_QT
|
||||
FB_EXPORT extern FBIO qt_interface;
|
||||
#endif
|
||||
|
||||
/* Always included */
|
||||
FB_EXPORT extern FBIO debug_interface, disk_interface, stk_interface;
|
||||
FB_EXPORT extern FBIO memory_interface, null_interface;
|
||||
|
||||
#endif /* FBIO_H */
|
||||
/** @} */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ struct fbserv_client {
|
||||
|
||||
|
||||
struct fbserv_obj {
|
||||
FBIO *fbs_fbp; /**< @brief framebuffer pointer */
|
||||
fb *fbs_fbp; /**< @brief framebuffer pointer */
|
||||
Tcl_Interp *fbs_interp; /**< @brief tcl interpreter */
|
||||
struct fbserv_listener fbs_listener; /**< @brief data for listening */
|
||||
struct fbserv_client fbs_clients[MAX_CLIENTS]; /**< @brief connected clients */
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ __BEGIN_DECLS
|
||||
}
|
||||
|
||||
#define GED_CHECK_FBSERV_FBP(_gedp, _flags) \
|
||||
if (_gedp->ged_fbsp->fbs_fbp == FBIO_NULL) { \
|
||||
if (_gedp->ged_fbsp->fbs_fbp == FB_NULL) { \
|
||||
int ged_check_view_quiet = (_flags) & GED_QUIET; \
|
||||
if (!ged_check_view_quiet) { \
|
||||
bu_vls_trunc((_gedp)->ged_result_str, 0); \
|
||||
|
||||
@@ -65,7 +65,7 @@ macro(CMAKEFILES)
|
||||
# make sure the file is there. Normally attempting to ignore
|
||||
# a non-existent file is a fatal error, but these keywords
|
||||
# don't necessarily refer to files.
|
||||
set(TARGET_FLAGS SHARED STATIC OBJECT WIN32 UNKNOWN IMPORTED MODULE)
|
||||
set(TARGET_FLAGS SHARED STATIC OBJECT WIN32 MACOSX_BUNDLE UNKNOWN IMPORTED MODULE)
|
||||
foreach(TARGET_FLAG ${TARGET_FLAGS})
|
||||
if("${TARGET_FLAG}" STREQUAL "${ITEM}")
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${ITEM})
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
# - Find OpenSceneGraph
|
||||
# This module searches for the OpenSceneGraph core "osg" library as well as
|
||||
# OpenThreads, and whatever additional COMPONENTS (nodekits) that you specify.
|
||||
# See http://www.openscenegraph.org
|
||||
#
|
||||
# NOTE: To use this module effectively you must either require CMake >= 2.6.3
|
||||
# with cmake_minimum_required(VERSION 2.6.3) or download and place
|
||||
# FindOpenThreads.cmake, Findosg_functions.cmake, Findosg.cmake,
|
||||
# and Find<etc>.cmake files into your CMAKE_MODULE_PATH.
|
||||
#
|
||||
#==================================
|
||||
#
|
||||
# This module accepts the following variables (note mixed case)
|
||||
#
|
||||
# OpenSceneGraph_DEBUG - Enable debugging output
|
||||
#
|
||||
# OpenSceneGraph_MARK_AS_ADVANCED - Mark cache variables as advanced
|
||||
# automatically
|
||||
#
|
||||
# The following environment variables are also respected for finding the OSG
|
||||
# and it's various components. CMAKE_PREFIX_PATH can also be used for this
|
||||
# (see find_library() CMake documentation).
|
||||
#
|
||||
# <MODULE>_DIR (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file)
|
||||
# OSG_DIR
|
||||
# OSGDIR
|
||||
# OSG_ROOT
|
||||
#
|
||||
# [CMake 2.8.10]:
|
||||
# The CMake variable OSG_DIR can now be used as well to influence detection, instead of needing
|
||||
# to specify an environment variable.
|
||||
#
|
||||
# This module defines the following output variables:
|
||||
#
|
||||
# OPENSCENEGRAPH_FOUND - Was the OSG and all of the specified components found?
|
||||
#
|
||||
# OPENSCENEGRAPH_VERSION - The version of the OSG which was found
|
||||
#
|
||||
# OPENSCENEGRAPH_INCLUDE_DIRS - Where to find the headers
|
||||
#
|
||||
# OPENSCENEGRAPH_LIBRARIES - The OSG libraries
|
||||
#
|
||||
#==================================
|
||||
# Example Usage:
|
||||
#
|
||||
# find_package(OpenSceneGraph 2.0.0 REQUIRED osgDB osgUtil)
|
||||
# # libOpenThreads & libosg automatically searched
|
||||
# include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
|
||||
#
|
||||
# add_executable(foo foo.cc)
|
||||
# target_link_libraries(foo ${OPENSCENEGRAPH_LIBRARIES})
|
||||
#
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2001-2009 Kitware, Inc.
|
||||
# Copyright 2009-2012 Philip Lowman <philip@yhbt.com>
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||
# nor the names of their contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# The above copyright and license notice applies to distributions of
|
||||
# CMake in source and binary form. Some source files contain additional
|
||||
# notices of original copyright by their contributors; see each source
|
||||
# for details. Third-party software packages supplied with CMake under
|
||||
# compatible licenses provide their own copyright notices documented in
|
||||
# corresponding subdirectories.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Naming convention:
|
||||
# Local variables of the form _osg_foo
|
||||
# Input variables of the form OpenSceneGraph_FOO
|
||||
# Output variables of the form OPENSCENEGRAPH_FOO
|
||||
#
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
|
||||
|
||||
set(_osg_modules_to_process)
|
||||
foreach(_osg_component ${OpenSceneGraph_FIND_COMPONENTS})
|
||||
list(APPEND _osg_modules_to_process ${_osg_component})
|
||||
endforeach()
|
||||
list(APPEND _osg_modules_to_process "osg" "OpenThreads")
|
||||
list(REMOVE_DUPLICATES _osg_modules_to_process)
|
||||
|
||||
if(OpenSceneGraph_DEBUG)
|
||||
message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
|
||||
"Components = ${_osg_modules_to_process}")
|
||||
endif()
|
||||
|
||||
#
|
||||
# First we need to find and parse osg/Version
|
||||
#
|
||||
OSG_FIND_PATH(OSG osg/Version)
|
||||
if(OpenSceneGraph_MARK_AS_ADVANCED)
|
||||
OSG_MARK_AS_ADVANCED(OSG)
|
||||
endif()
|
||||
|
||||
# Try to ascertain the version...
|
||||
if(OSG_INCLUDE_DIR)
|
||||
if(OpenSceneGraph_DEBUG)
|
||||
message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
|
||||
"Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
set(_osg_Version_file "${OSG_INCLUDE_DIR}/osg/Version")
|
||||
if("${OSG_INCLUDE_DIR}" MATCHES "\\.framework$" AND NOT EXISTS "${_osg_Version_file}")
|
||||
set(_osg_Version_file "${OSG_INCLUDE_DIR}/Headers/Version")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${_osg_Version_file}")
|
||||
file(STRINGS "${_osg_Version_file}" _osg_Version_contents
|
||||
REGEX "#define (OSG_VERSION_[A-Z]+|OPENSCENEGRAPH_[A-Z]+_VERSION)[ \t]+[0-9]+")
|
||||
else()
|
||||
set(_osg_Version_contents "unknown")
|
||||
endif()
|
||||
|
||||
string(REGEX MATCH ".*#define OSG_VERSION_MAJOR[ \t]+[0-9]+.*"
|
||||
_osg_old_defines "${_osg_Version_contents}")
|
||||
string(REGEX MATCH ".*#define OPENSCENEGRAPH_MAJOR_VERSION[ \t]+[0-9]+.*"
|
||||
_osg_new_defines "${_osg_Version_contents}")
|
||||
if(_osg_old_defines)
|
||||
string(REGEX REPLACE ".*#define OSG_VERSION_MAJOR[ \t]+([0-9]+).*"
|
||||
"\\1" _osg_VERSION_MAJOR ${_osg_Version_contents})
|
||||
string(REGEX REPLACE ".*#define OSG_VERSION_MINOR[ \t]+([0-9]+).*"
|
||||
"\\1" _osg_VERSION_MINOR ${_osg_Version_contents})
|
||||
string(REGEX REPLACE ".*#define OSG_VERSION_PATCH[ \t]+([0-9]+).*"
|
||||
"\\1" _osg_VERSION_PATCH ${_osg_Version_contents})
|
||||
elseif(_osg_new_defines)
|
||||
string(REGEX REPLACE ".*#define OPENSCENEGRAPH_MAJOR_VERSION[ \t]+([0-9]+).*"
|
||||
"\\1" _osg_VERSION_MAJOR ${_osg_Version_contents})
|
||||
string(REGEX REPLACE ".*#define OPENSCENEGRAPH_MINOR_VERSION[ \t]+([0-9]+).*"
|
||||
"\\1" _osg_VERSION_MINOR ${_osg_Version_contents})
|
||||
string(REGEX REPLACE ".*#define OPENSCENEGRAPH_PATCH_VERSION[ \t]+([0-9]+).*"
|
||||
"\\1" _osg_VERSION_PATCH ${_osg_Version_contents})
|
||||
else()
|
||||
message(WARNING "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
|
||||
"Failed to parse version number, please report this as a bug")
|
||||
endif()
|
||||
unset(_osg_Version_contents)
|
||||
|
||||
set(OPENSCENEGRAPH_VERSION "${_osg_VERSION_MAJOR}.${_osg_VERSION_MINOR}.${_osg_VERSION_PATCH}"
|
||||
CACHE INTERNAL "The version of OSG which was detected")
|
||||
if(OpenSceneGraph_DEBUG)
|
||||
message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
|
||||
"Detected version ${OPENSCENEGRAPH_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(_osg_quiet)
|
||||
if(OpenSceneGraph_FIND_QUIETLY)
|
||||
set(_osg_quiet "QUIET")
|
||||
endif()
|
||||
#
|
||||
# Here we call find_package() on all of the components
|
||||
#
|
||||
foreach(_osg_module ${_osg_modules_to_process})
|
||||
if(OpenSceneGraph_DEBUG)
|
||||
message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
|
||||
"Calling find_package(${_osg_module} ${_osg_required} ${_osg_quiet})")
|
||||
endif()
|
||||
find_package(${_osg_module} ${_osg_quiet})
|
||||
|
||||
string(TOUPPER ${_osg_module} _osg_module_UC)
|
||||
list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR})
|
||||
list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES})
|
||||
|
||||
if(OpenSceneGraph_MARK_AS_ADVANCED)
|
||||
OSG_MARK_AS_ADVANCED(${_osg_module})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(OPENSCENEGRAPH_INCLUDE_DIR)
|
||||
list(REMOVE_DUPLICATES OPENSCENEGRAPH_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Check each module to see if it's found
|
||||
#
|
||||
set(_osg_component_founds)
|
||||
if(OpenSceneGraph_FIND_REQUIRED)
|
||||
foreach(_osg_module ${_osg_modules_to_process})
|
||||
string(TOUPPER ${_osg_module} _osg_module_UC)
|
||||
list(APPEND _osg_component_founds ${_osg_module_UC}_FOUND)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph
|
||||
REQUIRED_VARS OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR ${_osg_component_founds}
|
||||
VERSION_VAR OPENSCENEGRAPH_VERSION)
|
||||
|
||||
unset(_osg_component_founds)
|
||||
|
||||
set(OPENSCENEGRAPH_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIR})
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
# OpenThreads is a C++ based threading library. Its largest userbase
|
||||
# seems to OpenSceneGraph so you might notice I accept OSGDIR as an
|
||||
# environment path.
|
||||
# I consider this part of the Findosg* suite used to find OpenSceneGraph
|
||||
# components.
|
||||
# Each component is separate and you must opt in to each module.
|
||||
#
|
||||
# Locate OpenThreads
|
||||
# This module defines
|
||||
# OPENTHREADS_LIBRARY
|
||||
# OPENTHREADS_FOUND, if false, do not try to link to OpenThreads
|
||||
# OPENTHREADS_INCLUDE_DIR, where to find the headers
|
||||
#
|
||||
# $OPENTHREADS_DIR is an environment variable that would
|
||||
# correspond to the ./configure --prefix=$OPENTHREADS_DIR
|
||||
# used in building osg.
|
||||
#
|
||||
# [CMake 2.8.10]:
|
||||
# The CMake variables OPENTHREADS_DIR or OSG_DIR can now be used as well to influence
|
||||
# detection, instead of needing to specify an environment variable.
|
||||
#
|
||||
# Created by Eric Wing.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
# Copyright 2012 Philip Lowman <philip@yhbt.com>a
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||
# nor the names of their contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# The above copyright and license notice applies to distributions of
|
||||
# CMake in source and binary form. Some source files contain additional
|
||||
# notices of original copyright by their contributors; see each source
|
||||
# for details. Third-party software packages supplied with CMake under
|
||||
# compatible licenses provide their own copyright notices documented in
|
||||
# corresponding subdirectories.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
# Header files are presumed to be included like
|
||||
# #include <OpenThreads/Thread>
|
||||
|
||||
# To make it easier for one-step automated configuration/builds,
|
||||
# we leverage environmental paths. This is preferable
|
||||
# to the -DVAR=value switches because it insulates the
|
||||
# users from changes we may make in this script.
|
||||
# It also offers a little more flexibility than setting
|
||||
# the CMAKE_*_PATH since we can target specific components.
|
||||
# However, the default CMake behavior will search system paths
|
||||
# before anything else. This is problematic in the cases
|
||||
# where you have an older (stable) version installed, but
|
||||
# are trying to build a newer version.
|
||||
# CMake doesn't offer a nice way to globally control this behavior
|
||||
# so we have to do a nasty "double FIND_" in this module.
|
||||
# The first FIND disables the CMAKE_ search paths and only checks
|
||||
# the environmental paths.
|
||||
# If nothing is found, then the second find will search the
|
||||
# standard install paths.
|
||||
# Explicit -DVAR=value arguments should still be able to override everything.
|
||||
|
||||
find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
|
||||
HINTS
|
||||
ENV OPENTHREADS_INCLUDE_DIR
|
||||
ENV OPENTHREADS_DIR
|
||||
ENV OSG_INCLUDE_DIR
|
||||
ENV OSG_DIR
|
||||
ENV OSGDIR
|
||||
ENV OpenThreads_ROOT
|
||||
ENV OSG_ROOT
|
||||
${OPENTHREADS_DIR}
|
||||
${OSG_DIR}
|
||||
PATHS
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
/usr/freeware
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
|
||||
find_library(OPENTHREADS_LIBRARY
|
||||
NAMES OpenThreads OpenThreadsWin32
|
||||
HINTS
|
||||
ENV OPENTHREADS_LIBRARY_DIR
|
||||
ENV OPENTHREADS_DIR
|
||||
ENV OSG_LIBRARY_DIR
|
||||
ENV OSG_DIR
|
||||
ENV OSGDIR
|
||||
ENV OpenThreads_ROOT
|
||||
ENV OSG_ROOT
|
||||
${OPENTHREADS_DIR}
|
||||
${OSG_DIR}
|
||||
PATHS
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
/usr/freeware
|
||||
PATH_SUFFIXES lib
|
||||
)
|
||||
|
||||
find_library(OPENTHREADS_LIBRARY_DEBUG
|
||||
NAMES OpenThreadsd OpenThreadsWin32d
|
||||
HINTS
|
||||
ENV OPENTHREADS_DEBUG_LIBRARY_DIR
|
||||
ENV OPENTHREADS_LIBRARY_DIR
|
||||
ENV OPENTHREADS_DIR
|
||||
ENV OSG_LIBRARY_DIR
|
||||
ENV OSG_DIR
|
||||
ENV OSGDIR
|
||||
ENV OpenThreads_ROOT
|
||||
ENV OSG_ROOT
|
||||
${OPENTHREADS_DIR}
|
||||
${OSG_DIR}
|
||||
PATHS
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
/usr/freeware
|
||||
PATH_SUFFIXES lib
|
||||
)
|
||||
|
||||
if(OPENTHREADS_LIBRARY_DEBUG)
|
||||
set(OPENTHREADS_LIBRARIES
|
||||
optimized ${OPENTHREADS_LIBRARY}
|
||||
debug ${OPENTHREADS_LIBRARY_DEBUG})
|
||||
else()
|
||||
set(OPENTHREADS_LIBRARIES ${OPENTHREADS_LIBRARY})
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenThreads DEFAULT_MSG
|
||||
OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR)
|
||||
@@ -257,6 +257,7 @@ if(UNIX)
|
||||
X11_FIND_LIB_PATH(Xft Xft)
|
||||
X11_FIND_LIB_PATH(Xi Xi)
|
||||
X11_FIND_LIB_PATH(Xinerama Xinerama)
|
||||
X11_FIND_LIB_PATH(Xinput Xi)
|
||||
X11_FIND_LIB_PATH(Xpm Xpm)
|
||||
X11_FIND_LIB_PATH(Xrandr Xrandr)
|
||||
X11_FIND_LIB_PATH(Xrender Xrender)
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
#
|
||||
# This CMake file contains two macros to assist with searching for OSG
|
||||
# libraries and nodekits. Please see FindOpenSceneGraph.cmake for full
|
||||
# documentation.
|
||||
#
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2001-2009 Kitware, Inc.
|
||||
# Copyright 2009-2012 Philip Lowman <philip@yhbt.com>
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||
# nor the names of their contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# The above copyright and license notice applies to distributions of
|
||||
# CMake in source and binary form. Some source files contain additional
|
||||
# notices of original copyright by their contributors; see each source
|
||||
# for details. Third-party software packages supplied with CMake under
|
||||
# compatible licenses provide their own copyright notices documented in
|
||||
# corresponding subdirectories.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# OSG_FIND_PATH
|
||||
#
|
||||
function(OSG_FIND_PATH module header)
|
||||
string(TOUPPER ${module} module_uc)
|
||||
|
||||
# Try the user's environment request before anything else.
|
||||
find_path(${module_uc}_INCLUDE_DIR ${header}
|
||||
HINTS
|
||||
ENV ${module_uc}_DIR
|
||||
ENV OSG_DIR
|
||||
ENV OSGDIR
|
||||
ENV OSG_ROOT
|
||||
${${module_uc}_DIR}
|
||||
${OSG_DIR}
|
||||
PATH_SUFFIXES include
|
||||
PATHS
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
/usr/freeware
|
||||
)
|
||||
endfunction()
|
||||
|
||||
|
||||
#
|
||||
# OSG_FIND_LIBRARY
|
||||
#
|
||||
function(OSG_FIND_LIBRARY module library)
|
||||
string(TOUPPER ${module} module_uc)
|
||||
|
||||
find_library(${module_uc}_LIBRARY
|
||||
NAMES ${library}
|
||||
HINTS
|
||||
ENV ${module_uc}_DIR
|
||||
ENV OSG_DIR
|
||||
ENV OSGDIR
|
||||
ENV OSG_ROOT
|
||||
${${module_uc}_DIR}
|
||||
${OSG_DIR}
|
||||
PATH_SUFFIXES lib
|
||||
PATHS
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
/usr/freeware
|
||||
)
|
||||
|
||||
find_library(${module_uc}_LIBRARY_DEBUG
|
||||
NAMES ${library}d
|
||||
HINTS
|
||||
ENV ${module_uc}_DIR
|
||||
ENV OSG_DIR
|
||||
ENV OSGDIR
|
||||
ENV OSG_ROOT
|
||||
${${module_uc}_DIR}
|
||||
${OSG_DIR}
|
||||
PATH_SUFFIXES lib
|
||||
PATHS
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
/usr/freeware
|
||||
)
|
||||
|
||||
if(NOT ${module_uc}_LIBRARY_DEBUG)
|
||||
# They don't have a debug library
|
||||
set(${module_uc}_LIBRARY_DEBUG ${${module_uc}_LIBRARY} PARENT_SCOPE)
|
||||
set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE)
|
||||
else()
|
||||
# They really have a FOO_LIBRARY_DEBUG
|
||||
set(${module_uc}_LIBRARIES
|
||||
optimized ${${module_uc}_LIBRARY}
|
||||
debug ${${module_uc}_LIBRARY_DEBUG}
|
||||
PARENT_SCOPE
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# OSG_MARK_AS_ADVANCED
|
||||
# Just a convenience function for calling MARK_AS_ADVANCED
|
||||
#
|
||||
function(OSG_MARK_AS_ADVANCED _module)
|
||||
string(TOUPPER ${_module} _module_UC)
|
||||
mark_as_advanced(${_module_UC}_INCLUDE_DIR)
|
||||
mark_as_advanced(${_module_UC}_LIBRARY)
|
||||
mark_as_advanced(${_module_UC}_LIBRARY_DEBUG)
|
||||
endfunction()
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+1
-1
@@ -116,7 +116,7 @@ extern void brst_log(const char *, ...);
|
||||
extern int roundToInt(fastf_t f);
|
||||
|
||||
extern Colors colorids;
|
||||
extern FBIO *fbiop;
|
||||
extern fb *fbiop;
|
||||
extern FILE *burstfp;
|
||||
extern FILE *gridfp;
|
||||
extern FILE *histfp;
|
||||
|
||||
+4
-4
@@ -58,7 +58,7 @@ imageInit()
|
||||
zoom = 1;
|
||||
|
||||
/* Determine whether it is necessary to open fbfile. */
|
||||
if (fbiop == FBIO_NULL || fb_getwidth(fbiop) != devwid)
|
||||
if (fbiop == FB_NULL || fb_getwidth(fbiop) != devwid)
|
||||
needopen = 1; /* not currently open or size changed */
|
||||
else
|
||||
if (lastfbfile[0] != NUL && !BU_STR_EQUAL(fbfile, lastfbfile))
|
||||
@@ -89,7 +89,7 @@ openFbDevice(char *fbdev)
|
||||
ret = 0;
|
||||
goto safe_exit;
|
||||
}
|
||||
if (((fbiop != FBIO_NULL && fb_getwidth(fbiop) != devwid)
|
||||
if (((fbiop != FB_NULL && fb_getwidth(fbiop) != devwid)
|
||||
|| pixgrid == NULL)
|
||||
&& (pixgrid = (unsigned char *) calloc(devwid*3, sizeof(unsigned char)))
|
||||
== (unsigned char *) NULL) {
|
||||
@@ -99,7 +99,7 @@ openFbDevice(char *fbdev)
|
||||
goto safe_exit;
|
||||
}
|
||||
(void) memset((char *) pixgrid, NUL, sizeof(unsigned char)*devwid*3);
|
||||
if (fbiop != FBIO_NULL) {
|
||||
if (fbiop != FB_NULL) {
|
||||
if (! closFbDevice()) {
|
||||
ret = 0;
|
||||
goto safe_exit;
|
||||
@@ -132,7 +132,7 @@ closFbDevice()
|
||||
ret = 0;
|
||||
else {
|
||||
ret = 1;
|
||||
fbiop = FBIO_NULL;
|
||||
fbiop = FB_NULL;
|
||||
}
|
||||
notify(NULL, NOTIFY_DELETE);
|
||||
return ret;
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
|
||||
|
||||
Colors colorids; /* ident range to color mappings for plots */
|
||||
FBIO *fbiop = NULL; /* frame buffer specific access from libfb */
|
||||
fb *fbiop = NULL; /* frame buffer specific access from libfb */
|
||||
FILE *burstfp = NULL; /* input stream for burst point locations */
|
||||
FILE *gridfp = NULL; /* grid file output stream (2-d shots) */
|
||||
FILE *histfp = NULL; /* histogram output stream (statistics) */
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ static int blueflag = 0;
|
||||
static char *framebuffer = NULL;
|
||||
static char *file_name;
|
||||
static int infd;
|
||||
static FBIO *fbp;
|
||||
static fb *fbp;
|
||||
|
||||
static char usage[] = "\
|
||||
Usage: bw-fb [-a -i -c -z -R -G -B] [-F framebuffer]\n\
|
||||
|
||||
+2
-2
@@ -188,7 +188,7 @@ static int xorigin = 0, yorigin = 0; /* Pixel location of image low lft */
|
||||
static int view_flag = 0; /* The view that is of interest */
|
||||
|
||||
static long maxcells = 10000; /* Max number of cells in the image */
|
||||
static FBIO *fbiop = FBIO_NULL; /* Frame-buffer device */
|
||||
static fb *fbiop = FB_NULL; /* Frame-buffer device */
|
||||
static FILE *filep; /* Input stream */
|
||||
static struct locrec gp_locs;
|
||||
|
||||
@@ -427,7 +427,7 @@ display_Cells(long int ncells)
|
||||
|
||||
zoom = 1;
|
||||
fbiop = fb_open((fbfile[0] != '\0') ? fbfile : NULL, fb_width, fb_height);
|
||||
if (fbiop == FBIO_NULL)
|
||||
if (fbiop == FB_NULL)
|
||||
return 0;
|
||||
if (compute_fb_height || compute_fb_width) {
|
||||
bu_log("fb_size requested: %d %d\n", fb_width, fb_height);
|
||||
|
||||
+2
-2
@@ -91,7 +91,7 @@ main(int argc, char **argv)
|
||||
ColorMap cm;
|
||||
char usage[] = "Usage: cmap-fb [-H -o] [colormap]\n";
|
||||
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
FILE *fp;
|
||||
int fbsize = 512;
|
||||
int overlay = 0;
|
||||
@@ -124,7 +124,7 @@ main(int argc, char **argv)
|
||||
fprintf(stderr, "%s Program continues running:\n", usage);
|
||||
}
|
||||
|
||||
if ((fbp = fb_open(NULL, fbsize, fbsize)) == FBIO_NULL)
|
||||
if ((fbp = fb_open(NULL, fbsize, fbsize)) == FB_NULL)
|
||||
bu_exit(3, "Unable to open framebuffer\n");
|
||||
|
||||
if (overlay)
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ get_args(int argc, char **argv)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
|
||||
int x, y;
|
||||
int xin, yin; /* number of sceen output lines */
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ Usage: fb-cmap [-H] [colormap]\n";
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
FILE *fp;
|
||||
int fbsize = 512;
|
||||
int i;
|
||||
@@ -69,7 +69,7 @@ main(int argc, char **argv)
|
||||
fprintf(stderr, "%s Program continues running:\n", usage);
|
||||
}
|
||||
|
||||
if ((fbp = fb_open(NULL, fbsize, fbsize)) == FBIO_NULL)
|
||||
if ((fbp = fb_open(NULL, fbsize, fbsize)) == FB_NULL)
|
||||
bu_exit(2, "Unable to open framebuffer\n");
|
||||
|
||||
i = fb_rmap(fbp, &cm);
|
||||
|
||||
+2
-2
@@ -87,7 +87,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int y;
|
||||
FBIO *in_fbp, *out_fbp;
|
||||
fb *in_fbp, *out_fbp;
|
||||
int n, m;
|
||||
int height;
|
||||
|
||||
@@ -117,7 +117,7 @@ main(int argc, char **argv)
|
||||
if (verbose)
|
||||
fprintf(stderr, "fb-fb: width=%d height=%d\n", scr_width, scr_height);
|
||||
|
||||
if ((out_fbp = fb_open(out_fb_name, scr_width, scr_height)) == FBIO_NULL) {
|
||||
if ((out_fbp = fb_open(out_fb_name, scr_width, scr_height)) == FB_NULL) {
|
||||
if (out_fb_name)
|
||||
fprintf(stderr, "fb-fb: unable to open output '%s'\n", out_fb_name);
|
||||
bu_exit(12, NULL);
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ get_args(int argc, char **argv)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
int y;
|
||||
|
||||
unsigned char *scanline; /* 1 scanline pixel buffer */
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ main(int argc, char **argv)
|
||||
static int scanpix; /* # of pixels of scanline */
|
||||
static ColorMap cmap; /* libfb color map */
|
||||
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
int y;
|
||||
int got;
|
||||
png_structp png_p;
|
||||
|
||||
+3
-3
@@ -159,7 +159,7 @@ get_args(int argc, char **argv)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
unsigned char *scan_buf;
|
||||
int y;
|
||||
int cm_save_needed;
|
||||
@@ -176,7 +176,7 @@ main(int argc, char **argv)
|
||||
if (screen_height == 0 && file_height > 0)
|
||||
screen_height = file_height;
|
||||
|
||||
if ((fbp = fb_open(framebuffer, screen_width, screen_height)) == FBIO_NULL)
|
||||
if ((fbp = fb_open(framebuffer, screen_width, screen_height)) == FB_NULL)
|
||||
bu_exit(12, NULL);
|
||||
|
||||
/* Honor original screen size desires, if set, unless they shrank */
|
||||
@@ -256,7 +256,7 @@ main(int argc, char **argv)
|
||||
|
||||
/* Add comments to the header file, since we have one */
|
||||
if (framebuffer == (char *)0)
|
||||
framebuffer = fbp->if_name;
|
||||
framebuffer = fb_get_name(fbp);
|
||||
snprintf(comment, COMMENT_SIZE, "encoded_from=%s", framebuffer);
|
||||
rle_putcom(bu_strdup(comment), &outrle);
|
||||
now = time(0);
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ int usec;
|
||||
|
||||
void newframe(int i);
|
||||
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
int screen_width; /* Number of pixels/line in frame buffer */
|
||||
int screen_height;
|
||||
int verbose = 0;
|
||||
|
||||
+1
-1
@@ -215,7 +215,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int x, y;
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
|
||||
if (argc == 1 && isatty(fileno(stdin)) && isatty(fileno(stdout)))
|
||||
printusage();
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@
|
||||
|
||||
|
||||
static char *framebuffer = NULL;
|
||||
static FBIO *fbp;
|
||||
static fb *fbp;
|
||||
static int scr_width = 0; /* use default size */
|
||||
static int scr_height = 0;
|
||||
static int clear_and_reset = 0;
|
||||
|
||||
+1
-1
@@ -651,7 +651,7 @@ main(int argc, char **argv)
|
||||
int fudge;
|
||||
ColorMap cmap;
|
||||
ColorMap *cp = &cmap;
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
|
||||
if (argc == 1 && isatty(fileno(stdin)) && isatty(fileno(stdout)))
|
||||
usage();
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ double fps = 0.0; /* frames per second */
|
||||
int increment = 1;
|
||||
int onestep = 0;
|
||||
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
|
||||
static char usage[] = "\
|
||||
Usage: fbcmrot [-H -i increment] steps_per_second\n";
|
||||
@@ -113,7 +113,7 @@ main(int argc, char **argv)
|
||||
tv.tv_usec = (long) (((1.0 / fps) - tv.tv_sec) * 1000000);
|
||||
}
|
||||
|
||||
if ((fbp = fb_open(NULL, size, size)) == FBIO_NULL) {
|
||||
if ((fbp = fb_open(NULL, size, size)) == FB_NULL) {
|
||||
fprintf(stderr, "fbcmrot: fb_open failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ ColorMap old_map;
|
||||
ColorMap cm;
|
||||
|
||||
static char *framebuffer = NULL;
|
||||
static FBIO *fbp;
|
||||
static fb *fbp;
|
||||
static int scr_height;
|
||||
static int scr_width;
|
||||
|
||||
@@ -80,7 +80,7 @@ main(int argc, char **argv)
|
||||
bu_exit(1, NULL);
|
||||
}
|
||||
|
||||
if ((fbp = fb_open(framebuffer, scr_width, scr_height)) == FBIO_NULL) {
|
||||
if ((fbp = fb_open(framebuffer, scr_width, scr_height)) == FB_NULL) {
|
||||
fprintf(stderr, "fbcolor: fb_open(%s) failure\n", framebuffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
+6
-6
@@ -75,7 +75,7 @@ typedef int bool_t;
|
||||
static bool_t hires = 0; /* set for 1Kx1K; clear for 512x512 */
|
||||
static char *in_fb_file = NULL; /* input image name */
|
||||
static char *out_fb_file = NULL; /* output frame buffer name */
|
||||
static FBIO *fbp = FBIO_NULL; /* libfb input/output handle */
|
||||
static fb *fbp = FB_NULL; /* libfb input/output handle */
|
||||
static int src_width = 0; /* input image width */
|
||||
static int src_height = 0; /* input image height */
|
||||
static int dst_width = 0; /* output frame buffer size */
|
||||
@@ -85,7 +85,7 @@ static RGBpixel bg = { 0, 0, 0 }; /* background */
|
||||
|
||||
/* in ioutil.c */
|
||||
extern void Message(const char *format, ...);
|
||||
extern void Fatal(FBIO *fbiop, const char *format, ...);
|
||||
extern void Fatal(fb *fbiop, const char *format, ...);
|
||||
|
||||
|
||||
static void
|
||||
@@ -215,7 +215,7 @@ main(int argc, char **argv)
|
||||
|
||||
if (in_fb_file != NULL) {
|
||||
|
||||
if ((fbp = fb_open(in_fb_file, src_width, src_height)) == FBIO_NULL)
|
||||
if ((fbp = fb_open(in_fb_file, src_width, src_height)) == FB_NULL)
|
||||
Fatal(fbp, "Couldn't open input frame buffer");
|
||||
else {
|
||||
int y;
|
||||
@@ -239,7 +239,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (fb_close(fbp) == -1) {
|
||||
fbp = FBIO_NULL; /* avoid second try */
|
||||
fbp = FB_NULL; /* avoid second try */
|
||||
Fatal(fbp, "Error closing input frame buffer");
|
||||
}
|
||||
}
|
||||
@@ -253,7 +253,7 @@ main(int argc, char **argv)
|
||||
if (dst_height == 0)
|
||||
dst_height = src_height; /* default */
|
||||
|
||||
if ((fbp = fb_open(out_fb_file, dst_width, dst_height)) == FBIO_NULL)
|
||||
if ((fbp = fb_open(out_fb_file, dst_width, dst_height)) == FB_NULL)
|
||||
Fatal(fbp, "Couldn't open output frame buffer");
|
||||
else {
|
||||
int wt = fb_getwidth(fbp);
|
||||
@@ -316,7 +316,7 @@ main(int argc, char **argv)
|
||||
/* Close the frame buffer. */
|
||||
|
||||
if (fb_close(fbp) == -1) {
|
||||
fbp = FBIO_NULL; /* avoid second try */
|
||||
fbp = FB_NULL; /* avoid second try */
|
||||
Fatal(fbp, "Error closing output frame buffer");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int x;
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
int xsize, ysize;
|
||||
int len;
|
||||
char *framebuffer = (char *)NULL;
|
||||
@@ -90,7 +90,7 @@ main(int argc, char **argv)
|
||||
if (argc == 1 && isatty(fileno(stdin)) && isatty(fileno(stdout)))
|
||||
USAGE_EXIT(*argv);
|
||||
|
||||
if ((fbp = fb_open(framebuffer, xsize, ysize)) == FBIO_NULL)
|
||||
if ((fbp = fb_open(framebuffer, xsize, ysize)) == FB_NULL)
|
||||
bu_exit(1, NULL);
|
||||
|
||||
if (xsize <= 0)
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
|
||||
while ((c = bu_getopt(argc, argv, "F:h?")) != -1) {
|
||||
switch (c) {
|
||||
@@ -59,7 +59,7 @@ main(int argc, char **argv)
|
||||
fprintf(stderr, "fbfree: excess argument(s) ignored\n");
|
||||
}
|
||||
|
||||
if ((fbp = fb_open(framebuffer, 0, 0)) == FBIO_NULL) {
|
||||
if ((fbp = fb_open(framebuffer, 0, 0)) == FB_NULL) {
|
||||
fprintf(stderr, "fbfree: Can't open frame buffer\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
+16
-16
@@ -49,7 +49,7 @@ int image = 0;
|
||||
static char usage[] = "\
|
||||
Usage: fbgamma [-H -o -i] [-F framebuffer] val [gval bval]\n";
|
||||
|
||||
void mk_ramp(FBIO *fb, int r, int g, int b, int n)
|
||||
void mk_ramp(fb *fb_i, int r, int g, int b, int n)
|
||||
{
|
||||
|
||||
/* grey ramp */
|
||||
@@ -62,7 +62,7 @@ void mk_ramp(FBIO *fb, int r, int g, int b, int n)
|
||||
else line[x*3+2] = 0;
|
||||
}
|
||||
for (y=patch_height*n; y < patch_height*(n+1) && y < scr_height; ++y) {
|
||||
fb_write(fb, 0, y, line, scr_width);
|
||||
fb_write(fb_i, 0, y, line, scr_width);
|
||||
}
|
||||
|
||||
for (x=0; x < scr_width; ++x) {
|
||||
@@ -74,17 +74,17 @@ void mk_ramp(FBIO *fb, int r, int g, int b, int n)
|
||||
else line[x*3+2] = 0;
|
||||
}
|
||||
for (y=patch_height*(n+1); y < patch_height*(n+2) && y < scr_height; y += 2) {
|
||||
fb_write(fb, 0, y, altline, scr_width);
|
||||
fb_write(fb, 0, y+1, line, scr_width);
|
||||
fb_write(fb_i, 0, y, altline, scr_width);
|
||||
fb_write(fb_i, 0, y+1, line, scr_width);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void disp_image(FBIO *fb)
|
||||
void disp_image(fb *fb_i)
|
||||
{
|
||||
|
||||
scr_width = fb_getwidth(fb);
|
||||
scr_height = fb_getheight(fb);
|
||||
scr_width = fb_getwidth(fb_i);
|
||||
scr_height = fb_getheight(fb_i);
|
||||
|
||||
patch_width = scr_width / 8;
|
||||
patch_height = scr_height / 14;
|
||||
@@ -92,13 +92,13 @@ void disp_image(FBIO *fb)
|
||||
line = (unsigned char *) bu_malloc(scr_width*3, "line");
|
||||
altline = (unsigned char *) bu_calloc(scr_width*3, sizeof(unsigned char), "altline");
|
||||
|
||||
mk_ramp(fb, 1, 1, 1, 0);
|
||||
mk_ramp(fb, 1, 0, 0, 2);
|
||||
mk_ramp(fb, 1, 1, 0, 4);
|
||||
mk_ramp(fb, 0, 1, 0, 6);
|
||||
mk_ramp(fb, 0, 1, 1, 8);
|
||||
mk_ramp(fb, 0, 0, 1, 10);
|
||||
mk_ramp(fb, 1, 0, 1, 12);
|
||||
mk_ramp(fb_i, 1, 1, 1, 0);
|
||||
mk_ramp(fb_i, 1, 0, 0, 2);
|
||||
mk_ramp(fb_i, 1, 1, 0, 4);
|
||||
mk_ramp(fb_i, 0, 1, 0, 6);
|
||||
mk_ramp(fb_i, 0, 1, 1, 8);
|
||||
mk_ramp(fb_i, 0, 0, 1, 10);
|
||||
mk_ramp(fb_i, 1, 0, 1, 12);
|
||||
|
||||
(void)bu_free(line, "line");
|
||||
(void)bu_free(altline, "altline");
|
||||
@@ -115,7 +115,7 @@ main(int argc, char **argv)
|
||||
double gamr = 0, gamg = 0, gamb = 0; /* gamma's */
|
||||
double f;
|
||||
ColorMap cm;
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
|
||||
onegamma = 0;
|
||||
|
||||
@@ -152,7 +152,7 @@ main(int argc, char **argv)
|
||||
bu_exit(1, "%s", usage);
|
||||
}
|
||||
|
||||
if ((fbp = fb_open(framebuffer, fbsize, fbsize)) == FBIO_NULL) {
|
||||
if ((fbp = fb_open(framebuffer, fbsize, fbsize)) == FB_NULL) {
|
||||
bu_exit(2, "Unable to open framebuffer\n");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -101,9 +101,9 @@ do_file(void)
|
||||
void
|
||||
do_fb(void)
|
||||
{
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
|
||||
if ((fbp = fb_open(framebuffer, 0, 0)) == FBIO_NULL) {
|
||||
if ((fbp = fb_open(framebuffer, 0, 0)) == FB_NULL) {
|
||||
bu_exit(2, "Unable to open framebuffer\n");
|
||||
}
|
||||
if (fb_wmap(fbp, &map) < 0)
|
||||
|
||||
+4
-4
@@ -31,7 +31,7 @@
|
||||
#include "fb.h"
|
||||
|
||||
static unsigned char *white_line, *grey_line, *dark_line;
|
||||
static FBIO *fbp;
|
||||
static fb *fbp;
|
||||
static char *framebuffer = NULL;
|
||||
|
||||
#define OLD 0
|
||||
@@ -43,7 +43,7 @@ static int fbheight = 0;
|
||||
static int flavor = DECIMAL;
|
||||
static int clear = 0;
|
||||
|
||||
void grid(FBIO *fbiop, unsigned char *line, int spacing), oldflavor(void);
|
||||
void grid(fb *fbiop, unsigned char *line, int spacing), oldflavor(void);
|
||||
|
||||
static char usage[] = "\
|
||||
Usage: fbgrid [-c] [-b | -d | -o] [-F framebuffer]\n\
|
||||
@@ -155,7 +155,7 @@ main(int argc, char **argv)
|
||||
|
||||
|
||||
void
|
||||
grid(FBIO *fbiop, unsigned char *line, int spacing)
|
||||
grid(fb *fbiop, unsigned char *line, int spacing)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
@@ -170,7 +170,7 @@ grid(FBIO *fbiop, unsigned char *line, int spacing)
|
||||
void
|
||||
oldflavor(void)
|
||||
{
|
||||
FBIO *fbiop;
|
||||
fb *fbiop;
|
||||
int x, y;
|
||||
int middle;
|
||||
int mask;
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
|
||||
while ((c = bu_getopt(argc, argv, "F:h?")) != -1) {
|
||||
switch (c) {
|
||||
@@ -71,7 +71,7 @@ Type \"man brlcad\" for more information.\n");
|
||||
fb_genhelp();
|
||||
|
||||
printf("=============== Current Selection ================\n");
|
||||
if ((fbp = fb_open(framebuffer, 0, 0)) == FBIO_NULL) {
|
||||
if ((fbp = fb_open(framebuffer, 0, 0)) == FB_NULL) {
|
||||
fprintf(stderr, "fbhelp: Can't open frame buffer\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@
|
||||
static char *framebuffer = NULL;
|
||||
static char *font1 = NULL;
|
||||
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
|
||||
static char usage[] = "\
|
||||
Usage: fblabel [-c -a] [-F framebuffer] [-C r/g/b]\n\
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ struct stroke {
|
||||
}; /* rasterization descriptor */
|
||||
|
||||
static char *framebuffer = NULL;
|
||||
FBIO *fbp; /* Current framebuffer */
|
||||
fb *fbp; /* Current framebuffer */
|
||||
|
||||
static int screen_width = 512; /* default input width */
|
||||
static int screen_height = 512; /* default input height */
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@
|
||||
#include "fb.h"
|
||||
#include "libtermio.h"
|
||||
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
|
||||
int JumpSpeed; /* # pixels skiped with fast commands. */
|
||||
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ int fb_overlay = 0; /* plot on background, else black with grid */
|
||||
int cmap_crunch = 0; /* Plot values after passing through color map */
|
||||
int reverse = 0; /* highlight chosen line by inverting it */
|
||||
char *outframebuffer = NULL;
|
||||
FBIO *fbp, *fboutp;
|
||||
fb *fbp, *fboutp;
|
||||
ColorMap map;
|
||||
|
||||
char usage[] = "\
|
||||
|
||||
+11
-11
@@ -97,9 +97,9 @@ static float y_scale = -1.0; /* vertical scaling factor */
|
||||
static bool_t x_compress; /* set if compressing horizontally */
|
||||
static bool_t y_compress; /* set if compressing vertically */
|
||||
static char *src_file = NULL; /* source frame buffer name */
|
||||
static FBIO *src_fbp = FBIO_NULL; /* source frame buffer handle */
|
||||
static fb *src_fbp = FB_NULL; /* source frame buffer handle */
|
||||
static char *dst_file = NULL; /* destination frame buffer name */
|
||||
static FBIO *dst_fbp = FBIO_NULL; /* destination frame buffer handle */
|
||||
static fb *dst_fbp = FB_NULL; /* destination frame buffer handle */
|
||||
static int src_width = 512;
|
||||
static int src_height = 512; /* source image size */
|
||||
static int dst_width = 0;
|
||||
@@ -109,23 +109,23 @@ static unsigned char *dst_buf; /* calloc()ed output scan line buffer */
|
||||
|
||||
/* in ioutil.c */
|
||||
extern void Message(const char *format, ...);
|
||||
extern void Fatal(FBIO *fbiop, const char *format, ...);
|
||||
extern void Fatal(fb *fbiop, const char *format, ...);
|
||||
|
||||
|
||||
static void
|
||||
Stretch_Fatal(const char *str)
|
||||
{
|
||||
if (src_fbp != FBIO_NULL && fb_close(src_fbp) == -1) {
|
||||
if (src_fbp != FB_NULL && fb_close(src_fbp) == -1) {
|
||||
Message("Error closing input frame buffer");
|
||||
src_fbp = FBIO_NULL;
|
||||
src_fbp = FB_NULL;
|
||||
}
|
||||
|
||||
if (dst_fbp != FBIO_NULL && fb_close(dst_fbp) == -1) {
|
||||
if (dst_fbp != FB_NULL && fb_close(dst_fbp) == -1) {
|
||||
Message("Error closing output frame buffer");
|
||||
src_fbp = FBIO_NULL;
|
||||
src_fbp = FB_NULL;
|
||||
}
|
||||
|
||||
Fatal(FBIO_NULL, "%s", str);
|
||||
Fatal(FB_NULL, "%s", str);
|
||||
/* NOT REACHED */
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ main(int argc, char **argv)
|
||||
if ((src_fbp = fb_open(src_file == NULL ? dst_file : src_file,
|
||||
src_width, src_height
|
||||
)
|
||||
) == FBIO_NULL
|
||||
) == FB_NULL
|
||||
)
|
||||
Stretch_Fatal("Couldn't open input image");
|
||||
else {
|
||||
@@ -331,7 +331,7 @@ main(int argc, char **argv)
|
||||
)
|
||||
dst_fbp = src_fbp; /* No No No Not a Second Time */
|
||||
else if ((dst_fbp = fb_open(dst_file, dst_width, dst_height))
|
||||
== FBIO_NULL
|
||||
== FB_NULL
|
||||
)
|
||||
Stretch_Fatal("Couldn't open output frame buffer");
|
||||
|
||||
@@ -791,7 +791,7 @@ main(int argc, char **argv)
|
||||
done:
|
||||
/* Close the frame buffers. */
|
||||
|
||||
assert(src_fbp != FBIO_NULL && dst_fbp != FBIO_NULL);
|
||||
assert(src_fbp != FB_NULL && dst_fbp != FB_NULL);
|
||||
|
||||
if (fb_close(src_fbp) == -1)
|
||||
Message("Error closing input frame buffer");
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ static int scr_width = 512; /* screen size */
|
||||
static int scr_height = 512;
|
||||
static int toggle_pan = 0; /* Reverse sense of pan commands? */
|
||||
static char *framebuffer = NULL;
|
||||
static FBIO *fbp;
|
||||
static fb *fbp;
|
||||
|
||||
static char usage[] = "\
|
||||
Usage: fbzoom [-T] [-F framebuffer]\n\
|
||||
|
||||
+5
-5
@@ -89,7 +89,7 @@ static int image = 0; /* # of image to display (0 => all) */
|
||||
static char *gif_file = NULL; /* GIF file name */
|
||||
static FILE *gfp = NULL; /* GIF input stream handle */
|
||||
static char *fb_file = NULL; /* frame buffer name */
|
||||
static FBIO *fbp = FBIO_NULL; /* frame buffer handle */
|
||||
static fb *fbp = FB_NULL; /* frame buffer handle */
|
||||
static int ht; /* virtual frame buffer height */
|
||||
static int width, height; /* overall "screen" size */
|
||||
static int write_width; /* used width of screen, <= width */
|
||||
@@ -112,7 +112,7 @@ static RGBpixel *cmap; /* bu_malloc()ed local color map */
|
||||
|
||||
/* in ioutil.c */
|
||||
void Message(const char *format, ...);
|
||||
void Fatal(FBIO *fbiop, const char *format, ...);
|
||||
void Fatal(fb *fbiop, const char *format, ...);
|
||||
|
||||
|
||||
static void
|
||||
@@ -670,7 +670,7 @@ main(int argc, char **argv)
|
||||
|
||||
pixbuf = (unsigned char *)bu_malloc(width * sizeof(RGBpixel), "pixbuf");
|
||||
|
||||
if ((fbp = fb_open(fb_file, width, height)) == FBIO_NULL) {
|
||||
if ((fbp = fb_open(fb_file, width, height)) == FB_NULL) {
|
||||
Fatal(fbp, "Couldn't open frame buffer");
|
||||
}
|
||||
|
||||
@@ -738,11 +738,11 @@ main(int argc, char **argv)
|
||||
also "screen clear", but they're impractical. */
|
||||
|
||||
if (fb_close(fbp) == -1) {
|
||||
fbp = FBIO_NULL; /* avoid second try */
|
||||
fbp = FB_NULL; /* avoid second try */
|
||||
Fatal(fbp, "Error closing frame buffer");
|
||||
}
|
||||
|
||||
fbp = FBIO_NULL;
|
||||
fbp = FB_NULL;
|
||||
|
||||
if (image > 0)
|
||||
Fatal(fbp, "Specified image not found");
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ main(int argc, char **argv)
|
||||
static int lace[4] = {8, 8, 4, 2};
|
||||
static int offs[4] = {0, 4, 2, 1};
|
||||
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
FILE *fp;
|
||||
|
||||
while ((code = bu_getopt(argc, argv, "HvFh?")) != -1) {
|
||||
|
||||
+3
-3
@@ -61,7 +61,7 @@ Message(const char *format, ...)
|
||||
|
||||
|
||||
void
|
||||
Fatal(FBIO *fbp, const char *format, ...)
|
||||
Fatal(fb *fbp, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -69,9 +69,9 @@ Fatal(FBIO *fbp, const char *format, ...)
|
||||
VMessage(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (fbp != FBIO_NULL && fb_close(fbp) == -1) {
|
||||
if (fbp != FB_NULL && fb_close(fbp) == -1) {
|
||||
Message("Error closing frame buffer");
|
||||
fbp = FBIO_NULL;
|
||||
fbp = FB_NULL;
|
||||
}
|
||||
|
||||
bu_exit(EXIT_FAILURE, NULL);
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int y;
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
int xout, yout, n, m, xstart, xskip;
|
||||
|
||||
if (!get_args(argc, argv)) {
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ char *input_basename; /* basename of input file(s) */
|
||||
int framenumber = 0; /* starting frame number (default is 0) */
|
||||
int fps = 8; /* frames/second */
|
||||
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
int verbose = 0;
|
||||
int rocking = 0;
|
||||
int passes = 100; /* limit on number of passes */
|
||||
@@ -189,7 +189,7 @@ main(int argc, char **argv)
|
||||
bu_exit(12, NULL);
|
||||
}
|
||||
|
||||
if ((fbp = fb_open(NULL, screen_width, screen_height)) == FBIO_NULL) {
|
||||
if ((fbp = fb_open(NULL, screen_width, screen_height)) == FB_NULL) {
|
||||
fprintf(stderr, "pixflip-fb: fb_open failed\n");
|
||||
bu_exit(12, NULL);
|
||||
}
|
||||
|
||||
+2
-2
@@ -310,7 +310,7 @@ static int sigs[] = {
|
||||
|
||||
|
||||
static FILE *pfin; /* input file FIO block ptr */
|
||||
FBIO *fbp; /* Current framebuffer */
|
||||
fb *fbp; /* Current framebuffer */
|
||||
|
||||
|
||||
/*
|
||||
@@ -1362,7 +1362,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Open frame buffer, adapt to slightly smaller ones */
|
||||
if ((fbp = fb_open(framebuffer, Npixels, Nscanlines)) == FBIO_NULL) {
|
||||
if ((fbp = fb_open(framebuffer, Npixels, Nscanlines)) == FB_NULL) {
|
||||
fprintf(stderr, "plot3-fb: fb_open failed\n");
|
||||
bu_exit(1, NULL);
|
||||
}
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int y;
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
int i;
|
||||
int xout, yout, m, xstart;
|
||||
png_structp png_p;
|
||||
|
||||
+2
-2
@@ -382,7 +382,7 @@ main (int argc, char **argv)
|
||||
int unit_r = -1; /* Radius of unit circle (in pixels) */
|
||||
int x, y; /* Cartesian coordinates of current pixel */
|
||||
int Xprime, Yprime; /* Translated pixel */
|
||||
FBIO *fbPtr; /* Pointer to the frame-buffer file */
|
||||
fb *fbPtr; /* Pointer to the frame-buffer file */
|
||||
unsigned char *fbb; /* Buffer for current line of frame buffer */
|
||||
unsigned char *fbbPtr; /* Pointer to within fbb */
|
||||
|
||||
@@ -723,7 +723,7 @@ main (int argc, char **argv)
|
||||
arc_max *= Deg2Rad;
|
||||
|
||||
/* Prep the frame buffer */
|
||||
if ((fbPtr = fb_open(FB_Name, fb_width, fb_height)) == FBIO_NULL)
|
||||
if ((fbPtr = fb_open(FB_Name, fb_width, fb_height)) == FB_NULL)
|
||||
(void) bu_exit (1, NULL);
|
||||
fb_width = fb_getwidth(fbPtr);
|
||||
fb_height = fb_getheight(fbPtr);
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@
|
||||
#include "libtermio.h"
|
||||
|
||||
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
|
||||
char ibuf[1024]; /* pp file buffer */
|
||||
|
||||
|
||||
+2
-2
@@ -139,7 +139,7 @@ get_args(int argc, char **argv)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
FBIO *fbp;
|
||||
fb *fbp;
|
||||
int i;
|
||||
int file_width; /* unclipped width of rectangle */
|
||||
int file_skiplen; /* # of pixels to skip on l.h.s. */
|
||||
@@ -218,7 +218,7 @@ main(int argc, char **argv)
|
||||
rle_dflt_hdr.xmax -= screen_xbase;
|
||||
rle_dflt_hdr.xmin = 0;
|
||||
|
||||
if ((fbp = fb_open(framebuffer, screen_width, screen_height)) == FBIO_NULL)
|
||||
if ((fbp = fb_open(framebuffer, screen_width, screen_height)) == FB_NULL)
|
||||
bu_exit(12, NULL);
|
||||
|
||||
/* Honor original screen size desires, if set, unless they shrank */
|
||||
|
||||
+3
-3
@@ -33,7 +33,7 @@
|
||||
#include "spm.h"
|
||||
|
||||
|
||||
static FBIO *fbp;
|
||||
static fb *fbp;
|
||||
|
||||
static char *framebuffer = NULL;
|
||||
static int scr_width = 0;
|
||||
@@ -155,13 +155,13 @@ main(int argc, char **argv)
|
||||
bu_exit(1, NULL);
|
||||
}
|
||||
|
||||
if ((fbp = fb_open(framebuffer, scr_width, scr_height)) == FBIO_NULL)
|
||||
if ((fbp = fb_open(framebuffer, scr_width, scr_height)) == FB_NULL)
|
||||
bu_exit(12, NULL);
|
||||
scr_width = fb_getwidth(fbp);
|
||||
scr_height = fb_getheight(fbp);
|
||||
|
||||
mp = bn_spm_init(vsize, sizeof(RGBpixel));
|
||||
if (mp == BN_SPM_MAP_NULL || fbp == FBIO_NULL)
|
||||
if (mp == BN_SPM_MAP_NULL || fbp == FB_NULL)
|
||||
bu_exit(1, NULL);
|
||||
|
||||
bn_spm_load(mp, file_name);
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ typedef struct
|
||||
}
|
||||
Panel;
|
||||
|
||||
extern FBIO *fbp;
|
||||
extern fb *fbp;
|
||||
extern RGBpixel *menu_addr;
|
||||
extern RGBpixel paint;
|
||||
extern Point cursor_pos;
|
||||
|
||||
+4
-4
@@ -324,7 +324,7 @@ Func_Tab func_tab[] = {
|
||||
static Func_Tab *bindings[DEL+1];
|
||||
static Func_Tab *macro_entry = FT_NULL; /* Last keyboard macro defined. */
|
||||
|
||||
FBIO *fbp; /* Current framebuffer */
|
||||
fb *fbp; /* Current framebuffer */
|
||||
static int cur_width = 512;
|
||||
|
||||
int
|
||||
@@ -1721,13 +1721,13 @@ HIDDEN int
|
||||
f_Rd_Fb() /* Read frame buffer image from file. */
|
||||
{
|
||||
static char image[MAX_LN];
|
||||
static FBIO *imp;
|
||||
static fb *imp;
|
||||
if (!get_Input(image, MAX_LN, "Enter framebuffer name : "))
|
||||
return 0;
|
||||
if (image[0] == NUL) {
|
||||
fb_log("No default.\n");
|
||||
return 0;
|
||||
} else if ((imp = fb_open(image, 512, 512)) == FBIO_NULL) {
|
||||
} else if ((imp = fb_open(image, 512, 512)) == FB_NULL) {
|
||||
/* XXX */
|
||||
|
||||
fb_log( "Can't open \"%s\" for reading.\n", image);
|
||||
@@ -1873,7 +1873,7 @@ pars_Argv(int argc, char **argv)
|
||||
HIDDEN int
|
||||
fb_Setup(void)
|
||||
{
|
||||
if ((fbp = fb_open(NULL, cur_width, cur_width)) == FBIO_NULL) {
|
||||
if ((fbp = fb_open(NULL, cur_width, cur_width)) == FB_NULL) {
|
||||
fb_log("Could not open default frame buffer.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
+6
-8
@@ -80,6 +80,7 @@
|
||||
#include "bio.h"
|
||||
#include "bin.h"
|
||||
|
||||
#include "../libfb/fb_private.h" /* for _fb_disk_enable */
|
||||
#include "fb.h"
|
||||
#include "pkg.h"
|
||||
#include "bu.h"
|
||||
@@ -109,7 +110,7 @@ int verbose = 0;
|
||||
|
||||
/* from server.c */
|
||||
extern const struct pkg_switch fb_server_pkg_switch[];
|
||||
extern FBIO *fb_server_fbp;
|
||||
extern fb *fb_server_fbp;
|
||||
extern fd_set *fb_server_select_list;
|
||||
extern int *fb_server_max_fd;
|
||||
extern int fb_server_got_fb_free; /* !0 => we have received an fb_free */
|
||||
@@ -199,7 +200,7 @@ static void
|
||||
sigalarm(int UNUSED(code))
|
||||
{
|
||||
printf("alarm %s\n", fb_server_fbp ? "FBP" : "NULL");
|
||||
if ( fb_server_fbp != FBIO_NULL ) {
|
||||
if ( fb_server_fbp != FB_NULL ) {
|
||||
fb_poll(fb_server_fbp);
|
||||
}
|
||||
#ifdef SIGALRM
|
||||
@@ -341,7 +342,7 @@ main_loop(void)
|
||||
continue;
|
||||
}
|
||||
/* Handle any events from the framebuffer */
|
||||
if (fb_server_fbp && fb_server_fbp->if_selfd > 0 && FD_ISSET(fb_server_fbp->if_selfd, &infds)) {
|
||||
if (fb_is_set_fd(fb_server_fbp, &infds)) {
|
||||
fb_poll(fb_server_fbp);
|
||||
}
|
||||
|
||||
@@ -445,12 +446,9 @@ main(int argc, char **argv)
|
||||
fb_server_retain_on_close = 1; /* don't ever close the frame buffer */
|
||||
|
||||
/* open a frame buffer */
|
||||
if ( (fb_server_fbp = fb_open(framebuffer, width, height)) == FBIO_NULL )
|
||||
if ( (fb_server_fbp = fb_open(framebuffer, width, height)) == FB_NULL )
|
||||
bu_exit(1, NULL);
|
||||
if ( fb_server_fbp->if_selfd > 0 ) {
|
||||
FD_SET(fb_server_fbp->if_selfd, &select_list);
|
||||
max_fd = fb_server_fbp->if_selfd;
|
||||
}
|
||||
max_fd = fb_set_fd(fb_server_fbp, &select_list);
|
||||
|
||||
/* check/default port */
|
||||
if ( port_set ) {
|
||||
|
||||
+14
-18
@@ -49,7 +49,7 @@
|
||||
* These are the only symbols intended for export to LIBFB users.
|
||||
*/
|
||||
|
||||
FBIO *fb_server_fbp = FBIO_NULL;
|
||||
fb *fb_server_fbp = FB_NULL;
|
||||
fd_set *fb_server_select_list;
|
||||
int *fb_server_max_fd = (int *)NULL;
|
||||
int fb_server_got_fb_free = 0; /* !0 => we have received an fb_free */
|
||||
@@ -92,7 +92,7 @@ fb_server_fb_open(struct pkg_conn *pcp, char *buf)
|
||||
width = pkg_glong(&buf[0*NET_LONG_LEN]);
|
||||
height = pkg_glong(&buf[1*NET_LONG_LEN]);
|
||||
|
||||
if (fb_server_fbp == FBIO_NULL) {
|
||||
if (fb_server_fbp == FB_NULL) {
|
||||
/* Attempt to open new framebuffer */
|
||||
if (strlen(&buf[8]) == 0)
|
||||
fb_server_fbp = fb_open(NULL, width, height);
|
||||
@@ -102,24 +102,22 @@ fb_server_fb_open(struct pkg_conn *pcp, char *buf)
|
||||
/* Use existing framebuffer */
|
||||
}
|
||||
|
||||
if (fb_server_fbp == FBIO_NULL) {
|
||||
if (fb_server_fbp == FB_NULL) {
|
||||
(void)pkg_plong(&rbuf[0*NET_LONG_LEN], -1); /* ret */
|
||||
(void)pkg_plong(&rbuf[1*NET_LONG_LEN], 0);
|
||||
(void)pkg_plong(&rbuf[2*NET_LONG_LEN], 0);
|
||||
(void)pkg_plong(&rbuf[3*NET_LONG_LEN], 0);
|
||||
(void)pkg_plong(&rbuf[4*NET_LONG_LEN], 0);
|
||||
} else {
|
||||
int selfd = 0;
|
||||
(void)pkg_plong(&rbuf[0*NET_LONG_LEN], 0); /* ret */
|
||||
(void)pkg_plong(&rbuf[1*NET_LONG_LEN], fb_server_fbp->if_max_width);
|
||||
(void)pkg_plong(&rbuf[2*NET_LONG_LEN], fb_server_fbp->if_max_height);
|
||||
(void)pkg_plong(&rbuf[3*NET_LONG_LEN], fb_server_fbp->if_width);
|
||||
(void)pkg_plong(&rbuf[4*NET_LONG_LEN], fb_server_fbp->if_height);
|
||||
if (fb_server_fbp->if_selfd > 0 && fb_server_select_list) {
|
||||
FD_SET(fb_server_fbp->if_selfd, fb_server_select_list);
|
||||
if (fb_server_max_fd != NULL &&
|
||||
fb_server_fbp->if_selfd > *fb_server_max_fd)
|
||||
*fb_server_max_fd = fb_server_fbp->if_selfd;
|
||||
}
|
||||
(void)pkg_plong(&rbuf[1*NET_LONG_LEN], fb_get_max_width(fb_server_fbp));
|
||||
(void)pkg_plong(&rbuf[2*NET_LONG_LEN], fb_get_max_height(fb_server_fbp));
|
||||
(void)pkg_plong(&rbuf[3*NET_LONG_LEN], fb_getwidth(fb_server_fbp));
|
||||
(void)pkg_plong(&rbuf[4*NET_LONG_LEN], fb_getheight(fb_server_fbp));
|
||||
selfd = fb_set_fd(fb_server_fbp, fb_server_select_list);
|
||||
if (fb_server_max_fd != NULL && selfd > *fb_server_max_fd)
|
||||
*fb_server_max_fd = selfd;
|
||||
}
|
||||
|
||||
want = 5*NET_LONG_LEN;
|
||||
@@ -142,11 +140,9 @@ fb_server_fb_close(struct pkg_conn *pcp, char *buf)
|
||||
(void)fb_flush(fb_server_fbp);
|
||||
(void)pkg_plong(&rbuf[0], 0); /* return success */
|
||||
} else {
|
||||
if (fb_server_fbp->if_selfd > 0 && fb_server_select_list) {
|
||||
FD_CLR(fb_server_fbp->if_selfd, fb_server_select_list);
|
||||
}
|
||||
(void)fb_clear_fd(fb_server_fbp, fb_server_select_list);
|
||||
(void)pkg_plong(&rbuf[0], fb_close(fb_server_fbp));
|
||||
fb_server_fbp = FBIO_NULL;
|
||||
fb_server_fbp = FB_NULL;
|
||||
}
|
||||
/* Don't check for errors, SGI linger mode or other events
|
||||
* may have already closed down all the file descriptors.
|
||||
@@ -176,7 +172,7 @@ fb_server_fb_free(struct pkg_conn *pcp, char *buf)
|
||||
(void)pkg_plong(&rbuf[0], -1);
|
||||
} else {
|
||||
(void)pkg_plong(&rbuf[0], fb_free(fb_server_fbp));
|
||||
fb_server_fbp = FBIO_NULL;
|
||||
fb_server_fbp = FB_NULL;
|
||||
}
|
||||
|
||||
if (pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp) != NET_LONG_LEN)
|
||||
|
||||
@@ -987,7 +987,7 @@ f_Cursor_Module()
|
||||
(void) fb_window(fbiop, cx, cy);
|
||||
break;
|
||||
case IN :
|
||||
if (zoom <= fbiop->if_width/2) {
|
||||
if (zoom <= fb_getwidth(fbiop)/2) {
|
||||
zoom *= 2;
|
||||
cx = x;
|
||||
cy = y;
|
||||
@@ -1207,14 +1207,14 @@ f_Animate()
|
||||
return -1;
|
||||
(void) signal(SIGINT, abort_RT);
|
||||
for (frame_no = 0; ! user_interrupt; frame_no++) {
|
||||
FBIO *movie_fbiop;
|
||||
fb *movie_fbiop;
|
||||
int y;
|
||||
if (frame_no == noframes)
|
||||
frame_no = 0;
|
||||
(void) sprintf(suffixptr, ".%04d", frame_no);
|
||||
if (!bu_file_exists(movie_file, NULL))
|
||||
continue;
|
||||
if ((movie_fbiop = fb_open(movie_file, grid_sz, grid_sz)) == FBIO_NULL) {
|
||||
if ((movie_fbiop = fb_open(movie_file, grid_sz, grid_sz)) == FB_NULL) {
|
||||
(void) signal(SIGINT, norml_sig);
|
||||
close_Output_Device(0);
|
||||
return -1;
|
||||
@@ -1359,7 +1359,7 @@ f_Wrt_Fb(char **args)
|
||||
{
|
||||
int y;
|
||||
static char save_fb_file[MAX_LN] = { 0 };
|
||||
FBIO *save_fbiop;
|
||||
fb *save_fbiop;
|
||||
if (args != NULL && args[1] != NULL)
|
||||
bu_strlcpy(save_fb_file, args[1], MAX_LN);
|
||||
else
|
||||
@@ -1382,7 +1382,7 @@ f_Wrt_Fb(char **args)
|
||||
return -1;
|
||||
prnt_Event("Saving image...");
|
||||
if ((save_fbiop =
|
||||
fb_open(save_fb_file, grid_sz, grid_sz))== FBIO_NULL) {
|
||||
fb_open(save_fb_file, grid_sz, grid_sz))== FB_NULL) {
|
||||
close_Output_Device(0);
|
||||
return -1;
|
||||
}
|
||||
@@ -1421,7 +1421,7 @@ f_Rd_Fb(char **args)
|
||||
{
|
||||
int y;
|
||||
static char save_fb_file[MAX_LN] = { 0 };
|
||||
FBIO *save_fbiop;
|
||||
fb *save_fbiop;
|
||||
if (args != NULL && args[1] != NULL)
|
||||
bu_strlcpy(save_fb_file, args[1], MAX_LN);
|
||||
else
|
||||
@@ -1443,7 +1443,7 @@ f_Rd_Fb(char **args)
|
||||
return -1;
|
||||
prnt_Event("Reading saved image...");
|
||||
if ((save_fbiop =
|
||||
fb_open(save_fb_file, grid_sz, grid_sz)) == FBIO_NULL) {
|
||||
fb_open(save_fb_file, grid_sz, grid_sz)) == FB_NULL) {
|
||||
close_Output_Device(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ extern void update_Screen();
|
||||
extern void user_Interaction();
|
||||
|
||||
/* variables */
|
||||
extern FBIO *fbiop;
|
||||
extern fb *fbiop;
|
||||
|
||||
extern RGBpixel bgpixel;
|
||||
extern RGBpixel *ir_table;
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ fb_Setup(char *file, int size)
|
||||
file = "/dev/debug";
|
||||
prnt_Event( "Opening device..." );
|
||||
|
||||
if (((fbiop = fb_open(file[0] == '\0' ? NULL : file, size, size)) == FBIO_NULL) ||
|
||||
if (((fbiop = fb_open(file[0] == '\0' ? NULL : file, size, size)) == FB_NULL) ||
|
||||
(fb_ioinit( fbiop ) == -1) ||
|
||||
(fb_wmap( fbiop, COLORMAP_NULL ) == -1))
|
||||
return 0;
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
#include "./lgt.h"
|
||||
#include "./extern.h"
|
||||
#include "./tree.h"
|
||||
FBIO *fbiop = FBIO_NULL; /* Framebuffer interface ptr. */
|
||||
fb *fbiop = FB_NULL; /* Framebuffer interface ptr. */
|
||||
|
||||
/* Initialization for root of IR data base octree. */
|
||||
PtList ir_ptlist = { {0.0, 0.0, 0.0}, PTLIST_NULL };
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ ir_Chk_Table(void)
|
||||
static int
|
||||
adjust_Page(int y)
|
||||
{
|
||||
int scans_per_page = fbiop->if_ppixels/fbiop->if_width;
|
||||
int scans_per_page = fb_get_pagebuffer_pixel_size(fbiop)/fb_getwidth(fbiop);
|
||||
int newy = y - (y % scans_per_page);
|
||||
return newy;
|
||||
}
|
||||
|
||||
+1
-1
@@ -223,7 +223,7 @@ close_Output_Device(int frame)
|
||||
if ((movie.m_noframes > 1 && movie.m_fullscreen) ||
|
||||
(frame == movie.m_endframe)) {
|
||||
(void) fb_close(fbiop);
|
||||
fbiop = FBIO_NULL;
|
||||
fbiop = FB_NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-2
@@ -152,12 +152,12 @@ init_Icon_Texture(char *file, Mat_Db_Entry *entry)
|
||||
static struct fb_texture *
|
||||
init_Fb_Texture(char *file, Mat_Db_Entry *entry)
|
||||
{
|
||||
FBIO *txfbiop;
|
||||
fb *txfbiop;
|
||||
struct fb_texture *fbp;
|
||||
RGBpixel *fbmap;
|
||||
int wid = entry->df_rgb[0] << 3;
|
||||
int hgt = entry->df_rgb[1] << 3;
|
||||
if ( (txfbiop = fb_open( file, wid, hgt )) == FBIO_NULL )
|
||||
if ( (txfbiop = fb_open( file, wid, hgt )) == FB_NULL )
|
||||
return NULL;
|
||||
fbmap = (RGBpixel *) bu_malloc( wid*hgt*sizeof(RGBpixel), "fbmap" );
|
||||
#if DEBUG_TEXTURE
|
||||
|
||||
+12
-48
@@ -11,9 +11,12 @@ set(DM_INCLUDE_DIRS
|
||||
${TCL_INCLUDE_DIRS}
|
||||
${TK_INCLUDE_PATH}
|
||||
${Qt5Widgets_INCLUDE_DIRS}
|
||||
${OPENTHREADS_INCLUDE_DIR}
|
||||
${OSG_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed")
|
||||
|
||||
# local includes
|
||||
set(DM_LOCAL_INCLUDE_DIRS ${PNG_INCLUDE_DIR})
|
||||
|
||||
@@ -24,36 +27,6 @@ set(libdm_DEFINES "")
|
||||
|
||||
# Set libdm compilation definitions
|
||||
get_property(libdm_DEFINES GLOBAL PROPERTY libdm_DEFINES)
|
||||
# Add the individual OS specific files and definitions
|
||||
if(WIN32 AND BRLCAD_ENABLE_OPENGL)
|
||||
list(APPEND libdm_DEFINES DM_WGL IF_WGL)
|
||||
set(dmw32_srcs dm-wgl.c)
|
||||
endif(WIN32 AND BRLCAD_ENABLE_OPENGL)
|
||||
|
||||
if(BRLCAD_ENABLE_X11)
|
||||
set(DM_X_LIBS ${X11_LIBRARIES} ${X11_Xi_LIB})
|
||||
endif(BRLCAD_ENABLE_X11)
|
||||
|
||||
if(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_TK)
|
||||
list(APPEND libdm_DEFINES DM_X IF_X)
|
||||
set(dmx11_srcs dm-X.c)
|
||||
endif(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_TK)
|
||||
|
||||
if(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_TK)
|
||||
list(APPEND libdm_DEFINES DM_OGL IF_OGL)
|
||||
set(dmogl_srcs dm-ogl.c)
|
||||
endif(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_TK)
|
||||
|
||||
if(BRLCAD_ENABLE_RTGL)
|
||||
list(APPEND libdm_DEFINES DM_RTGL IF_RTGL)
|
||||
set(dmrtgl_srcs dm-rtgl.c)
|
||||
endif(BRLCAD_ENABLE_RTGL)
|
||||
|
||||
if(BRLCAD_ENABLE_TK AND NOT WIN32)
|
||||
list(APPEND libdm_DEFINES DM_TK IF_TK)
|
||||
set(DM_TKLIB ${TCL_TK_LIBRARY})
|
||||
set(dmtk_srcs dm-tk.c)
|
||||
endif(BRLCAD_ENABLE_TK AND NOT WIN32)
|
||||
|
||||
if(BRLCAD_ENABLE_QT)
|
||||
CHECK_CXX_FLAG(Wno-float-equal)
|
||||
@@ -67,26 +40,16 @@ if(BRLCAD_ENABLE_QT)
|
||||
endif(BRLCAD_ENABLE_QT)
|
||||
|
||||
if(BRLCAD_ENABLE_OSG)
|
||||
list(APPEND libdm_DEFINES DM_OSG)
|
||||
list(APPEND libdm_DEFINES DM_OSG IF_OSG)
|
||||
set(dmosg_srcs dm-osg.cpp)
|
||||
set(OSG_LIBRARIES
|
||||
${OSG_LIBRARY}
|
||||
${OSGTEXT_LIBRARY}
|
||||
${OSGVIEWER_LIBRARY}
|
||||
)
|
||||
set(DM_EXTRA_LIBS ${DM_EXTRA_LIBS} ${OSG_LIBRARIES})
|
||||
set(DM_EXTRA_LIBS ${DM_EXTRA_LIBS} ${OSG_LIBRARIES} ${OPENGL_LIBRARY} ${TCL_TK_LIBRARY})
|
||||
endif(BRLCAD_ENABLE_OSG)
|
||||
|
||||
|
||||
set_property(GLOBAL PROPERTY libdm_DEFINES "${libdm_DEFINES}")
|
||||
|
||||
set(LIBDM_SRCS
|
||||
${dmx11_srcs}
|
||||
${dmw32_srcs}
|
||||
${dmogl_srcs}
|
||||
${dmosg_srcs}
|
||||
${dmrtgl_srcs}
|
||||
${dmtk_srcs}
|
||||
${dmqt_srcs}
|
||||
adc.c
|
||||
axes.c
|
||||
@@ -96,7 +59,7 @@ set(LIBDM_SRCS
|
||||
dm-generic.c
|
||||
dm-plot.c
|
||||
dm-ps.c
|
||||
dm_obj.c
|
||||
dm_obj.cpp
|
||||
dm_util.c
|
||||
dm-txt.c
|
||||
grid.c
|
||||
@@ -116,15 +79,16 @@ set_target_properties(libdm PROPERTIES VERSION 20.0.1 SOVERSION 20)
|
||||
if(BRLCAD_BUILD_LOCAL_TK AND BRLCAD_ENABLE_TK)
|
||||
add_dependencies(libdm tk)
|
||||
endif(BRLCAD_BUILD_LOCAL_TK AND BRLCAD_ENABLE_TK)
|
||||
|
||||
if(BRLCAD_ENABLE_OSG)
|
||||
BRLCAD_ADDEXEC(osg-test osg-test.cpp "librt;libbu;${OSG_LIBRARIES}" NO_STRICT NO_INSTALL)
|
||||
endif(BRLCAD_ENABLE_OSG)
|
||||
|
||||
set(libdm_ignore_files
|
||||
dm-wgl.c
|
||||
dm-X.c
|
||||
dm-ogl.c
|
||||
dm-osg.cpp
|
||||
dm-qt.cpp
|
||||
dm-rtgl.c
|
||||
dm-tk.c
|
||||
osg.cpp
|
||||
osg-test.cpp
|
||||
TODO
|
||||
)
|
||||
CMAKEFILES(${libdm_ignore_files})
|
||||
|
||||
@@ -58,6 +58,10 @@ dm_draw_data_axes(struct dm *dmp,
|
||||
DM_SET_FGCOLOR(dmp, gdasp->gdas_color[0], gdasp->gdas_color[1], gdasp->gdas_color[2], 1, 1.0);
|
||||
|
||||
#if defined(IF_OGL) || defined(IF_WGL)
|
||||
# ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
# endif
|
||||
|
||||
if (gdasp->gdas_draw > 1) {
|
||||
if (dmp->dm_light)
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
+1
-1
@@ -278,7 +278,7 @@ null_makeCurrent(struct dm *UNUSED(dmp))
|
||||
|
||||
|
||||
int
|
||||
null_openFb(struct dm *UNUSED(dmp), FBIO *UNUSED(ifp))
|
||||
null_openFb(struct dm *UNUSED(dmp), fb *UNUSED(ifp))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
-1745
File diff suppressed because it is too large
Load Diff
+235
-206
@@ -34,222 +34,251 @@
|
||||
#include "vmath.h"
|
||||
#include "dm.h"
|
||||
|
||||
#include "dm/dm-Null.h"
|
||||
|
||||
extern struct dm *plot_open(Tcl_Interp *interp, int argc, const char *argv[]);
|
||||
extern struct dm *ps_open(Tcl_Interp *interp, int argc, const char *argv[]);
|
||||
extern struct dm *txt_open(Tcl_Interp *interp, int argc, const char **argv);
|
||||
|
||||
#ifdef DM_X
|
||||
# if defined(HAVE_TK)
|
||||
extern struct dm *X_open_dm();
|
||||
# endif
|
||||
#endif /* DM_X */
|
||||
|
||||
#ifdef DM_TK
|
||||
extern struct dm *tk_open_dm();
|
||||
#endif /* DM_TK */
|
||||
|
||||
#ifdef DM_OGL
|
||||
# if defined(HAVE_TK)
|
||||
extern struct dm *ogl_open();
|
||||
extern void ogl_fogHint();
|
||||
extern int ogl_share_dlist();
|
||||
# endif
|
||||
#endif /* DM_OGL */
|
||||
|
||||
#ifdef DM_OSG
|
||||
extern struct dm *osg_open();
|
||||
extern void osg_fogHint();
|
||||
extern int osg_share_dlist();
|
||||
#endif /* DM_OSG*/
|
||||
|
||||
#ifdef DM_RTGL
|
||||
extern struct dm *rtgl_open();
|
||||
extern void rtgl_fogHint();
|
||||
extern int rtgl_share_dlist();
|
||||
#endif /* DM_RTGL */
|
||||
|
||||
#ifdef DM_WGL
|
||||
extern struct dm *wgl_open();
|
||||
extern void wgl_fogHint();
|
||||
extern int wgl_share_dlist();
|
||||
#endif /* DM_WGL */
|
||||
|
||||
#ifdef DM_QT
|
||||
extern struct dm *qt_open();
|
||||
#endif /* DM_QT */
|
||||
|
||||
HIDDEN struct dm *
|
||||
null_open(Tcl_Interp *interp, int argc, const char *argv[])
|
||||
void
|
||||
dm_set_perspective(struct dm *dmp, int perspective_flag)
|
||||
{
|
||||
struct dm *dmp;
|
||||
|
||||
if (argc < 0 || !argv)
|
||||
return DM_NULL;
|
||||
|
||||
BU_ALLOC(dmp, struct dm);
|
||||
|
||||
*dmp = dm_null;
|
||||
dmp->dm_interp = interp;
|
||||
|
||||
return dmp;
|
||||
if (!dmp) return;
|
||||
dmp->perspective = perspective_flag;
|
||||
}
|
||||
|
||||
|
||||
struct dm *
|
||||
dm_open(Tcl_Interp *interp, int type, int argc, const char *argv[])
|
||||
int dm_get_perspective(struct dm *dmp)
|
||||
{
|
||||
switch (type) {
|
||||
case DM_TYPE_NULL:
|
||||
return null_open(interp, argc, argv);
|
||||
case DM_TYPE_TXT:
|
||||
return txt_open(interp, argc, argv);
|
||||
case DM_TYPE_PLOT:
|
||||
return plot_open(interp, argc, argv);
|
||||
case DM_TYPE_PS:
|
||||
return ps_open(interp, argc, argv);
|
||||
#ifdef DM_X
|
||||
# if defined(HAVE_TK)
|
||||
case DM_TYPE_X:
|
||||
return X_open_dm(interp, argc, argv);
|
||||
# endif
|
||||
#endif
|
||||
#ifdef DM_TK
|
||||
case DM_TYPE_TK:
|
||||
return tk_open_dm(interp, argc, argv);
|
||||
#endif
|
||||
#ifdef DM_OGL
|
||||
# if defined(HAVE_TK)
|
||||
case DM_TYPE_OGL:
|
||||
return ogl_open(interp, argc, argv);
|
||||
# endif
|
||||
#endif
|
||||
#ifdef DM_OSG
|
||||
case DM_TYPE_OSG:
|
||||
return osg_open(interp, argc, argv);
|
||||
#endif
|
||||
#ifdef DM_RTGL
|
||||
case DM_TYPE_RTGL:
|
||||
return rtgl_open(interp, argc, argv);
|
||||
#endif
|
||||
#ifdef DM_WGL
|
||||
case DM_TYPE_WGL:
|
||||
return wgl_open(interp, argc, argv);
|
||||
#endif
|
||||
#ifdef DM_QT
|
||||
case DM_TYPE_QT:
|
||||
return qt_open(interp, argc, argv);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return DM_NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Provides a way to (un)share display lists. If dmp2 is
|
||||
* NULL, then dmp1 will no longer share its display lists.
|
||||
*/
|
||||
int
|
||||
dm_share_dlist(struct dm *dmp1, struct dm *dmp2)
|
||||
{
|
||||
if (dmp1 == DM_NULL)
|
||||
return TCL_ERROR;
|
||||
|
||||
/*
|
||||
* Only display managers of the same type and using the
|
||||
* same OGL server are allowed to share display lists.
|
||||
*
|
||||
* XXX - need a better way to check if using the same OGL server.
|
||||
*/
|
||||
if (dmp2 != DM_NULL)
|
||||
if (dmp1->dm_type != dmp2->dm_type ||
|
||||
bu_vls_strcmp(&dmp1->dm_dName, &dmp2->dm_dName))
|
||||
return TCL_ERROR;
|
||||
|
||||
switch (dmp1->dm_type) {
|
||||
#ifdef DM_OGL
|
||||
# if defined(HAVE_TK)
|
||||
case DM_TYPE_OGL:
|
||||
return ogl_share_dlist(dmp1, dmp2);
|
||||
# endif
|
||||
#endif
|
||||
#ifdef DM_RTGL
|
||||
case DM_TYPE_RTGL:
|
||||
return rtgl_share_dlist(dmp1, dmp2);
|
||||
#endif
|
||||
#ifdef DM_WGL
|
||||
case DM_TYPE_WGL:
|
||||
return wgl_share_dlist(dmp1, dmp2);
|
||||
#endif
|
||||
default:
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
fastf_t
|
||||
dm_Xx2Normal(struct dm *dmp, int x)
|
||||
{
|
||||
return ((x / (fastf_t)dmp->dm_width - 0.5) * 2.0);
|
||||
}
|
||||
|
||||
int
|
||||
dm_Normal2Xx(struct dm *dmp, fastf_t f)
|
||||
{
|
||||
return (f * 0.5 + 0.5) * dmp->dm_width;
|
||||
}
|
||||
|
||||
fastf_t
|
||||
dm_Xy2Normal(struct dm *dmp, int y, int use_aspect)
|
||||
{
|
||||
if (use_aspect)
|
||||
return ((0.5 - y / (fastf_t)dmp->dm_height) / dmp->dm_aspect * 2.0);
|
||||
else
|
||||
return ((0.5 - y / (fastf_t)dmp->dm_height) * 2.0);
|
||||
}
|
||||
|
||||
int
|
||||
dm_Normal2Xy(struct dm *dmp, fastf_t f, int use_aspect)
|
||||
{
|
||||
if (use_aspect)
|
||||
return (0.5 - f * 0.5 * dmp->dm_aspect) * dmp->dm_height;
|
||||
else
|
||||
return (0.5 - f * 0.5) * dmp->dm_height;
|
||||
return dmp->perspective;
|
||||
}
|
||||
|
||||
void
|
||||
dm_fogHint(struct dm *dmp, int fastfog)
|
||||
dm_set_width(struct dm *dmp, int width)
|
||||
{
|
||||
if (!dmp) {
|
||||
bu_log("WARNING: NULL display (fastfog => %d)\n", fastfog);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (dmp->dm_type) {
|
||||
#ifdef DM_OGL
|
||||
# if defined(HAVE_TK)
|
||||
case DM_TYPE_OGL:
|
||||
ogl_fogHint(dmp, fastfog);
|
||||
return;
|
||||
# endif
|
||||
#endif
|
||||
#ifdef DM_RTGL
|
||||
case DM_TYPE_RTGL:
|
||||
rtgl_fogHint(dmp, fastfog);
|
||||
return;
|
||||
#endif
|
||||
#ifdef DM_WGL
|
||||
case DM_TYPE_WGL:
|
||||
wgl_fogHint(dmp, fastfog);
|
||||
return;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (!dmp) return;
|
||||
dmp->with = width;
|
||||
}
|
||||
|
||||
int dm_get_width(struct dm *dmp)
|
||||
{
|
||||
return dmp->width;
|
||||
}
|
||||
|
||||
void
|
||||
dm_set_height(struct dm *dmp, int height)
|
||||
{
|
||||
if (!dmp) return;
|
||||
dmp->with = height;
|
||||
}
|
||||
|
||||
int dm_get_height(struct dm *dmp)
|
||||
{
|
||||
return dmp->height;
|
||||
}
|
||||
|
||||
void
|
||||
dm_set_proj_matrix(struct dm *dmp, mat_t pmat)
|
||||
{
|
||||
if (!dmp) return;
|
||||
MAT_COPY(dmp->proj_matrix, pmat);
|
||||
}
|
||||
|
||||
matp_t dm_get_proj_mat(struct dm *dmp)
|
||||
{
|
||||
return &(dmp->proj_matrix);
|
||||
}
|
||||
|
||||
void
|
||||
dm_set_view_matrix(struct dm *dmp, mat_t vmat)
|
||||
{
|
||||
if (!dmp) return;
|
||||
MAT_COPY(dmp->view_matrix, vmat);
|
||||
}
|
||||
|
||||
matp_t dm_get_view_mat(struct dm *dmp)
|
||||
{
|
||||
return &(dmp->view_matrix);
|
||||
}
|
||||
|
||||
void
|
||||
dm_set_background_rgb(struct dm *dmp, unsigned char r, unsigned char g, unsigned char b)
|
||||
{
|
||||
if (!dmp) return;
|
||||
dmp->dm_bg[0] = r;
|
||||
dmp->dm_bg[1] = g;
|
||||
dmp->dm_bg[2] = b;
|
||||
}
|
||||
|
||||
unsigned char *dm_get_background_rgb(struct dm *dmp)
|
||||
{
|
||||
return dmp->dm_bg;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dm_set_foreground_rgb(struct dm *dmp, unsigned char r, unsigned char g, unsigned char b)
|
||||
{
|
||||
if (!dmp) return;
|
||||
dmp->dm_fg[0] = r;
|
||||
dmp->dm_fg[1] = g;
|
||||
dmp->dm_fg[2] = b;
|
||||
}
|
||||
|
||||
unsigned char *dm_get_foreground_rgb(struct dm *dmp)
|
||||
{
|
||||
return dmp->dm_fg;
|
||||
}
|
||||
|
||||
void
|
||||
dm_set_default_draw_width(struct dm *dmp, fastf_t draw_width)
|
||||
{
|
||||
if (!dmp) return;
|
||||
dmp->draw_width = draw_width;
|
||||
}
|
||||
|
||||
fastf_t dm_get_default_draw_width(struct dm *dmp)
|
||||
{
|
||||
return dmp->draw_width;
|
||||
}
|
||||
|
||||
void
|
||||
dm_set_default_fontsize(struct dm *dmp, int fontsize)
|
||||
{
|
||||
if (!dmp) return;
|
||||
dmp->fontsize= fontsize;
|
||||
}
|
||||
|
||||
fastf_t dm_get_default_fontsize(struct dm *dmp)
|
||||
{
|
||||
return dmp->fontsize;
|
||||
}
|
||||
|
||||
struct bu_attribute_value_set *
|
||||
dm_get_settings(struct dm *dmp)
|
||||
{
|
||||
if (!dmp) return NULL;
|
||||
return dmp->dm_extra_settings;
|
||||
}
|
||||
|
||||
int
|
||||
dm_set_setting(struct dm *dmp, const char *key, const char *val)
|
||||
{
|
||||
if (!dmp) return -1;
|
||||
if !(dmp->dm_extra_settings) return -1;
|
||||
|
||||
if (!bu_avs_get(dmp->dm_extra_settings, key)) return -1;
|
||||
|
||||
return !bu_avs_add(dmp->dm_extra_settings, key, val);
|
||||
}
|
||||
|
||||
const char *
|
||||
dm_get_setting(struct dm *dmp, const char *key, const char *val)
|
||||
{
|
||||
if (!dmp) return -1;
|
||||
if !(dmp->dm_extra_settings) return -1;
|
||||
|
||||
return bu_avs_get(dmp->dm_extra_settings, key);
|
||||
}
|
||||
|
||||
|
||||
struct dm_display_list *
|
||||
dm_obj_add(struct dm *dmp, const char *handle, int style_type, struct bn_vlist *vlist, struct bu_ptbl *obj_set)
|
||||
{
|
||||
}
|
||||
|
||||
struct dm_display_list *
|
||||
dm_obj_find(struct dm *dmp, const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
dm_obj_remove(struct dm *dmp, const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dm_set_obj_localmat(struct dm *dmp, const char *handle, mat_t matrix)
|
||||
{
|
||||
}
|
||||
|
||||
matp_t
|
||||
dm_get_obj_localmat(struct dm *dmp, const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
dm_set_obj_rgb(struct dm *dmp, const char *handle, unsigned char r, unsigned char g, unsigned char b)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned char *
|
||||
dm_get_obj_rgb(struct dm *dmp, const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
dm_set_obj_draw_width(struct dm *dmp, const char *handle, fastf_t draw_width)
|
||||
{
|
||||
}
|
||||
|
||||
fastf_t
|
||||
dm_get_obj_draw_width(struct dm *dmp, const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
dm_set_obj_fontsize(struct dm *dmp, const char *handle, int fontsize)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
dm_get_obj_fontsize(struct dm *dmp, const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
dm_set_obj_dirty(struct dm *dmp, const char *handle, int flag)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
dm_get_obj_dirty(struct dm *dmp, const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
dm_set_obj_visible(struct dm *dmp, const char *handle, int flag)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
dm_get_obj_visible(struct dm *dmp, const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dm_set_obj_highlight(struct dm *dmp, const char *handle, int flag)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
dm_get_obj_highlight(struct dm *dmp, const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
struct bu_attribute_value_set *
|
||||
dm_get_obj_settings(struct dm *dmp, const char *handle)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
dm_set_obj_setting(struct dm *dmp, const char *handle, const char *key, const char *val)
|
||||
{
|
||||
}
|
||||
|
||||
const char *
|
||||
dm_get_obj_setting(struct dm *dmp, const char *handle, const char *key)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
|
||||
-2382
File diff suppressed because it is too large
Load Diff
+214
-18
@@ -25,25 +25,36 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef DM_OGL
|
||||
#ifdef DM_OSG
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tk.h"
|
||||
#include <osg/GraphicsContext>
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include <osgViewer/api/Win32/GraphicsWindowWin32>
|
||||
#else
|
||||
# include <osgViewer/api/X11/GraphicsWindowX11>
|
||||
#endif
|
||||
|
||||
#include <osg/PolygonMode>
|
||||
#include <osg/CullSettings>
|
||||
|
||||
extern "C" {
|
||||
#include "bio.h"
|
||||
|
||||
#include "bu.h"
|
||||
#include "vmath.h"
|
||||
#include "bn.h"
|
||||
#include "raytrace.h"
|
||||
#include "dm.h"
|
||||
#include "dm/dm-osg.h"
|
||||
#include "dm/dm_xvars.h"
|
||||
#include "dm/dm-Null.h"
|
||||
}
|
||||
|
||||
#include "./dm_util.h"
|
||||
|
||||
/* For Tk, we need to offset when thinking about screen size in
|
||||
* order to allow for the Mac OSX top-of-screen toolbar - Tk
|
||||
@@ -212,14 +223,14 @@ osg_printglmat(struct bu_vls *tmp_vls, GLfloat *m) {
|
||||
bu_vls_printf(tmp_vls, "%g %g %g %g\n", m[3], m[7], m[11], m[15]);
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
void
|
||||
osg_fogHint(struct dm *dmp, int fastfog)
|
||||
{
|
||||
((struct osg_vars *)dmp->dm_vars.priv_vars)->mvars.fastfog = fastfog;
|
||||
glHint(GL_FOG_HINT, fastfog ? GL_FASTEST : GL_NICEST);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
osg_setBGColor(struct dm *dmp, unsigned char r, unsigned char g, unsigned char b)
|
||||
@@ -438,6 +449,30 @@ osg_reshape(struct dm *dmp, int width, int height)
|
||||
glLoadIdentity();
|
||||
glOrtho(-xlim_view, xlim_view, -ylim_view, ylim_view, dmp->dm_clipmin[2], dmp->dm_clipmax[2]);
|
||||
glMatrixMode(mm);
|
||||
|
||||
struct osg_vars *privvars = (struct osg_vars *)dmp->dm_vars.priv_vars;
|
||||
if (privvars->testviewer) {
|
||||
|
||||
osgViewer::Viewer::Windows windows;
|
||||
privvars->testviewer->getWindows(windows);
|
||||
for(osgViewer::Viewer::Windows::iterator itr = windows.begin();
|
||||
itr != windows.end();
|
||||
++itr)
|
||||
{
|
||||
(*itr)->setWindowRectangle(0, 0, dmp->dm_width, dmp->dm_height);
|
||||
}
|
||||
|
||||
privvars->testviewer->getCamera()->setViewport(0, 0, dmp->dm_width, dmp->dm_height);
|
||||
|
||||
osg::Matrixf orthom;
|
||||
orthom.makeIdentity();
|
||||
orthom.makeOrtho(-xlim_view, xlim_view, -ylim_view, ylim_view, dmp->dm_clipmin[2], dmp->dm_clipmax[2]);
|
||||
privvars->testviewer->getCamera()->setProjectionMatrix(orthom);
|
||||
|
||||
privvars->testviewer->frame();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -607,9 +642,6 @@ osg_open(Tcl_Interp *interp, int argc, char **argv)
|
||||
privvars->mvars.bound = dmp->dm_bound;
|
||||
privvars->mvars.boundFlag = dmp->dm_boundFlag;
|
||||
|
||||
/* this is important so that osg_configureWin knows to set the font */
|
||||
pubvars->fontstruct = NULL;
|
||||
|
||||
if (dmp->dm_top) {
|
||||
/* Make xtkwin a toplevel window */
|
||||
pubvars->xtkwin =
|
||||
@@ -739,13 +771,20 @@ osg_open(Tcl_Interp *interp, int argc, char **argv)
|
||||
// Check the QOSGWidget.cpp example for more logic relevant to this. Need to find
|
||||
// something showing how to handle Cocoa for the Mac, if that's possible
|
||||
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
|
||||
#if defined(DM_OSG) /* Will eventually change to DM_X11 */
|
||||
#if defined(_WIN32)
|
||||
osg::ref_ptr<osg::Referenced> windata = new osgViewer::GraphicsWindowWin32::WindowData(Tk_GetHWND(((struct dm_xvars *)(dmp->dm_vars.pub_vars))->win));
|
||||
#else
|
||||
osg::ref_ptr<osg::Referenced> windata = new osgViewer::GraphicsWindowX11::WindowData(((struct dm_xvars *)(dmp->dm_vars.pub_vars))->win);
|
||||
#elif defined(DM_WIN32)
|
||||
/* win = ? OSG needs HWND for win... */
|
||||
osg::ref_ptr<osg::Referenced> windata = new osgViewer::GraphicsWindowWin32::WindowData(win);
|
||||
#endif
|
||||
|
||||
// Although we are not making direct use of osgViewer currently, we need its
|
||||
// initialization to make sure we have all the libraries we need loaded and
|
||||
// ready. TODO Investigate whether GraphicsWindowEmbedded (specifically the version
|
||||
// that takes osg::GraphicsContext::Traits *traits as an argument) would work
|
||||
// better than a raw createGraphicsContext.
|
||||
osgViewer::Viewer *viewer = new osgViewer::Viewer();
|
||||
delete viewer;
|
||||
|
||||
// Setup the traits parameters
|
||||
traits->x = 0;
|
||||
traits->y = 0;
|
||||
@@ -815,11 +854,24 @@ osg_open(Tcl_Interp *interp, int argc, char **argv)
|
||||
osg_setZBuffer(dmp, dmp->dm_zbuffer);
|
||||
osg_setLight(dmp, dmp->dm_light);
|
||||
|
||||
/* Set up a "real" scene graph view to operate in parallel with the ogl-ish view */
|
||||
privvars->testviewer = new osgViewer::Viewer();
|
||||
privvars->testviewer->setUpViewInWindow(0, 0, 1, 1);
|
||||
privvars->testviewer->realize();
|
||||
|
||||
privvars->osg_root = new osg::Group();
|
||||
privvars->testviewer->setSceneData(privvars->osg_root);
|
||||
privvars->testviewer->getCamera()->setCullingMode(osg::CullSettings::NO_CULLING);
|
||||
|
||||
privvars->testviewer->frame();
|
||||
|
||||
|
||||
|
||||
return dmp;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
extern "C" int
|
||||
osg_share_dlist(struct dm *UNUSED(dmp1), struct dm *UNUSED(dmp2))
|
||||
{
|
||||
#if 0
|
||||
@@ -1069,6 +1121,8 @@ osg_drawBegin(struct dm *dmp)
|
||||
HIDDEN int
|
||||
osg_drawEnd(struct dm *dmp)
|
||||
{
|
||||
struct osg_vars *privvars = (struct osg_vars *)dmp->dm_vars.priv_vars;
|
||||
|
||||
if (dmp->dm_debugLevel)
|
||||
bu_log("osg_drawEnd()\n");
|
||||
|
||||
@@ -1129,6 +1183,7 @@ osg_drawEnd(struct dm *dmp)
|
||||
bu_vls_free(&tmp_vls);
|
||||
}
|
||||
|
||||
privvars->testviewer->frame();
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -1229,6 +1284,37 @@ osg_loadMatrix(struct dm *dmp, fastf_t *mat, int which_eye)
|
||||
bu_vls_free(&tmp_vls);
|
||||
}
|
||||
|
||||
struct osg_vars *osp = (struct osg_vars *)dmp->dm_vars.priv_vars;
|
||||
mat_t glmat;
|
||||
glmat[0] = mat[0];
|
||||
glmat[4] = mat[1];
|
||||
glmat[8] = mat[2];
|
||||
glmat[12] = mat[3];
|
||||
|
||||
glmat[1] = mat[4] * dmp->dm_aspect;
|
||||
glmat[5] = mat[5] * dmp->dm_aspect;
|
||||
glmat[9] = mat[6] * dmp->dm_aspect;
|
||||
glmat[13] = mat[7] * dmp->dm_aspect;
|
||||
|
||||
glmat[2] = mat[8];
|
||||
glmat[6] = mat[9];
|
||||
glmat[10] = mat[10];
|
||||
glmat[14] = mat[11];
|
||||
|
||||
glmat[3] = mat[12];
|
||||
glmat[7] = mat[13];
|
||||
glmat[11] = mat[14];
|
||||
glmat[15] = mat[15];
|
||||
|
||||
osg::Matrix osg_mp(
|
||||
glmat[0], glmat[1], glmat[2], glmat[3],
|
||||
glmat[4], glmat[5], glmat[6], glmat[7],
|
||||
glmat[8], glmat[9], glmat[10], glmat[11],
|
||||
glmat[12], glmat[13], glmat[14], glmat[15]);
|
||||
|
||||
osp->testviewer->getCamera()->getViewMatrix().set(osg_mp);
|
||||
osp->testviewer->frame();
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -1285,6 +1371,38 @@ osg_loadPMatrix(struct dm *dmp, fastf_t *mat)
|
||||
glLoadIdentity();
|
||||
glLoadMatrixf(gtmat);
|
||||
|
||||
|
||||
struct osg_vars *osp = (struct osg_vars *)dmp->dm_vars.priv_vars;
|
||||
mat_t glmat;
|
||||
glmat[0] = mat[0];
|
||||
glmat[4] = mat[1];
|
||||
glmat[8] = mat[2];
|
||||
glmat[12] = mat[3];
|
||||
|
||||
glmat[1] = mat[4];
|
||||
glmat[5] = mat[5];
|
||||
glmat[9] = mat[6];
|
||||
glmat[13] = mat[7];
|
||||
|
||||
glmat[2] = mat[8];
|
||||
glmat[6] = mat[9];
|
||||
glmat[10] = -mat[10];
|
||||
glmat[14] = -mat[11];
|
||||
|
||||
glmat[3] = mat[12];
|
||||
glmat[7] = mat[13];
|
||||
glmat[11] = mat[14];
|
||||
glmat[15] = mat[15];
|
||||
|
||||
osg::Matrix osg_mp(
|
||||
glmat[0], glmat[1], glmat[2], glmat[3],
|
||||
glmat[4], glmat[5], glmat[6], glmat[7],
|
||||
glmat[8], glmat[9], glmat[10], glmat[11],
|
||||
glmat[12], glmat[13], glmat[14], glmat[15]);
|
||||
|
||||
osp->testviewer->getCamera()->setProjectionMatrix(osg_mp);
|
||||
osp->testviewer->frame();
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -1470,6 +1588,7 @@ osg_drawVList(struct dm *dmp, struct bn_vlist *vp)
|
||||
register int mflag = 1;
|
||||
static float black[4] = {0.0, 0.0, 0.0, 0.0};
|
||||
GLfloat originalPointSize, originalLineWidth;
|
||||
struct osg_vars *osp = (struct osg_vars *)dmp->dm_vars.priv_vars;
|
||||
|
||||
glGetFloatv(GL_POINT_SIZE, &originalPointSize);
|
||||
glGetFloatv(GL_LINE_WIDTH, &originalLineWidth);
|
||||
@@ -1608,6 +1727,81 @@ osg_drawVList(struct dm *dmp, struct bn_vlist *vp)
|
||||
glPointSize(originalPointSize);
|
||||
glLineWidth(originalLineWidth);
|
||||
|
||||
// create the osg containers to hold our data.
|
||||
osg::ref_ptr<osg::Geode> geode = new osg::Geode(); // Maybe create this at drawBegin?
|
||||
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry();
|
||||
osg::ref_ptr<osg::Vec3dArray> vertices = new osg::Vec3dArray;
|
||||
osg::ref_ptr<osg::Vec3dArray> normals = new osg::Vec3dArray;
|
||||
|
||||
// Set line color
|
||||
osg::Vec4Array* line_color = new osg::Vec4Array;
|
||||
line_color->push_back(osg::Vec4(255, 255, 100, 70));
|
||||
geom->setColorArray(line_color, osg::Array::BIND_OVERALL);
|
||||
|
||||
// Set wireframe state
|
||||
osg::StateSet *geom_state = geom->getOrCreateStateSet();
|
||||
osg::ref_ptr<osg::PolygonMode> geom_polymode = new osg::PolygonMode;
|
||||
geom_polymode->setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE);
|
||||
geom_state->setAttributeAndModes(geom_polymode);
|
||||
geom_state->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF);
|
||||
|
||||
/* Viewing region is from -1.0 to +1.0 */
|
||||
int begin = 0;
|
||||
int nverts = 0;
|
||||
first = 1;
|
||||
for (BU_LIST_FOR(tvp, bn_vlist, &vp->l)) {
|
||||
int i;
|
||||
int nused = tvp->nused;
|
||||
int *cmd = tvp->cmd;
|
||||
point_t *pt = tvp->pt;
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
switch (*cmd) {
|
||||
case BN_VLIST_LINE_MOVE:
|
||||
/* Move, start line */
|
||||
if (first == 0) {
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP,begin,nverts));
|
||||
|
||||
} else
|
||||
first = 0;
|
||||
|
||||
vertices->push_back(osg::Vec3d((*pt)[X], (*pt)[Y], (*pt)[Z]));
|
||||
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
|
||||
begin += nverts;
|
||||
nverts = 1;
|
||||
break;
|
||||
case BN_VLIST_POLY_START:
|
||||
normals->push_back(osg::Vec3d((*pt)[X], (*pt)[Y], (*pt)[Z]));
|
||||
begin += nverts;
|
||||
nverts = 0;
|
||||
break;
|
||||
case BN_VLIST_LINE_DRAW:
|
||||
case BN_VLIST_POLY_MOVE:
|
||||
case BN_VLIST_POLY_DRAW:
|
||||
vertices->push_back(osg::Vec3d((*pt)[X], (*pt)[Y], (*pt)[Z]));
|
||||
++nverts;
|
||||
break;
|
||||
case BN_VLIST_POLY_END:
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,begin,nverts));
|
||||
first = 1;
|
||||
break;
|
||||
case BN_VLIST_POLY_VERTNORM:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (first == 0) {
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP,begin,nverts));
|
||||
}
|
||||
|
||||
geom->setVertexArray(vertices);
|
||||
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
||||
//geom->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE_SET);
|
||||
|
||||
geom->setUseDisplayList(true);
|
||||
geode->addDrawable(geom);
|
||||
osp->osg_root->addChild(geode);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -2034,8 +2228,9 @@ osg_genDLists(struct dm *dmp, size_t range)
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_getDisplayImage(struct dm *dmp, unsigned char **image)
|
||||
osg_getDisplayImage(struct dm *UNUSED(dmp), unsigned char **UNUSED(image))
|
||||
{
|
||||
#if 0
|
||||
unsigned char *idata = NULL;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
@@ -2119,6 +2314,7 @@ osg_getDisplayImage(struct dm *dmp, unsigned char **image)
|
||||
bu_log("osg_getDisplayImage: Display type not set as OGL or WGL\n");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
return TCL_OK; /* caller will need to bu_free(idata, "image data"); */
|
||||
}
|
||||
|
||||
-2706
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,225 @@
|
||||
/* D M - S P E C I F I C . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 1999-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file libdm/dm-specific.c
|
||||
*
|
||||
* Display manager routines that need specific knowledge of the
|
||||
* underlying drawing system.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "bio.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "dm.h"
|
||||
|
||||
/* TODO - this begs for a plugin based system - should not
|
||||
* be ifdef wrapping so much logic. */
|
||||
|
||||
/* Include local headers for system specific routines */
|
||||
|
||||
#include "txt/dm_txt.h"
|
||||
#ifdef DM_QT
|
||||
# include "qt/dm_qt.h"
|
||||
#endif
|
||||
#ifdef DM_OSG
|
||||
# include "osg/dm_osg.h"
|
||||
#endif
|
||||
|
||||
int
|
||||
dm_init(struct dm *dm, int dm_t, int embedded, void *parent_info)
|
||||
{
|
||||
if (!dm) return -1;
|
||||
if (embedded && !parent_info && !dm_t == DM_TYPE_NULL) return -1;
|
||||
|
||||
BU_GET(dm, struct dm);
|
||||
|
||||
switch (dm->type) {
|
||||
case DM_TYPE_NULL:
|
||||
dm->dm_canvas = NULL;
|
||||
return 0;
|
||||
case DM_TYPE_TXT:
|
||||
return txt_init(dm);
|
||||
#ifdef(DM_QT)
|
||||
case DM_TYPE_QT:
|
||||
return qt_init(dm);
|
||||
#endif
|
||||
#ifdef DM_OSG
|
||||
case DM_TYPE_OSG:
|
||||
return osg_init(dm);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
dm_close(struct dm *dm)
|
||||
{
|
||||
int ret = 0;
|
||||
if (!dm) return -1;
|
||||
switch (dm->type) {
|
||||
case DM_TYPE_NULL:
|
||||
break;
|
||||
case DM_TYPE_TXT:
|
||||
ret = txt_close(dm);
|
||||
break;
|
||||
#ifdef(DM_QT)
|
||||
case DM_TYPE_QT:
|
||||
ret = qt_close(dm);
|
||||
break;
|
||||
#endif
|
||||
#ifdef DM_OSG
|
||||
case DM_TYPE_OSG:
|
||||
ret = osg_close(dm);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
BU_PUT(dm, struct dm);
|
||||
dm = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
dm_refresh(struct dm *dm)
|
||||
{
|
||||
if (!dm) return -1;
|
||||
switch (dm->type) {
|
||||
case DM_TYPE_NULL:
|
||||
return 0;
|
||||
case DM_TYPE_TXT:
|
||||
return txt_refresh(dm);
|
||||
#ifdef(DM_QT)
|
||||
case DM_TYPE_QT:
|
||||
return qt_refresh(dm);
|
||||
#endif
|
||||
#ifdef DM_OSG
|
||||
case DM_TYPE_OSG:
|
||||
return osg_refresh(dm);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *
|
||||
dm_canvas(struct dm *dm)
|
||||
{
|
||||
if (!dm) return NULL;
|
||||
switch (dm->type) {
|
||||
case DM_TYPE_NULL:
|
||||
return NULL;
|
||||
case DM_TYPE_TXT:
|
||||
return txt_canvas(dm); /* Probably a pointer to a bu_vls */
|
||||
#ifdef(DM_QT)
|
||||
case DM_TYPE_QT:
|
||||
return qt_canvas(dm); /* Some Qt drawing context */
|
||||
#endif
|
||||
#ifdef DM_OSG
|
||||
case DM_TYPE_OSG:
|
||||
return osg_canvas(dm); /* Probably the raw OpenGL context */
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
dm_change_type(struct dm *dm, int dm_t)
|
||||
{
|
||||
if (!dm) return -1;
|
||||
/* If we're already the requested type, do nothing */
|
||||
if (dm->type == dm_t) return 0;
|
||||
if (!dm_close(dm)) return -1;
|
||||
dm->type = dm_t;
|
||||
return dm_init(dm);
|
||||
}
|
||||
|
||||
int
|
||||
dm_get_image(struct dm *dm, icv_image_t *image)
|
||||
{
|
||||
if (!dm || !image) return -1;
|
||||
switch (dm->type) {
|
||||
case DM_TYPE_NULL:
|
||||
return 0;
|
||||
case DM_TYPE_TXT:
|
||||
return 0;
|
||||
#ifdef(DM_QT)
|
||||
case DM_TYPE_QT:
|
||||
return qt_get_image(dm, image);
|
||||
#endif
|
||||
#ifdef DM_OSG
|
||||
case DM_TYPE_OSG:
|
||||
return osg_get_image(dm, image);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
dm_get_obj_image(struct dm *dm, const char *handle, icv_image_t *image)
|
||||
{
|
||||
if (!dm || !image) return -1;
|
||||
switch (dm->type) {
|
||||
case DM_TYPE_NULL:
|
||||
return 0;
|
||||
case DM_TYPE_TXT:
|
||||
return 0;
|
||||
#ifdef(DM_QT)
|
||||
case DM_TYPE_QT:
|
||||
return qt_get_obj_image(dm, handle, image);
|
||||
#endif
|
||||
#ifdef DM_OSG
|
||||
case DM_TYPE_OSG:
|
||||
return osg_get_obj_image(dm, handle, image);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
-1095
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -333,7 +333,7 @@ txt_makeCurrent(struct dm *UNUSED(dmp))
|
||||
|
||||
|
||||
HIDDEN int
|
||||
txt_openFb(struct dm *UNUSED(dmp), FBIO *UNUSED(ifp))
|
||||
txt_openFb(struct dm *UNUSED(dmp), fb *UNUSED(ifp))
|
||||
{
|
||||
bu_log("openFb called\n");
|
||||
return 0;
|
||||
|
||||
-2152
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern "C" {
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
@@ -37,6 +38,7 @@
|
||||
#include "tcl.h"
|
||||
|
||||
#include "bu/cmd.h"
|
||||
#include "bu/cv.h"
|
||||
#include "vmath.h"
|
||||
#include "bn.h"
|
||||
#include "db.h"
|
||||
@@ -47,29 +49,12 @@
|
||||
#include "nurb.h"
|
||||
#include "solid.h"
|
||||
#include "dm.h"
|
||||
}
|
||||
|
||||
#ifdef DM_X
|
||||
#ifdef DM_OSG
|
||||
# include "dm/dm_xvars.h"
|
||||
# include <X11/Xutil.h>
|
||||
# include "dm/dm-X.h"
|
||||
#endif /* DM_X */
|
||||
|
||||
#ifdef DM_TK
|
||||
# include "dm/dm_xvars.h"
|
||||
# include "tk.h"
|
||||
# include "dm/dm-tk.h"
|
||||
#endif /* DM_TK */
|
||||
|
||||
#ifdef DM_OGL
|
||||
# include "dm/dm_xvars.h"
|
||||
# include "dm/dm-ogl.h"
|
||||
#endif /* DM_OGL */
|
||||
|
||||
#ifdef DM_WGL
|
||||
# include "dm/dm_xvars.h"
|
||||
# include <tkwinport.h>
|
||||
# include "dm/dm-wgl.h"
|
||||
#endif /* DM_WGL */
|
||||
# include "dm/dm-osg.h"
|
||||
#endif /* DM_OSG */
|
||||
|
||||
#ifdef USE_FBSERV
|
||||
# include "fb.h"
|
||||
@@ -109,11 +94,11 @@ dmo_openFb(struct dm_obj *dmop)
|
||||
return TCL_ERROR;
|
||||
|
||||
/* already open */
|
||||
if (dmop->dmo_fbs.fbs_fbp != FBIO_NULL)
|
||||
if (dmop->dmo_fbs.fbs_fbp != fb_NULL)
|
||||
return TCL_OK;
|
||||
|
||||
/* don't use bu_calloc so we can fail slightly more gracefully */
|
||||
if ((dmop->dmo_fbs.fbs_fbp = (FBIO *)calloc(sizeof(FBIO), 1)) == FBIO_NULL) {
|
||||
if ((dmop->dmo_fbs.fbs_fbp = (fb *)calloc(sizeof(fb), 1)) == fb_NULL) {
|
||||
Tcl_Obj *obj;
|
||||
|
||||
obj = Tcl_GetObjResult(dmop->interp);
|
||||
@@ -128,78 +113,30 @@ dmo_openFb(struct dm_obj *dmop)
|
||||
}
|
||||
|
||||
switch (dmop->dmo_dmp->dm_type) {
|
||||
#ifdef DM_X
|
||||
case DM_TYPE_X:
|
||||
*dmop->dmo_fbs.fbs_fbp = X24_interface; /* struct copy */
|
||||
#ifdef DM_OSG
|
||||
case DM_TYPE_OSG:
|
||||
*dmop->dmo_fbs.fbs_fbp = osg_interface; /* struct copy */
|
||||
|
||||
dmop->dmo_fbs.fbs_fbp->if_name = (char *)bu_malloc((unsigned)strlen("/dev/X")+1, "if_name");
|
||||
bu_strlcpy(dmop->dmo_fbs.fbs_fbp->if_name, "/dev/X", strlen("/dev/X")+1);
|
||||
dmop->dmo_fbs.fbs_fbp->if_name = (char *)bu_malloc((unsigned)strlen("/dev/osg")+1, "if_name");
|
||||
bu_strlcpy(dmop->dmo_fbs.fbs_fbp->if_name, "/dev/osg", strlen("/dev/osg")+1);
|
||||
|
||||
/* Mark OK by filling in magic number */
|
||||
dmop->dmo_fbs.fbs_fbp->if_magic = FB_MAGIC;
|
||||
|
||||
_X24_open_existing(dmop->dmo_fbs.fbs_fbp,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct x_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->pix,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->win,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->cmap,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->vip,
|
||||
dmop->dmo_dmp->dm_width,
|
||||
dmop->dmo_dmp->dm_height,
|
||||
((struct x_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->gc);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef DM_OGL
|
||||
case DM_TYPE_OGL:
|
||||
*dmop->dmo_fbs.fbs_fbp = ogl_interface; /* struct copy */
|
||||
|
||||
dmop->dmo_fbs.fbs_fbp->if_name = (char *)bu_malloc((unsigned)strlen("/dev/ogl")+1, "if_name");
|
||||
bu_strlcpy(dmop->dmo_fbs.fbs_fbp->if_name, "/dev/ogl", strlen("/dev/ogl")+1);
|
||||
|
||||
/* Mark OK by filling in magic number */
|
||||
dmop->dmo_fbs.fbs_fbp->if_magic = FB_MAGIC;
|
||||
|
||||
_ogl_open_existing(dmop->dmo_fbs.fbs_fbp,
|
||||
_osg_open_existing(dmop->dmo_fbs.fbs_fbp,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->win,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->cmap,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->vip,
|
||||
dmop->dmo_dmp->dm_width,
|
||||
dmop->dmo_dmp->dm_height,
|
||||
((struct ogl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->glxc,
|
||||
((struct ogl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->mvars.doublebuffer,
|
||||
0);
|
||||
break;
|
||||
#endif
|
||||
#ifdef DM_WGL
|
||||
case DM_TYPE_WGL:
|
||||
*dmop->dmo_fbs.fbs_fbp = wgl_interface; /* struct copy */
|
||||
|
||||
dmop->dmo_fbs.fbs_fbp->if_name = bu_malloc((unsigned)strlen("/dev/wgl")+1, "if_name");
|
||||
bu_strlcpy(dmop->dmo_fbs.fbs_fbp->if_name, "/dev/wgl", strlen("/dev/wgl")+1);
|
||||
|
||||
/* Mark OK by filling in magic number */
|
||||
dmop->dmo_fbs.fbs_fbp->if_magic = FB_MAGIC;
|
||||
|
||||
_wgl_open_existing(dmop->dmo_fbs.fbs_fbp,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->win,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->cmap,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->vip,
|
||||
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->hdc,
|
||||
dmop->dmo_dmp->dm_width,
|
||||
dmop->dmo_dmp->dm_height,
|
||||
((struct wgl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->glxc,
|
||||
((struct wgl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->mvars.doublebuffer,
|
||||
0);
|
||||
((struct osg_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->graphicsContext);
|
||||
break;
|
||||
#endif
|
||||
default: {
|
||||
Tcl_Obj *obj;
|
||||
|
||||
free((void*)dmop->dmo_fbs.fbs_fbp);
|
||||
dmop->dmo_fbs.fbs_fbp = FBIO_NULL;
|
||||
dmop->dmo_fbs.fbs_fbp = fb_NULL;
|
||||
|
||||
obj = Tcl_GetObjResult(dmop->interp);
|
||||
if (Tcl_IsShared(obj))
|
||||
@@ -227,13 +164,13 @@ dmo_openFb(struct dm_obj *dmop)
|
||||
HIDDEN int
|
||||
dmo_closeFb(struct dm_obj *dmop)
|
||||
{
|
||||
if (dmop->dmo_fbs.fbs_fbp == FBIO_NULL)
|
||||
if (dmop->dmo_fbs.fbs_fbp == fb_NULL)
|
||||
return TCL_OK;
|
||||
|
||||
fb_flush(dmop->dmo_fbs.fbs_fbp);
|
||||
fb_close_existing(dmop->dmo_fbs.fbs_fbp);
|
||||
|
||||
dmop->dmo_fbs.fbs_fbp = FBIO_NULL;
|
||||
dmop->dmo_fbs.fbs_fbp = fb_NULL;
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -262,7 +199,7 @@ dmo_listen_tcl(void *clientData, int argc, const char **argv)
|
||||
if (Tcl_IsShared(obj))
|
||||
obj = Tcl_DuplicateObj(obj);
|
||||
|
||||
if (dmop->dmo_fbs.fbs_fbp == FBIO_NULL) {
|
||||
if (dmop->dmo_fbs.fbs_fbp == fb_NULL) {
|
||||
bu_vls_printf(&vls, "%s listen: framebuffer not open!\n", argv[0]);
|
||||
Tcl_AppendStringsToObj(obj, bu_vls_addr(&vls), (char *)NULL);
|
||||
bu_vls_free(&vls);
|
||||
@@ -327,7 +264,7 @@ dmo_refreshFb_tcl(void *clientData, int argc, const char **argv)
|
||||
if (!dmop || !dmop->interp || argc < 1 || !argv)
|
||||
return TCL_ERROR;
|
||||
|
||||
if (dmop->dmo_fbs.fbs_fbp == FBIO_NULL) {
|
||||
if (dmop->dmo_fbs.fbs_fbp == fb_NULL) {
|
||||
Tcl_Obj *obj;
|
||||
|
||||
obj = Tcl_GetObjResult(dmop->interp);
|
||||
@@ -1830,7 +1767,7 @@ dmo_configure_tcl(void *clientData, int argc, const char **argv)
|
||||
|
||||
#ifdef USE_FBSERV
|
||||
/* configure the framebuffer window */
|
||||
if (dmop->dmo_fbs.fbs_fbp != FBIO_NULL)
|
||||
if (dmop->dmo_fbs.fbs_fbp != fb_NULL)
|
||||
fb_configureWindow(dmop->dmo_fbs.fbs_fbp,
|
||||
dmop->dmo_dmp->dm_width,
|
||||
dmop->dmo_dmp->dm_height);
|
||||
@@ -2229,7 +2166,7 @@ dmo_perspective_tcl(void *clientData, int argc, const char **argv)
|
||||
}
|
||||
|
||||
|
||||
#if defined(DM_X) || defined(DM_OGL)
|
||||
#if defined(DM_X) || defined(DM_OGL) || defined (DM_OSG)
|
||||
|
||||
HIDDEN int
|
||||
dmo_png_cmd(struct dm_obj *dmop,
|
||||
@@ -2501,7 +2438,7 @@ dmo_png_cmd(struct dm_obj *dmop,
|
||||
}
|
||||
|
||||
|
||||
#endif /* defined(DM_X) || defined(DM_OGL) */
|
||||
#endif /* defined(DM_X) || defined(DM_OGL) || defined(DM_OSG) */
|
||||
|
||||
|
||||
/*
|
||||
@@ -2512,7 +2449,7 @@ dmo_png_cmd(struct dm_obj *dmop,
|
||||
*
|
||||
*/
|
||||
HIDDEN int
|
||||
#if defined(DM_X) || defined(DM_OGL)
|
||||
#if defined(DM_X) || defined(DM_OGL) || defined(DM_OSG)
|
||||
dmo_png_tcl(void *clientData, int argc, const char **argv)
|
||||
#else
|
||||
dmo_png_tcl(void *clientData, int UNUSED(argc), const char **UNUSED(argv))
|
||||
@@ -2523,7 +2460,7 @@ dmo_png_tcl(void *clientData, int UNUSED(argc), const char **UNUSED(argv))
|
||||
if (!dmop || !dmop->interp)
|
||||
return TCL_ERROR;
|
||||
|
||||
#if defined(DM_X) || defined(DM_OGL)
|
||||
#if defined(DM_X) || defined(DM_OGL) || defined(DM_OSG)
|
||||
return dmo_png_cmd(dmop, argc-1, argv+1);
|
||||
#else
|
||||
bu_log("Sorry, support for the 'png' command is unavailable.\n");
|
||||
@@ -2781,7 +2718,7 @@ dmo_size_tcl(void *clientData, int argc, const char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(DM_X) || defined(DM_OGL) || defined(DM_OGL) || defined(DM_WGL)
|
||||
#if defined(DM_X) || defined(DM_OGL) || defined(DM_OSG) || defined(DM_WGL)
|
||||
Tk_GeometryRequest(((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->xtkwin,
|
||||
width, height);
|
||||
return TCL_OK;
|
||||
@@ -3136,6 +3073,11 @@ dmo_open_tcl(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char *
|
||||
type = DM_TYPE_OGL;
|
||||
#endif /* DM_OGL */
|
||||
|
||||
#ifdef DM_OSG
|
||||
if (BU_STR_EQUAL(argv[2], "osg"))
|
||||
type = DM_TYPE_OSG;
|
||||
#endif /* DM_OSG */
|
||||
|
||||
#ifdef DM_WGL
|
||||
if (BU_STR_EQUAL(argv[2], "wgl"))
|
||||
type = DM_TYPE_WGL;
|
||||
@@ -3145,7 +3087,7 @@ dmo_open_tcl(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char *
|
||||
Tcl_AppendStringsToObj(obj,
|
||||
"Unsupported display manager type - ",
|
||||
argv[2], "\n",
|
||||
"The supported types are: X, ogl, wgl, and nu",
|
||||
"The supported types are: X, ogl, wgl, osg, and nu",
|
||||
(char *)NULL);
|
||||
Tcl_SetObjResult(interp, obj);
|
||||
return TCL_ERROR;
|
||||
@@ -3210,7 +3152,7 @@ dmo_open_tcl(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char *
|
||||
dmop->dmo_fbs.fbs_listener.fbsl_fbsp = &dmop->dmo_fbs;
|
||||
dmop->dmo_fbs.fbs_listener.fbsl_fd = -1;
|
||||
dmop->dmo_fbs.fbs_listener.fbsl_port = -1;
|
||||
dmop->dmo_fbs.fbs_fbp = FBIO_NULL;
|
||||
dmop->dmo_fbs.fbs_fbp = fb_NULL;
|
||||
dmop->dmo_fbs.fbs_callback = dmo_fbs_callback;
|
||||
dmop->dmo_fbs.fbs_clientData = dmop;
|
||||
dmop->dmo_fbs.fbs_interp = interp;
|
||||
@@ -3244,7 +3186,7 @@ dmo_open_tcl(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char *
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
extern "C" int
|
||||
Dmo_Init(Tcl_Interp *interp)
|
||||
{
|
||||
BU_LIST_INIT(&HeadDMObj.l);
|
||||
+25
-1
@@ -26,7 +26,31 @@
|
||||
|
||||
#include "./dm_util.h"
|
||||
|
||||
#if defined(DM_OGL) || defined(DM_WGL) || defined(DM_RTGL)
|
||||
#if defined(DM_OSG)
|
||||
|
||||
/* glx.h on Mac OS X (and perhaps elsewhere) defines a slew of
|
||||
* * parameter names that shadow system symbols. protect the system
|
||||
* * symbols by redefining the parameters prior to header inclusion.
|
||||
* */
|
||||
#define j1 J1
|
||||
#define y1 Y1
|
||||
#define read rd
|
||||
#define index idx
|
||||
#define access acs
|
||||
#define remainder rem
|
||||
#ifdef HAVE_GL_GLX_H
|
||||
# include <GL/glx.h>
|
||||
#endif
|
||||
#ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
#undef remainder
|
||||
#undef access
|
||||
#undef index
|
||||
#undef read
|
||||
#undef y1
|
||||
#undef j1
|
||||
|
||||
int
|
||||
drawLine3D(struct dm *dmp, point_t pt1, point_t pt2, const char *log_bu, float *wireColor)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,659 @@
|
||||
/* O S G - T E S T . C P P
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file osg-test.cpp
|
||||
*
|
||||
* BRL-CAD test application for OpenSceneGraph integration, based off of
|
||||
* osghud example from OpenSceneGraph, which has the following license:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
#include "common.h"
|
||||
#include "bu/log.h"
|
||||
#include "bu/list.h"
|
||||
#include "mater.h"
|
||||
#include "raytrace.h"
|
||||
#include "rtfunc.h"
|
||||
}
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <osgUtil/Optimizer>
|
||||
#include <osgDB/ReadFile>
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/CompositeViewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
#include <osgGA/TrackballManipulator>
|
||||
#include <osgGA/StateSetManipulator>
|
||||
|
||||
|
||||
#include <osg/Material>
|
||||
#include <osg/Geode>
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/Depth>
|
||||
#include <osg/PolygonOffset>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Camera>
|
||||
#include <osg/RenderInfo>
|
||||
#include <osg/LineStipple>
|
||||
|
||||
#include <osgDB/WriteFile>
|
||||
|
||||
#include <osgText/Text>
|
||||
|
||||
struct bu_list *
|
||||
obj_vlist(const struct directory *dp, const struct db_i *dbip, mat_t mat)
|
||||
{
|
||||
struct bu_list *plot_segments;
|
||||
struct rt_db_internal intern;
|
||||
const struct bn_tol tol = {BN_TOL_MAGIC, 0.0005, 0.0005 * 0.0005, 1e-6, 1 - 1e-6};
|
||||
const struct rt_tess_tol rttol = {RT_TESS_TOL_MAGIC, 0.0, 0.01, 0};
|
||||
RT_DB_INTERNAL_INIT(&intern);
|
||||
if (rt_db_get_internal(&intern, dp, dbip, mat, &rt_uniresource) < 0) {
|
||||
bu_exit(1, "ERROR: Unable to get internal representation of %s\n", dp->d_namep);
|
||||
}
|
||||
BU_GET(plot_segments, struct bu_list);
|
||||
BU_LIST_INIT(plot_segments);
|
||||
|
||||
if (rt_obj_plot(plot_segments, &intern, &rttol, &tol) < 0) {
|
||||
bu_exit(1, "ERROR: Unable to get plot segment list from %s\n", dp->d_namep);
|
||||
}
|
||||
rt_db_free_internal(&intern);
|
||||
return plot_segments;
|
||||
}
|
||||
|
||||
void
|
||||
add_vlist_to_geom(osg::Geometry *geom, struct bu_list *plot_segments)
|
||||
{
|
||||
std::vector<int>startIndexes;
|
||||
std::vector<int>stopIndexes;
|
||||
osg::Vec3Array *vertArray = (osg::Vec3Array *)geom->getVertexArray();
|
||||
struct bn_vlist *vp;
|
||||
|
||||
if (!vertArray) {
|
||||
osg::ref_ptr<osg::Vec3Array> new_vertArray = new osg::Vec3Array();
|
||||
geom->setVertexArray(new_vertArray);
|
||||
vertArray = (osg::Vec3Array *)geom->getVertexArray();
|
||||
}
|
||||
int currentVertex = vertArray->getNumElements();
|
||||
|
||||
geom->setUseDisplayList(true);
|
||||
|
||||
for (BU_LIST_FOR(vp, bn_vlist, plot_segments))
|
||||
{
|
||||
int j;
|
||||
int nused = vp->nused;
|
||||
const int *cmd = vp->cmd;
|
||||
point_t *pt = vp->pt;
|
||||
|
||||
for (j=0 ; j < nused ; j++, cmd++, pt++, currentVertex++)
|
||||
{
|
||||
switch (*cmd)
|
||||
{
|
||||
case BN_VLIST_POLY_START:
|
||||
break;
|
||||
case BN_VLIST_POLY_MOVE: // fallthrough
|
||||
case BN_VLIST_LINE_MOVE:
|
||||
if (startIndexes.size() > 0)
|
||||
{
|
||||
// finish off the last linestrip
|
||||
stopIndexes.push_back(currentVertex-1);
|
||||
}
|
||||
// remember where the new linestrip begins
|
||||
startIndexes.push_back(currentVertex);
|
||||
|
||||
// start a new linestrip
|
||||
vertArray->push_back(osg::Vec3((float)((*pt)[X]), (float)((*pt)[Y]),(float)(*pt)[Z]));
|
||||
|
||||
break;
|
||||
case BN_VLIST_POLY_DRAW: // fallthrough
|
||||
case BN_VLIST_POLY_END: // fallthrough
|
||||
case BN_VLIST_LINE_DRAW:
|
||||
// continue existing linestrip
|
||||
vertArray->push_back(osg::Vec3((float)((*pt)[X]), (float)((*pt)[Y]),(float)(*pt)[Z]));
|
||||
break;
|
||||
case BN_VLIST_POINT_DRAW:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (startIndexes.size() > 0)
|
||||
stopIndexes.push_back(--currentVertex);
|
||||
|
||||
|
||||
for (unsigned j=0 ; j < startIndexes.size() ; j++) {
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, startIndexes[j], (stopIndexes[j]-startIndexes[j])+1 ));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Group>
|
||||
solid_node(
|
||||
std::map<const struct directory *, osg::ref_ptr<osg::Group> > *osg_nodes,
|
||||
const struct directory *dp, const struct db_i *dbip)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> wrapper;
|
||||
if ((*osg_nodes).find(dp) == (*osg_nodes).end()) {
|
||||
wrapper = new osg::Group;
|
||||
(*osg_nodes)[dp] = wrapper.get();
|
||||
} else {
|
||||
wrapper = (*osg_nodes)[dp];
|
||||
}
|
||||
|
||||
/* Clear the children from the wrapper, if it has any */
|
||||
unsigned int children_cnt = wrapper->getNumChildren();
|
||||
wrapper->removeChildren(0, children_cnt);
|
||||
|
||||
/* Set up the OSG superstructure for the solid geometry node */
|
||||
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
||||
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
|
||||
wrapper->setName(dp->d_namep);
|
||||
geode->setName(dp->d_namep);
|
||||
geom->setName(dp->d_namep); // set drawable to same name as region
|
||||
geode->addDrawable(geom);
|
||||
osg::StateSet* state = geode->getOrCreateStateSet();
|
||||
state->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||
wrapper->addChild(geode);
|
||||
|
||||
/* Actually add the geometry from the vlist */
|
||||
mat_t mat;
|
||||
MAT_IDN(mat);
|
||||
struct bu_list *plot_segments = obj_vlist(dp, dbip, mat);
|
||||
add_vlist_to_geom(geom, plot_segments);
|
||||
|
||||
/* Cleanup */
|
||||
RT_FREE_VLIST(plot_segments);
|
||||
BU_PUT(plot_segments, struct bu_list);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
void
|
||||
create_solid_nodes(std::map<const struct directory *, osg::ref_ptr<osg::Group> > *osg_nodes,
|
||||
struct directory *dp, struct db_i *dbip)
|
||||
{
|
||||
const char *solid_search = "! -type comb";
|
||||
struct bu_ptbl solids = BU_PTBL_INIT_ZERO;
|
||||
(void)db_search(&solids, DB_SEARCH_RETURN_UNIQ_DP, solid_search, 1, &dp, dbip);
|
||||
|
||||
for (int i = (int)BU_PTBL_LEN(&solids) - 1; i >= 0; i--) {
|
||||
/* Get the vlist associated with this particular object */
|
||||
struct directory *curr_dp = (struct directory *)BU_PTBL_GET(&solids, i);
|
||||
if ((*osg_nodes).find(curr_dp) == (*osg_nodes).end()) {
|
||||
osg::ref_ptr<osg::Group> node = solid_node(osg_nodes, curr_dp, dbip);
|
||||
(*osg_nodes)[curr_dp] = node.get();
|
||||
}
|
||||
}
|
||||
db_search_free(&solids);
|
||||
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Group>
|
||||
bare_comb_node(
|
||||
std::map<const struct directory *, osg::ref_ptr<osg::Group> > *osg_nodes,
|
||||
const struct directory *dp, const struct db_i *dbip)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> comb;
|
||||
if ((*osg_nodes).find(dp) == (*osg_nodes).end()) {
|
||||
comb = new osg::Group;
|
||||
(*osg_nodes)[dp] = comb.get();
|
||||
} else {
|
||||
comb = (*osg_nodes)[dp];
|
||||
}
|
||||
|
||||
comb->setName(dp->d_namep);
|
||||
|
||||
struct rt_db_internal intern;
|
||||
(void)rt_db_get_internal(&intern, dp, dbip, (fastf_t *)NULL, &rt_uniresource);
|
||||
struct rt_comb_internal *comb_internal= (struct rt_comb_internal *)intern.idb_ptr;
|
||||
/* Set color for this comb */
|
||||
float color[3] = {-1.0, -1.0, -1.0};
|
||||
if (comb_internal->rgb_valid) {
|
||||
VSCALE(color, comb_internal->rgb, (1.0/255.0) );
|
||||
} else {
|
||||
struct mater *mp = MATER_NULL;
|
||||
for (mp = rt_material_head(); mp != MATER_NULL; mp = mp->mt_forw) {
|
||||
if (comb_internal->region_id <= mp->mt_high && comb_internal->region_id >= mp->mt_low) {
|
||||
color[0] = mp->mt_r/255.0;
|
||||
color[1] = mp->mt_g/255.0;
|
||||
color[2] = mp->mt_b/255.0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (color[0] > -1) {
|
||||
osg::ref_ptr<osg::Material> mtl = new osg::Material;
|
||||
mtl->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(color[0], color[1], color[2], 1.0f));
|
||||
osg::StateSet* state = comb->getOrCreateStateSet();
|
||||
if (comb_internal->inherit || comb_internal->region_flag) {
|
||||
state->setAttributeAndModes(mtl.get(), osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
||||
} else {
|
||||
state->setAttributeAndModes(mtl.get(), osg::StateAttribute::ON);
|
||||
}
|
||||
}
|
||||
rt_db_free_internal(&intern);
|
||||
|
||||
return comb;
|
||||
}
|
||||
|
||||
int
|
||||
subtracted_solid(struct db_full_path *path)
|
||||
{
|
||||
int ret = 0;
|
||||
for (unsigned int i = 0; i < path->fp_len; i++) {
|
||||
if(path->fp_bool[i] == 4) ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
add_comb_child(osg::Group *comb, osg::Group *child, struct db_full_path *child_path, struct db_i *dbip)
|
||||
{
|
||||
mat_t m = MAT_INIT_IDN;
|
||||
mat_t m_idn = MAT_INIT_IDN;
|
||||
const struct bn_tol tol = {BN_TOL_MAGIC, 0.0005, 0.0005 * 0.0005, 1e-6, 1 - 1e-6};
|
||||
(void)db_path_to_mat(dbip, child_path, (matp_t)(&m), child_path->fp_len, &rt_uniresource);
|
||||
if (!bn_mat_is_equal(m, m_idn, &tol)) {
|
||||
mat_t mt = MAT_INIT_IDN;
|
||||
MAT_TRANSPOSE(mt, m);
|
||||
osg::Matrixd osgMat(mt);
|
||||
osg::ref_ptr<osg::MatrixTransform> osgmt = new osg::MatrixTransform(osgMat);
|
||||
osgmt->addChild(child);
|
||||
comb->addChild(osgmt);
|
||||
|
||||
/* If this child_path is subtracted in this comb, stipple the line drawings */
|
||||
if (child_path->fp_bool[child_path->fp_len - 1] == 4) {
|
||||
osg::StateSet* state = osgmt->getOrCreateStateSet();
|
||||
osg::ref_ptr<osg::LineStipple> ls = new osg::LineStipple();
|
||||
ls->setPattern(0xCF33);
|
||||
ls->setFactor(1);
|
||||
state->setAttributeAndModes(ls.get());
|
||||
}
|
||||
} else {
|
||||
if (child_path->fp_bool[child_path->fp_len - 1] == 4) {
|
||||
osg::ref_ptr<osg::Group> property_wrapper = new osg::Group;
|
||||
property_wrapper->setName(DB_FULL_PATH_CUR_DIR(child_path)->d_namep);
|
||||
osg::StateSet* state = property_wrapper->getOrCreateStateSet();
|
||||
osg::ref_ptr<osg::LineStipple> ls = new osg::LineStipple();
|
||||
ls->setPattern(0xCF33);
|
||||
ls->setFactor(1);
|
||||
state->setAttributeAndModes(ls.get());
|
||||
property_wrapper->addChild(child);
|
||||
comb->addChild(property_wrapper);
|
||||
} else {
|
||||
comb->addChild(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* In the case of regions, we need to be able to remove and restore the individual
|
||||
* comb children, because for normal display (as opposed to editing mode) we need to
|
||||
* use a single compositite wireframe for regions */
|
||||
osg::ref_ptr<osg::Group>
|
||||
full_comb_node(
|
||||
std::map<const struct directory *, osg::ref_ptr<osg::Group> > *osg_nodes,
|
||||
struct directory *dp, struct db_i *dbip)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> comb = bare_comb_node(osg_nodes, dp, dbip);
|
||||
|
||||
/* Clear the immediate children from this node, if it has any */
|
||||
unsigned int children_cnt = comb->getNumChildren();
|
||||
comb->removeChildren(0, children_cnt);
|
||||
|
||||
const char *comb_search = "-type comb";
|
||||
struct bu_ptbl combs = BU_PTBL_INIT_ZERO;
|
||||
(void)db_search(&combs, DB_SEARCH_RETURN_UNIQ_DP, comb_search, 1, &dp, dbip);
|
||||
for (int i = (int)BU_PTBL_LEN(&combs) - 1; i >= 0; i--) {
|
||||
struct directory *curr_dp = (struct directory *)BU_PTBL_GET(&combs, i);
|
||||
osg::ref_ptr<osg::Group> sub_comb = bare_comb_node(osg_nodes, curr_dp, dbip);
|
||||
const char *comb_children_search = "-mindepth 1 -maxdepth 1";
|
||||
struct bu_ptbl comb_children = BU_PTBL_INIT_ZERO;
|
||||
(void)db_search(&comb_children, DB_SEARCH_TREE, comb_children_search, 1, &curr_dp, dbip);
|
||||
for (int j = (int)BU_PTBL_LEN(&comb_children) - 1; j >= 0; j--) {
|
||||
struct db_full_path *curr_path = (struct db_full_path *)BU_PTBL_GET(&comb_children, j);
|
||||
struct directory *curr_child_dp = DB_FULL_PATH_CUR_DIR(curr_path);
|
||||
if (curr_child_dp->d_flags & RT_DIR_COMB) {
|
||||
osg::ref_ptr<osg::Group> new_node = bare_comb_node(osg_nodes, curr_child_dp, dbip);
|
||||
(*osg_nodes)[curr_child_dp] = new_node.get();
|
||||
}
|
||||
if (curr_child_dp->d_flags & RT_DIR_SOLID) {
|
||||
osg::ref_ptr<osg::Group> new_node = solid_node(osg_nodes, curr_child_dp, dbip);
|
||||
(*osg_nodes)[curr_child_dp] = new_node.get();
|
||||
}
|
||||
add_comb_child(sub_comb, (*osg_nodes)[curr_child_dp], curr_path, dbip);
|
||||
}
|
||||
db_search_free(&comb_children);
|
||||
}
|
||||
db_search_free(&combs);
|
||||
|
||||
return comb;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Group>
|
||||
full_region_node(
|
||||
std::map<const struct directory *, osg::ref_ptr<osg::Group> > *osg_nodes,
|
||||
struct directory *dp, struct db_i *dbip)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> region = bare_comb_node(osg_nodes, dp, dbip);
|
||||
|
||||
/* Clear the immediate children from this node, if it has any */
|
||||
unsigned int children_cnt = region->getNumChildren();
|
||||
region->removeChildren(0, children_cnt);
|
||||
|
||||
/* We now create up to two pseudo-solid nodes holding the full region drawable info - one for non-subtracted
|
||||
* elements (no stipple) and one (if needed) for subtracted elements (stipple)*/
|
||||
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
||||
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
|
||||
geode->setName(dp->d_namep);
|
||||
geom->setName(dp->d_namep); // set drawable to same name as region
|
||||
geode->addDrawable(geom);
|
||||
osg::StateSet* state = geode->getOrCreateStateSet();
|
||||
state->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||
region->addChild(geode);
|
||||
|
||||
/* Define the subtraction container, but don't add it as a child of the region unless we actually need it.*/
|
||||
osg::ref_ptr<osg::Group> subtraction_wrapper = new osg::Group;
|
||||
osg::ref_ptr<osg::Geode> subtraction_geode = new osg::Geode;
|
||||
osg::ref_ptr<osg::Geometry> subtraction_geom = new osg::Geometry;
|
||||
subtraction_wrapper->setName(dp->d_namep);
|
||||
subtraction_geode->setName(dp->d_namep);
|
||||
subtraction_geom->setName(dp->d_namep);
|
||||
osg::StateSet* subtraction_geode_state = subtraction_geode->getOrCreateStateSet();
|
||||
subtraction_geode_state->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||
osg::StateSet* subtraction_state = subtraction_wrapper->getOrCreateStateSet();
|
||||
osg::ref_ptr<osg::LineStipple> ls = new osg::LineStipple();
|
||||
ls->setPattern(0xCF33);
|
||||
ls->setFactor(1);
|
||||
subtraction_state->setAttributeAndModes(ls.get());
|
||||
subtraction_geode->addDrawable(subtraction_geom);
|
||||
subtraction_wrapper->addChild(subtraction_geode);
|
||||
|
||||
/*Search for all the solids (using full paths) below the region - that's the list of vlists we need for this particular region,
|
||||
*using the full paths below the current region to place them in their final relative positions.
|
||||
*/
|
||||
const char *region_vlist_search = "! -type comb";
|
||||
struct bu_ptbl region_vlist_contributors = BU_PTBL_INIT_ZERO;
|
||||
(void)db_search(®ion_vlist_contributors, DB_SEARCH_TREE, region_vlist_search, 1, &dp, dbip);
|
||||
int have_subtraction = 0;
|
||||
for (int j = (int)BU_PTBL_LEN(®ion_vlist_contributors) - 1; j >= 0; j--) {
|
||||
struct db_full_path *curr_path = (struct db_full_path *)BU_PTBL_GET(®ion_vlist_contributors, j);
|
||||
|
||||
/* Find out how to draw this particular wireframe */
|
||||
int subtraction_path = subtracted_solid(curr_path);
|
||||
|
||||
/* Get the final matrix we will need for this vlist */
|
||||
mat_t tm;
|
||||
MAT_IDN(tm);
|
||||
(void)db_path_to_mat(dbip, curr_path, tm, curr_path->fp_len-1, &rt_uniresource);
|
||||
|
||||
/* Actually add the geometry from the vlist */
|
||||
struct bu_list *plot_segments = obj_vlist(DB_FULL_PATH_CUR_DIR(curr_path), dbip, tm);
|
||||
if (subtraction_path) {
|
||||
have_subtraction++;
|
||||
add_vlist_to_geom(subtraction_geom, plot_segments);
|
||||
} else {
|
||||
add_vlist_to_geom(geom, plot_segments);
|
||||
}
|
||||
|
||||
/* Cleanup */
|
||||
RT_FREE_VLIST(plot_segments);
|
||||
BU_PUT(plot_segments, struct bu_list);
|
||||
|
||||
}
|
||||
db_search_free(®ion_vlist_contributors);
|
||||
if (have_subtraction) {
|
||||
region->addChild(subtraction_wrapper);
|
||||
}
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
|
||||
/* In the case of regions, we need to be able to remove and restore the individual
|
||||
* comb children, because for normal display (as opposed to editing mode) we need to
|
||||
* use a single compositite wireframe for regions */
|
||||
osg::ref_ptr<osg::Group>
|
||||
full_assembly_node(
|
||||
std::map<const struct directory *, osg::ref_ptr<osg::Group> > *osg_nodes,
|
||||
struct directory *dp, struct db_i *dbip)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> assembly = bare_comb_node(osg_nodes, dp, dbip);
|
||||
|
||||
/* Clear the immediate children from this node, if it has any */
|
||||
unsigned int children_cnt = assembly->getNumChildren();
|
||||
assembly->removeChildren(0, children_cnt);
|
||||
|
||||
const char *assembly_search = "-type comb ! -below -type region ! -type region";
|
||||
struct bu_ptbl assemblies = BU_PTBL_INIT_ZERO;
|
||||
(void)db_search(&assemblies, DB_SEARCH_RETURN_UNIQ_DP, assembly_search, 1, &dp, dbip);
|
||||
for (int i = (int)BU_PTBL_LEN(&assemblies) - 1; i >= 0; i--) {
|
||||
struct directory *curr_dp = (struct directory *)BU_PTBL_GET(&assemblies, i);
|
||||
osg::ref_ptr<osg::Group> sub_comb = bare_comb_node(osg_nodes, curr_dp, dbip);
|
||||
const char *comb_children_search = "-mindepth 1 -maxdepth 1";
|
||||
struct bu_ptbl comb_children = BU_PTBL_INIT_ZERO;
|
||||
(void)db_search(&comb_children, DB_SEARCH_TREE, comb_children_search, 1, &curr_dp, dbip);
|
||||
for (int j = (int)BU_PTBL_LEN(&comb_children) - 1; j >= 0; j--) {
|
||||
struct db_full_path *curr_path = (struct db_full_path *)BU_PTBL_GET(&comb_children, j);
|
||||
struct directory *curr_child_dp = DB_FULL_PATH_CUR_DIR(curr_path);
|
||||
if (curr_child_dp->d_flags & RT_DIR_COMB && !(curr_child_dp->d_flags & RT_DIR_REGION)) {
|
||||
int is_assembly = 0;
|
||||
for (int k = (int)BU_PTBL_LEN(&assemblies) - 1; k >= 0; k--) {
|
||||
struct directory *assembly_dp = (struct directory *)BU_PTBL_GET(&assemblies, k);
|
||||
if (assembly_dp == curr_child_dp) is_assembly = 1;
|
||||
}
|
||||
osg::ref_ptr<osg::Group> new_node;
|
||||
if (is_assembly) {
|
||||
new_node = bare_comb_node(osg_nodes, curr_child_dp, dbip);
|
||||
} else {
|
||||
new_node = full_comb_node(osg_nodes, curr_child_dp, dbip);
|
||||
}
|
||||
(*osg_nodes)[DB_FULL_PATH_CUR_DIR(curr_path)] = new_node.get();
|
||||
}
|
||||
if (curr_child_dp->d_flags & RT_DIR_REGION) {
|
||||
osg::ref_ptr<osg::Group> new_node = full_region_node(osg_nodes, curr_child_dp, dbip);
|
||||
(*osg_nodes)[curr_child_dp] = new_node.get();
|
||||
}
|
||||
if (curr_child_dp->d_flags & RT_DIR_SOLID) {
|
||||
osg::ref_ptr<osg::Group> new_node = solid_node(osg_nodes, curr_child_dp, dbip);
|
||||
(*osg_nodes)[curr_child_dp] = new_node.get();
|
||||
}
|
||||
add_comb_child(sub_comb, (*osg_nodes)[curr_child_dp], curr_path, dbip);
|
||||
}
|
||||
db_search_free(&comb_children);
|
||||
}
|
||||
db_search_free(&assemblies);
|
||||
|
||||
return assembly;
|
||||
}
|
||||
|
||||
|
||||
/* Determine what type of dp we're dealing with:
|
||||
*
|
||||
* -1 - not drawable
|
||||
* 0 - solid
|
||||
* 1 - comb
|
||||
* 2 - region
|
||||
* 3 - assembly (comb with regions below it)
|
||||
*/
|
||||
int
|
||||
characterize_dp(struct directory *dp, struct db_i *dbip)
|
||||
{
|
||||
int ret = -1;
|
||||
const char *is_assembly_search = "-type region";
|
||||
if (dp->d_flags & RT_DIR_COMB) {
|
||||
ret = 1;
|
||||
if (dp->d_flags & RT_DIR_REGION) {
|
||||
ret = 2;
|
||||
} else {
|
||||
/* TODO - db_search should let us know the results without needing the table,
|
||||
* but that doesn't seem to be working... */
|
||||
struct bu_ptbl search_results = BU_PTBL_INIT_ZERO;
|
||||
(void)db_search(&search_results, DB_SEARCH_QUIET, is_assembly_search, 1, &dp, dbip);
|
||||
if (BU_PTBL_LEN(&search_results) > 0) ret = 3;
|
||||
db_search_free(&search_results);
|
||||
}
|
||||
} else {
|
||||
if (dp->d_flags & RT_DIR_SOLID) ret = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
add_dp_to_scene(
|
||||
std::map<const struct directory *, osg::ref_ptr<osg::Group> > *osg_nodes,
|
||||
struct directory *dp, struct db_i *dbip)
|
||||
{
|
||||
int dp_type = characterize_dp(dp, dbip);
|
||||
switch (dp_type) {
|
||||
case 0:
|
||||
(void)solid_node(osg_nodes, dp, dbip);
|
||||
break;
|
||||
case 1:
|
||||
full_comb_node(osg_nodes, dp, dbip);
|
||||
break;
|
||||
case 2:
|
||||
full_region_node(osg_nodes, dp, dbip);
|
||||
break;
|
||||
case 3:
|
||||
full_assembly_node(osg_nodes, dp, dbip);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
add_path_to_scene(
|
||||
std::map<const struct directory *, osg::ref_ptr<osg::Group> > *osg_nodes,
|
||||
const struct db_full_path *path, struct db_i *dbip)
|
||||
{
|
||||
/* Whatever the path looks like, we're going to have to add the
|
||||
* current directory */
|
||||
struct db_full_path working_path;
|
||||
db_full_path_init(&working_path);
|
||||
db_dup_full_path(&working_path, path);
|
||||
|
||||
add_dp_to_scene(osg_nodes, DB_FULL_PATH_CUR_DIR(&working_path), dbip);
|
||||
|
||||
while (working_path.fp_len > 1) {
|
||||
struct directory *curr_dp = DB_FULL_PATH_CUR_DIR(&working_path);
|
||||
struct directory *parent_dp = working_path.fp_names[working_path.fp_len - 2];
|
||||
|
||||
osg::ref_ptr<osg::Group> comb = bare_comb_node(osg_nodes, parent_dp, dbip);
|
||||
osg::ref_ptr<osg::Group> child = (*osg_nodes)[curr_dp];
|
||||
|
||||
add_comb_child(comb, child, &working_path, dbip);
|
||||
|
||||
DB_FULL_PATH_POP(&working_path);
|
||||
}
|
||||
|
||||
db_free_full_path(&working_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
std::map<const struct directory *, osg::ref_ptr<osg::Group> > osg_nodes;
|
||||
struct db_i *dbip = DBI_NULL;
|
||||
struct directory *dp = RT_DIR_NULL;
|
||||
struct db_full_path path;
|
||||
|
||||
if (argc != 3 || !argv) {
|
||||
bu_exit(1, "Error - please specify a .g file and an object\n");
|
||||
}
|
||||
if (!bu_file_exists(argv[1], NULL)) {
|
||||
bu_exit(1, "Cannot stat file %s\n", argv[1]);
|
||||
}
|
||||
|
||||
if ((dbip = db_open(argv[1], DB_OPEN_READONLY)) == DBI_NULL) {
|
||||
bu_exit(1, "Cannot open geometry database file %s\n", argv[1]);
|
||||
}
|
||||
RT_CK_DBI(dbip);
|
||||
if (db_dirbuild(dbip) < 0) {
|
||||
db_close(dbip);
|
||||
bu_exit(1, "db_dirbuild failed on geometry database file %s\n", argv[1]);
|
||||
}
|
||||
|
||||
/* argv[2] may be a full path, not just an object name - handle it */
|
||||
if (db_string_to_path(&path, dbip, argv[2])) {
|
||||
bu_exit(1, "ERROR: Unable to find object %s in %s\n", argv[2], argv[1]);
|
||||
}
|
||||
|
||||
/* Need to initialize this for rt_obj_plot, which may call RT_ADD_VLIST */
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree);
|
||||
|
||||
add_path_to_scene(&(osg_nodes), &path, dbip);
|
||||
|
||||
// construct the viewer.
|
||||
osgViewer::Viewer viewer;
|
||||
viewer.setUpViewInWindow(0, 0, 640, 480);
|
||||
|
||||
// add the state manipulator
|
||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||
|
||||
// add the thread model handler
|
||||
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||
|
||||
// add the window size toggle handler
|
||||
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
||||
|
||||
// add the stats handler
|
||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||
|
||||
// The settings below do not seem to improve FPS, and the latter results in no geometry being
|
||||
// visible without improving the FPS.
|
||||
//viewer.getCamera()->setCullingMode(osg::CullSettings::NO_CULLING);
|
||||
//viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
|
||||
|
||||
osgUtil::Optimizer optimizer;
|
||||
osg::ref_ptr<osg::Group> toplevel = new osg::Group;
|
||||
toplevel->addChild(osg_nodes[DB_FULL_PATH_ROOT_DIR(&path)]);
|
||||
optimizer.optimize(toplevel);
|
||||
viewer.setSceneData(toplevel);
|
||||
|
||||
viewer.realize();
|
||||
|
||||
return viewer.run();
|
||||
}
|
||||
// Local Variables:
|
||||
// tab-width: 8
|
||||
// mode: C++
|
||||
// c-basic-offset: 4
|
||||
// indent-tabs-mode: t
|
||||
// c-file-style: "stroustrup"
|
||||
// End:
|
||||
// ex: shiftwidth=4 tabstop=8
|
||||
Regular → Executable
+6
-115
@@ -40,76 +40,17 @@ int dm_validXType(char *dpy_string, char *name);
|
||||
char *dm_bestXType(char *dpy_string);
|
||||
|
||||
int
|
||||
#if !defined(DM_WGL) && !defined(DM_RTGL) && !defined(DM_OGL) && !defined(DM_X) && !defined(DM_TK)
|
||||
dm_validXType(char *UNUSED(dpy_string), char *name)
|
||||
#else
|
||||
dm_validXType(char *dpy_string, char *name)
|
||||
#endif
|
||||
{
|
||||
if (BU_STR_EQUAL(name, "wgl")) {
|
||||
#ifdef DM_WGL
|
||||
if (BU_STR_EQUAL(name, "osg")) {
|
||||
#ifdef DM_OSG
|
||||
return 1;
|
||||
#else
|
||||
bu_log("Specified display type [%s] is not available in this compilation.", name);
|
||||
return 0;
|
||||
#endif /* DM_WGL */
|
||||
}
|
||||
|
||||
if (BU_STR_EQUAL(name, "rtgl")) {
|
||||
#ifdef DM_RTGL
|
||||
Display *dpy;
|
||||
int return_val;
|
||||
if ((dpy = XOpenDisplay(dpy_string)) != NULL) {
|
||||
if (XQueryExtension(dpy, "GLX", &return_val, &return_val, &return_val)) {
|
||||
XCloseDisplay(dpy);
|
||||
return 1;
|
||||
}
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
#else
|
||||
bu_log("Specified display type [%s] is not available in this compilation.", name);
|
||||
#endif /* DM_RTGL */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (BU_STR_EQUAL(name, "ogl")) {
|
||||
#ifdef DM_OGL
|
||||
Display *dpy;
|
||||
int return_val;
|
||||
if ((dpy = XOpenDisplay(dpy_string)) != NULL) {
|
||||
if (XQueryExtension(dpy, "GLX", &return_val, &return_val, &return_val)) {
|
||||
XCloseDisplay(dpy);
|
||||
return 1;
|
||||
}
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
#else
|
||||
bu_log("Specified display type [%s] is not available in this compilation.", name);
|
||||
#endif /* DM_OGL */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (BU_STR_EQUAL(name, "X")) {
|
||||
#ifdef DM_X
|
||||
Display *dpy;
|
||||
if ((dpy = XOpenDisplay(dpy_string)) != NULL) {
|
||||
XCloseDisplay(dpy);
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
bu_log("Specified display type [%s] is not available in this compilation.", name);
|
||||
#endif /* DM_X */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (BU_STR_EQUAL(name, "tk")) {
|
||||
#ifdef DM_TK
|
||||
return 1;
|
||||
#else
|
||||
bu_log("Specified display type [%s] is not available in this compilation.", name);
|
||||
#endif /* DM_TK */
|
||||
#endif /* DM_OSG */
|
||||
return 0;
|
||||
}
|
||||
bu_log("Specified display type [%s] is not available in this compilation.", name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -119,62 +60,12 @@ dm_validXType(char *dpy_string, char *name)
|
||||
*/
|
||||
|
||||
char *
|
||||
#if !defined(DM_WGL) && !defined(DM_RTGL) && !defined(DM_OGL) && !defined(DM_X) && !defined(DM_TK)
|
||||
dm_bestXType(char *UNUSED(dpy_string))
|
||||
#else
|
||||
dm_bestXType(char *dpy_string)
|
||||
#endif
|
||||
{
|
||||
#ifdef DM_WGL
|
||||
/* should probably make sure wgl works */
|
||||
return "wgl";
|
||||
#ifdef DM_OSG
|
||||
return "osg";
|
||||
#endif
|
||||
|
||||
#ifdef DM_RTGL
|
||||
{
|
||||
Display *dpy;
|
||||
int return_val;
|
||||
|
||||
if ((dpy = XOpenDisplay(dpy_string)) != NULL) {
|
||||
if (XQueryExtension(dpy, "GLX", &return_val, &return_val, &return_val)) {
|
||||
XCloseDisplay(dpy);
|
||||
return "rtgl";
|
||||
}
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DM_OGL
|
||||
{
|
||||
Display *dpy;
|
||||
int return_val;
|
||||
|
||||
if ((dpy = XOpenDisplay(dpy_string)) != NULL) {
|
||||
if (XQueryExtension(dpy, "GLX", &return_val, &return_val, &return_val)) {
|
||||
XCloseDisplay(dpy);
|
||||
return "ogl";
|
||||
}
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DM_X
|
||||
{
|
||||
Display *dpy;
|
||||
if ((dpy = XOpenDisplay(dpy_string)) != NULL) {
|
||||
XCloseDisplay(dpy);
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DM_TK
|
||||
return "tk";
|
||||
#else
|
||||
return "nu";
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user