Compare commits
169
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
886b70e368 | ||
|
|
1ea5ae5d52 | ||
|
|
1f430a0706 | ||
|
|
f1402f58bd | ||
|
|
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";
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
<funcsynopsis>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef><function>fb</function> *fb_open</funcdef>
|
||||
<funcdef><function>FBIO</function> *fb_open</funcdef>
|
||||
<paramdef>* <parameter>fbfile</parameter></paramdef>
|
||||
<paramdef>int fb_close ( fbp ) fb * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>int fb_read ( fbp , x , y , addr , count ) fb * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>int fb_close ( fbp ) FBIO * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>int fb_read ( fbp , x , y , addr , count ) FBIO * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>RGBpixel <parameter>*addr;</parameter></paramdef>
|
||||
<paramdef>long <parameter>count;</parameter></paramdef>
|
||||
</funcprototype>
|
||||
@@ -35,7 +35,7 @@
|
||||
<paramdef>* <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>RGBpixel * <parameter>addr</parameter></paramdef>
|
||||
<paramdef>long <parameter>count</parameter></paramdef>
|
||||
<paramdef>int fb_rmap ( fbp , cmap ) fb * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>int fb_rmap ( fbp , cmap ) FBIO * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>ColorMap * <parameter>cmap</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
@@ -78,8 +78,8 @@
|
||||
<funcprototype>
|
||||
<funcdef>int <function>fb_cursor</function></funcdef>
|
||||
<paramdef>* <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>int fb_scursor ( fbp , mode , x , y ) fb * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>int fb_setcursor ( fbp , bits , xbits , ybits , xorig , yorig ) fb * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>int fb_scursor ( fbp , mode , x , y ) FBIO * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>int fb_setcursor ( fbp , bits , xbits , ybits , xorig , yorig ) FBIO * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>unsigned char <parameter>bits</parameter>[]</paramdef>
|
||||
<paramdef>int <parameter>xbits</parameter>, <parameter>ybits</parameter>;</paramdef>
|
||||
<paramdef>int <parameter>xorig</parameter>, <parameter>yorig</parameter>;</paramdef>
|
||||
@@ -88,14 +88,14 @@
|
||||
<funcprototype>
|
||||
<funcdef>int <function>fb_window</function></funcdef>
|
||||
<paramdef>* <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>int fb_zoom ( fbp , x , y ) fb * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>/ *Buffered frame buffer I/O: */ int fb_ioinit ( fbp ) fb * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>int fb_zoom ( fbp , x , y ) FBIO * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>/ *Buffered frame buffer I/O: */ int fb_ioinit ( fbp ) FBIO * <parameter>fbp</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>fb_seek</function></funcdef>
|
||||
<paramdef>* <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>void fb_tell ( fbp , xp , yp ) fb * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>void fb_tell ( fbp , xp , yp ) FBIO * <parameter>fbp</parameter></paramdef>
|
||||
<paramdef>int *xp , * <parameter>yp</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
@@ -168,10 +168,10 @@
|
||||
See below for more details. The <emphasis remap="I">width</emphasis>
|
||||
and <emphasis remap="I">height</emphasis> parameters specify the initial
|
||||
size of display desired. If these are zero the default sizes for that
|
||||
device will be used. On a successful open, the frame buffer I/O (fb)
|
||||
device will be used. On a successful open, the frame buffer I/O (FBIO)
|
||||
structure pointer is returned. This structure contains size you were
|
||||
actually given, as well as the maximum possible size for the selected
|
||||
device. A return of fb_NULL indicates failure.
|
||||
device. A return of FBIO_NULL indicates failure.
|
||||
</para>
|
||||
<para><emphasis remap="I">Fb_close</emphasis> simply closes the frame buffer.
|
||||
</para>
|
||||
@@ -214,11 +214,11 @@
|
||||
</para>
|
||||
<para><emphasis remap="I">Fb_gettype</emphasis>
|
||||
returns a pointer to a string describing the frame buffer
|
||||
specified by the fb pointer.
|
||||
specified by the FBIO pointer.
|
||||
</para>
|
||||
<para><emphasis remap="I">Fb_getwidth</emphasis>
|
||||
and <emphasis remap="I">Fb_getheight</emphasis>
|
||||
returns the current size of the fb frame buffer.
|
||||
returns the current size of the FBIO frame buffer.
|
||||
</para>
|
||||
<para>
|
||||
The following routines work in conjunction with those described above
|
||||
@@ -433,7 +433,7 @@
|
||||
<emphasis remap="I">fb_flush</emphasis>
|
||||
return -1 to indicate failure.
|
||||
<emphasis remap="I">Fb_open</emphasis>
|
||||
returns fb_NULL to indicate failure, and a non-null fb structure pointer
|
||||
returns FBIO_NULL to indicate failure, and a non-null FBIO structure pointer
|
||||
upon success.
|
||||
<emphasis remap="I">fb_read</emphasis>,
|
||||
and
|
||||
|
||||
@@ -3850,7 +3850,7 @@ view_pixel(ap)
|
||||
register struct application *ap;
|
||||
{
|
||||
....
|
||||
if( fbp != fb_NULL ) {
|
||||
if( fbp != FBIO_NULL ) {
|
||||
/* Framebuffer output */
|
||||
RES_ACQUIRE( &rt_g.res_syscall );
|
||||
fb_write( fbp, ap->a_x, ap->a_y, (char *)p, 1 );
|
||||
@@ -3891,7 +3891,7 @@ followed a little later by the actual output section:
|
||||
|
||||
<p>
|
||||
case BUFMODE_DYNAMIC:
|
||||
if( fbp != fb_NULL ) {
|
||||
if( fbp != FBIO_NULL ) {
|
||||
RES_ACQUIRE( &rt_g.res_syscall );
|
||||
fb_write( fbp, 0, ap->a_y,
|
||||
scanline[ap->a_y].sl_buf, width );
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
add_subdirectory(bu)
|
||||
add_subdirectory(dm)
|
||||
add_subdirectory(rt)
|
||||
add_subdirectory(fb)
|
||||
|
||||
set(public_hdrs
|
||||
RtServerImpl.h
|
||||
|
||||
+1
-15
@@ -192,21 +192,6 @@ __BEGIN_DECLS
|
||||
|
||||
#define GED_CMD_MAGIC 0x65786563 /**< exec */
|
||||
|
||||
/* fb */
|
||||
|
||||
#define FB_MAGIC 0xfbfb00fb /**< ???? */
|
||||
#define FB_WGL_MAGIC 0x574f4642 /**< WOFB */
|
||||
#define FB_OGL_MAGIC 0x584f4642 /**< XOFB */
|
||||
#define FB_X24_MAGIC 0x58324642 /**< X2FB */
|
||||
#define FB_TK_MAGIC 0x544b4642 /**< TKFB */
|
||||
#define FB_QT_MAGIC 0x51544642 /**< QTFB */
|
||||
#define FB_DEBUG_MAGIC 0x44424642 /**< DBFB */
|
||||
#define FB_DISK_MAGIC 0x44494642 /**< STFB */
|
||||
#define FB_STK_MAGIC 0x53544642 /**< STFB */
|
||||
#define FB_MEMORY_MAGIC 0x4d454642 /**< MEFB */
|
||||
#define FB_REMOTE_MAGIC 0x524d4642 /**< MEFB */
|
||||
#define FB_NULL_MAGIC 0x4e554642 /**< NUFB */
|
||||
|
||||
/* misc */
|
||||
|
||||
#define ANIMATE_MAGIC 0x414e4963 /**< ANIc */
|
||||
@@ -217,6 +202,7 @@ __BEGIN_DECLS
|
||||
#define DB5_RAW_INTERNAL_MAGIC 0x64357269 /**< d5ri */
|
||||
#define DBI_MAGIC 0x57204381 /**< W C? */
|
||||
#define DB_FULL_PATH_MAGIC 0x64626670 /**< dbfp */
|
||||
#define FB_MAGIC 0xfbfb00fb /**< ???? */
|
||||
#define LIGHT_MAGIC 0xdbddbdb7 /**< ???? */
|
||||
#define MF_MAGIC 0x55968058 /**< U??X */
|
||||
#define PIXEL_EXT_MAGIC 0x50787400 /**< Pxt */
|
||||
|
||||
+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, fb *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
|
||||
)
|
||||
|
||||
|
||||
@@ -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 */
|
||||
/** @} */
|
||||
/*
|
||||
|
||||
+4
-6
@@ -91,7 +91,7 @@ typedef struct fb_internal fb;
|
||||
#define FB_NULL (fb *) 0
|
||||
|
||||
/**
|
||||
* assert the integrity of a framebuffer struct.
|
||||
* assert the integrity of an FBIO struct.
|
||||
*/
|
||||
#define FB_CK_FB(_p) BU_CKMAG(_p, FB_MAGIC, "FB")
|
||||
|
||||
@@ -124,6 +124,7 @@ FB_EXPORT extern int fb_writerect(fb *ifp, int xmin, int ymin, int width, int he
|
||||
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);
|
||||
@@ -134,8 +135,6 @@ 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);
|
||||
FB_EXPORT extern int fb_configure_window(fb *, int, int);
|
||||
FB_EXPORT extern int fb_refresh(fb *ifp, int x, int y, int w, int h);
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
FB_EXPORT extern void fb_log(const char *fmt, ...) _BU_ATTR_PRINTF12;
|
||||
#endif
|
||||
@@ -165,9 +164,7 @@ 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 struct fb_platform_specific *fb_get_platform_specific(uint32_t magic);
|
||||
FB_EXPORT extern void fb_put_platform_specific(struct fb_platform_specific *fb_p);
|
||||
FB_EXPORT extern fb *fb_open_existing(const char *file, int _width, int _height, struct fb_platform_specific *fb_p);
|
||||
FB_EXPORT extern int fb_open_existing(fb *ifp, struct fb_platform_specific *fb_p);
|
||||
|
||||
/* backward compatibility hacks */
|
||||
FB_EXPORT extern int fb_reset(fb *ifp);
|
||||
@@ -193,6 +190,7 @@ FB_EXPORT extern int fb_scursor(fb *ifp, int mode, int x, int y);
|
||||
/* 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(fb *ifp, int x, int y, int w, int h);
|
||||
|
||||
/**
|
||||
* report version information about LIBFB
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
set(fb_noinstall_headers
|
||||
fb_platform_specific.h
|
||||
)
|
||||
|
||||
CMAKEFILES(${fb_noinstall_headers})
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -1,130 +0,0 @@
|
||||
/* F B _ P L A T F O R M _ S P E C I F I C . H
|
||||
* 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.
|
||||
*/
|
||||
/** @addtogroup if */
|
||||
/** @{*/
|
||||
/** @file fb_platform_specific.h
|
||||
*
|
||||
* Structure holding information necessary for embedding a
|
||||
* framebuffer in an X11 parent window. This is NOT public API
|
||||
* for libfb, and is not guaranteed to be stable from one
|
||||
* release to the next.
|
||||
*
|
||||
*/
|
||||
/** @} */
|
||||
|
||||
#ifdef FB_USE_INTERNAL_API
|
||||
#ifdef IF_X
|
||||
|
||||
#include "common.h"
|
||||
#include <X11/X.h>
|
||||
|
||||
struct X24_fb_info {
|
||||
Display *dpy;
|
||||
Window win;
|
||||
Window cwinp;
|
||||
Colormap cmap;
|
||||
XVisualInfo *vip;
|
||||
GC gc;
|
||||
};
|
||||
|
||||
#endif /* IF_X */
|
||||
|
||||
#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
|
||||
|
||||
struct ogl_fb_info {
|
||||
Display *dpy;
|
||||
Window win;
|
||||
Colormap cmap;
|
||||
XVisualInfo *vip;
|
||||
GLXContext glxc;
|
||||
int double_buffer;
|
||||
int soft_cmap;
|
||||
};
|
||||
#endif /* IF_OGL */
|
||||
|
||||
|
||||
#ifdef IF_WGL
|
||||
# include <windows.h>
|
||||
/* The wgl interface as currently implemented uses some
|
||||
* X11 types, supplied by Tk. */
|
||||
# include <tk.h>
|
||||
# ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
# endif
|
||||
|
||||
struct wgl_fb_info {
|
||||
Display *dpy;
|
||||
Window win;
|
||||
Colormap cmap;
|
||||
PIXELFORMATDESCRIPTOR *vip;
|
||||
HDC hdc;
|
||||
HGLRC glxc;
|
||||
int double_buffer;
|
||||
int soft_cmap;
|
||||
};
|
||||
#endif /* IF_WGL */
|
||||
|
||||
#ifdef IF_QT
|
||||
struct qt_fb_info {
|
||||
void *qapp;
|
||||
void *qwin;
|
||||
void *qpainter;
|
||||
void *draw;
|
||||
void *qimg;
|
||||
}
|
||||
#endif /* IF_QT */
|
||||
|
||||
#endif /* FB_USE_INTERNAL_API */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -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
@@ -192,8 +192,8 @@ main(int argc, char **argv)
|
||||
bu_exit(1, NULL);
|
||||
}
|
||||
|
||||
fb *ifp;
|
||||
ifp = (fb *) calloc(sizeof(fb), 1);
|
||||
FBIO *ifp;
|
||||
ifp = (FBIO *) calloc(sizeof(FBIO), 1);
|
||||
ifp->if_name = "/dev/tk";
|
||||
ifp->if_magic = FB_MAGIC;
|
||||
char *fbname = "/dev/tk";
|
||||
|
||||
+13
-49
@@ -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
|
||||
@@ -109,22 +72,23 @@ set(LIBDM_SRCS
|
||||
tcl.c
|
||||
vers.c
|
||||
)
|
||||
set_property(SOURCE dm_obj.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
|
||||
BRLCAD_ADDLIB(libdm "${LIBDM_SRCS}" "libged;librt;libfb;${DM_X_LIBS};${DM_TKLIB};${DM_EXTRA_LIBS}")
|
||||
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})
|
||||
|
||||
-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"); */
|
||||
}
|
||||
|
||||
+1
-1
@@ -709,7 +709,7 @@ qt_processEvents(struct dm *dmp)
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_openFb(struct dm *dmp, fb *ifp)
|
||||
qt_openFb(struct dm *dmp, FBIO *ifp)
|
||||
{
|
||||
struct qt_vars *privars = (struct qt_vars *)dmp->dm_vars.priv_vars;
|
||||
|
||||
|
||||
-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
-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,36 +49,17 @@
|
||||
#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"
|
||||
#endif
|
||||
|
||||
/* Embedding windows requires platform specific information */
|
||||
#include "fb/fb_platform_specific.h"
|
||||
|
||||
/**
|
||||
*@brief
|
||||
@@ -107,90 +90,15 @@ static struct dm_obj HeadDMObj; /* head of display manager object list */
|
||||
HIDDEN int
|
||||
dmo_openFb(struct dm_obj *dmop)
|
||||
{
|
||||
struct fb_platform_specific *fb_ps;
|
||||
#ifdef DM_X
|
||||
struct X24_fb_info *xfb_ps;
|
||||
#endif
|
||||
#ifdef DM_OGL
|
||||
struct ogl_fb_info *ofb_ps;
|
||||
#endif
|
||||
#ifdef DM_WGL
|
||||
struct wgl_fb_info *wfb_ps;
|
||||
#endif
|
||||
|
||||
if (!dmop || !dmop->interp)
|
||||
return TCL_ERROR;
|
||||
|
||||
/* already open */
|
||||
if (dmop->dmo_fbs.fbs_fbp != FB_NULL)
|
||||
if (dmop->dmo_fbs.fbs_fbp != fb_NULL)
|
||||
return TCL_OK;
|
||||
|
||||
switch (dmop->dmo_dmp->dm_type) {
|
||||
#ifdef DM_X
|
||||
case DM_TYPE_X:
|
||||
fb_ps = fb_get_platform_specific(FB_X24_MAGIC);
|
||||
xfb_ps = (struct X24_fb_info *)fb_ps->data;
|
||||
xfb_ps->dpy = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy;
|
||||
xfb_ps->win = ((struct x_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->pix;
|
||||
xfb_ps->cwinp = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.priv_vars)->win;
|
||||
xfb_ps->cmap = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.priv_vars)->cmap;
|
||||
xfb_ps->vip = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.priv_vars)->vip;
|
||||
xfb_ps->gc = ((struct x_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->gc;
|
||||
dmop->dmo_fbs.fbs_fbp = fb_open_existing("X", dmop->dmo_dmp->dm_width, dmop->dmo_dmp->dm_height, fb_ps);
|
||||
fb_put_platform_specific(fb_ps);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef DM_OGL
|
||||
case DM_TYPE_OGL:
|
||||
fb_ps = fb_get_platform_specific(FB_OGL_MAGIC);
|
||||
ofb_ps = (struct ogl_fb_info *)fb_ps->data;
|
||||
ofb_ps->dpy = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy;
|
||||
ofb_ps->win = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->win;
|
||||
ofb_ps->cmap = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->cmap;
|
||||
ofb_ps->vip = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->vip;
|
||||
ofb_ps->glxc = ((struct ogl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->glxc;
|
||||
ofb_ps->double_buffer = ((struct ogl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->mvars.doublebuffer;
|
||||
ofb_ps->soft_cmap = 0;
|
||||
dmop->dmo_fbs.fbs_fbp = fb_open_existing("ogl", dmop->dmo_dmp->dm_width, dmop->dmo_dmp->dm_height, fb_ps);
|
||||
fb_put_platform_specific(fb_ps);
|
||||
break;
|
||||
#endif
|
||||
#ifdef DM_WGL
|
||||
case DM_TYPE_WGL:
|
||||
fb_ps = fb_get_platform_specific(FB_OGL_MAGIC);
|
||||
wfb_ps = (struct wgl_fb_info *)fb_ps->data;
|
||||
wfb_ps->dpy = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy;
|
||||
wfb_ps->win = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->win;
|
||||
wfb_ps->cmap = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->cmap;
|
||||
wfb_ps->vip = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->vip;
|
||||
wfb_ps->hdc = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->hdc;
|
||||
wfb_ps->glxc = ((struct wgl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->glxc;
|
||||
wfb_ps->double_buffer = ((struct wgl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->mvars.doublebuffer;
|
||||
wfb_ps->soft_cmap = 0;
|
||||
dmop->dmo_fbs.fbs_fbp = fb_open_existing("wgl", dmop->dmo_dmp->dm_width, dmop->dmo_dmp->dm_height, fb_ps);
|
||||
fb_put_platform_specific(fb_ps);
|
||||
break;
|
||||
#endif
|
||||
default: {
|
||||
Tcl_Obj *obj;
|
||||
|
||||
free((void*)dmop->dmo_fbs.fbs_fbp);
|
||||
dmop->dmo_fbs.fbs_fbp = FB_NULL;
|
||||
|
||||
obj = Tcl_GetObjResult(dmop->interp);
|
||||
if (Tcl_IsShared(obj))
|
||||
obj = Tcl_DuplicateObj(obj);
|
||||
|
||||
Tcl_AppendStringsToObj(obj, "openfb: failed to attach framebuffer interface (unsupported display manager type)\n",
|
||||
(char *)NULL);
|
||||
|
||||
Tcl_SetObjResult(dmop->interp, obj);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (dmop->dmo_fbs.fbs_fbp == FB_NULL) {
|
||||
/* don't use bu_calloc so we can fail slightly more gracefully */
|
||||
if ((dmop->dmo_fbs.fbs_fbp = (fb *)calloc(sizeof(fb), 1)) == fb_NULL) {
|
||||
Tcl_Obj *obj;
|
||||
|
||||
obj = Tcl_GetObjResult(dmop->interp);
|
||||
@@ -204,6 +112,44 @@ dmo_openFb(struct dm_obj *dmop)
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
switch (dmop->dmo_dmp->dm_type) {
|
||||
#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/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;
|
||||
|
||||
_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,
|
||||
dmop->dmo_dmp->dm_width,
|
||||
dmop->dmo_dmp->dm_height,
|
||||
((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 = fb_NULL;
|
||||
|
||||
obj = Tcl_GetObjResult(dmop->interp);
|
||||
if (Tcl_IsShared(obj))
|
||||
obj = Tcl_DuplicateObj(obj);
|
||||
|
||||
Tcl_AppendStringsToObj(obj, "openfb: failed to attach framebuffer interface (unsupported display manager type)\n",
|
||||
(char *)NULL);
|
||||
|
||||
Tcl_SetObjResult(dmop->interp, obj);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -218,13 +164,13 @@ dmo_openFb(struct dm_obj *dmop)
|
||||
HIDDEN int
|
||||
dmo_closeFb(struct dm_obj *dmop)
|
||||
{
|
||||
if (dmop->dmo_fbs.fbs_fbp == FB_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 = FB_NULL;
|
||||
dmop->dmo_fbs.fbs_fbp = fb_NULL;
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -253,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 == FB_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);
|
||||
@@ -318,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 == FB_NULL) {
|
||||
if (dmop->dmo_fbs.fbs_fbp == fb_NULL) {
|
||||
Tcl_Obj *obj;
|
||||
|
||||
obj = Tcl_GetObjResult(dmop->interp);
|
||||
@@ -1821,8 +1767,8 @@ dmo_configure_tcl(void *clientData, int argc, const char **argv)
|
||||
|
||||
#ifdef USE_FBSERV
|
||||
/* configure the framebuffer window */
|
||||
if (dmop->dmo_fbs.fbs_fbp != FB_NULL)
|
||||
(void)fb_configure_window(dmop->dmo_fbs.fbs_fbp,
|
||||
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);
|
||||
#endif
|
||||
@@ -2220,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,
|
||||
@@ -2492,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) */
|
||||
|
||||
|
||||
/*
|
||||
@@ -2503,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))
|
||||
@@ -2514,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");
|
||||
@@ -2772,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;
|
||||
@@ -3127,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;
|
||||
@@ -3136,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;
|
||||
@@ -3201,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 = FB_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;
|
||||
@@ -3235,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);
|
||||
+24
-4
@@ -26,11 +26,31 @@
|
||||
|
||||
#include "./dm_util.h"
|
||||
|
||||
# ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
# endif
|
||||
#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
|
||||
|
||||
#if defined(DM_OGL) || defined(DM_WGL) || defined(DM_RTGL)
|
||||
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
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+11
-34
@@ -9,37 +9,20 @@ set(FB_INCLUDE_DIRS
|
||||
${TCL_INCLUDE_DIRS}
|
||||
${TK_INCLUDE_PATH}
|
||||
${OPENNURBS_INCLUDE_DIR}
|
||||
${OPENTHREADS_INCLUDE_DIR}
|
||||
${OSG_INCLUDE_DIR}
|
||||
${Qt5Widgets_INCLUDE_DIRS}
|
||||
)
|
||||
BRLCAD_LIB_INCLUDE_DIRS(fb FB_INCLUDE_DIRS "")
|
||||
|
||||
set(LINKLIBS "")
|
||||
if(BRLCAD_ENABLE_X11 AND X11_FOUND)
|
||||
set(FBX11DEFS "-DIF_X")
|
||||
set(LINKLIBS ${LINKLIBS} ${X11_LIBRARIES})
|
||||
set(fbX11_srcs if_X24.c)
|
||||
set_property(SOURCE if_X24.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
|
||||
if(BRLCAD_ENABLE_OSG)
|
||||
set(FBOSGDEFS "-DIF_OSG")
|
||||
set(LINKLIBS ${LINKLIBS} ${OSG_LIBRARIES})
|
||||
set(fbosg_srcs if_osg.cpp)
|
||||
endif()
|
||||
if(BRLCAD_ENABLE_OPENGL AND OPENGL_FOUND AND NOT MSVC)
|
||||
set(FBOGLDEFS "-DIF_OGL")
|
||||
set(LINKLIBS ${LINKLIBS} ${OPENGL_LIBRARIES})
|
||||
set(fbogl_srcs if_ogl.c)
|
||||
set_property(SOURCE if_ogl.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
endif()
|
||||
if(WIN32)
|
||||
add_definitions(
|
||||
-DIF_WGL
|
||||
)
|
||||
set(LINKLIBS ${LINKLIBS} opengl32.lib ${TCL_TK_LIBRARY})
|
||||
set(fbwgl_srcs if_wgl.c)
|
||||
set_property(SOURCE if_wgl.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
endif(WIN32)
|
||||
if(BRLCAD_ENABLE_TK)
|
||||
set(FBTKDEFS "-DIF_TK")
|
||||
set(LINKLIBS ${LINKLIBS} ${TK_LIBRARY})
|
||||
set(fbtk_srcs if_tk.c)
|
||||
set_property(SOURCE if_tk.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
endif(BRLCAD_ENABLE_TK)
|
||||
|
||||
if(BRLCAD_ENABLE_QT)
|
||||
CHECK_CXX_FLAG(Wno-float-equal)
|
||||
|
||||
@@ -49,14 +32,10 @@ if(BRLCAD_ENABLE_QT)
|
||||
add_definitions(${Qt5Widgets_DEFINITIONS})
|
||||
set(LINKLIBS ${LINKLIBS} ${Qt5Widgets_LIBRARIES})
|
||||
set(fbqt_srcs if_qt.cpp)
|
||||
set_property(SOURCE if_qt.cpp APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
endif(BRLCAD_ENABLE_QT)
|
||||
|
||||
set(LIBFB_SOURCES
|
||||
${fbX11_srcs}
|
||||
${fbogl_srcs}
|
||||
${fbwgl_srcs}
|
||||
${fbtk_srcs}
|
||||
${fbosg_srcs}
|
||||
${fbqt_srcs}
|
||||
asize.c
|
||||
fb_generic.c
|
||||
@@ -81,6 +60,7 @@ add_definitions(
|
||||
-DIF_AB
|
||||
${FBX11DEFS}
|
||||
${FBOGLDEFS}
|
||||
${FBOSGDEFS}
|
||||
${FBTKDEFS}
|
||||
${XOPEN_DEFINE}
|
||||
${FBQTDEFS}
|
||||
@@ -94,11 +74,8 @@ endif(BRLCAD_BUILD_LOCAL_TK AND BRLCAD_ENABLE_TK)
|
||||
|
||||
set(libfb_ignore_files
|
||||
if_TEMPLATE.c
|
||||
if_X24.c
|
||||
if_ogl.c
|
||||
if_osg.cpp
|
||||
if_qt.cpp
|
||||
if_tk.c
|
||||
if_wgl.c
|
||||
fb_private.h
|
||||
)
|
||||
CMAKEFILES(${libfb_ignore_files})
|
||||
|
||||
+122
-59
@@ -61,6 +61,7 @@ fb *_if_list[] = {
|
||||
#endif
|
||||
#ifdef IF_X
|
||||
&X24_interface,
|
||||
&X_interface,
|
||||
#endif
|
||||
#ifdef IF_TK
|
||||
&tk_interface,
|
||||
@@ -107,64 +108,25 @@ void fb_set_interface(fb *ifp, const char *interface)
|
||||
}
|
||||
}
|
||||
|
||||
struct fb_platform_specific *
|
||||
fb_get_platform_specific(uint32_t magic)
|
||||
#if 0
|
||||
void fb_open_existing(fb *ifp, const char *interface)
|
||||
{
|
||||
int i = 0;
|
||||
if (!magic) return NULL;
|
||||
while (_if_list[i] != FB_NULL) {
|
||||
if (magic == _if_list[i]->type_magic) {
|
||||
/* found it, get its specific struct */
|
||||
return (*(_if_list[i])).if_existing_get(magic);
|
||||
fb *curr_interface = fb_type_structs[i];
|
||||
fb *new_interface = FB_NULL;
|
||||
if (!ifp) return;
|
||||
while (curr_interface != FB_NULL && new_interface == FB_NULL) {
|
||||
if (!strcasecmp(interface, fb_type_strings[i])) {
|
||||
new_interface = curr_interface;
|
||||
} else {
|
||||
curr_interface = fb_type_structs[i+1];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
fb_put_platform_specific(struct fb_platform_specific *fb_p)
|
||||
{
|
||||
int i = 0;
|
||||
if (!fb_p) return;
|
||||
while (_if_list[i] != FB_NULL) {
|
||||
if (fb_p->magic == _if_list[i]->type_magic) {
|
||||
/* found it, clear its specific struct */
|
||||
(*(_if_list[i])).if_existing_put(fb_p);
|
||||
return;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fb *
|
||||
fb_open_existing(const char *file, int width, int height, struct fb_platform_specific *fb_p)
|
||||
{
|
||||
fb *ifp = (fb *) calloc(sizeof(fb), 1);
|
||||
fb_set_interface(ifp, file);
|
||||
fb_set_magic(ifp, FB_MAGIC);
|
||||
ifp->if_open_existing(ifp, width, height, fb_p);
|
||||
return ifp;
|
||||
}
|
||||
|
||||
int
|
||||
fb_refresh(fb *ifp, int x, int y, int w, int h)
|
||||
{
|
||||
return ifp->if_refresh(ifp, x, y, w, h);
|
||||
}
|
||||
|
||||
int
|
||||
fb_configure_window(fb *ifp, int width, int height)
|
||||
{
|
||||
/* unknown/unset framebuffer */
|
||||
if (!ifp || !ifp->if_configure_window || width < 0 || height < 0) {
|
||||
return 0;
|
||||
}
|
||||
return ifp->if_configure_window(ifp, width, height);
|
||||
if (new_interface == FB_NULL) new_interface = &null_interface;
|
||||
*ifp = *new_interface;
|
||||
}
|
||||
#endif
|
||||
|
||||
void fb_set_name(fb *ifp, const char *name)
|
||||
{
|
||||
@@ -316,10 +278,18 @@ int fb_bwwriterect(fb *ifp, int xmin, int ymin, int width, int height, const uns
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern int X24_close_existing(fb *ifp);
|
||||
extern int ogl_close_existing(fb *ifp);
|
||||
extern int wgl_close_existing(fb *ifp);
|
||||
extern int qt_close_existing(fb *ifp);
|
||||
|
||||
|
||||
#define Malloc_Bomb(_bytes_) \
|
||||
fb_log("\"%s\"(%d) : allocation of %lu bytes failed.\n", \
|
||||
__FILE__, __LINE__, _bytes_)
|
||||
|
||||
|
||||
/**
|
||||
* True if the non-null string s is all digits
|
||||
*/
|
||||
@@ -490,7 +460,6 @@ fb_close(fb *ifp)
|
||||
int
|
||||
fb_close_existing(fb *ifp)
|
||||
{
|
||||
int status = 0;
|
||||
if (!ifp)
|
||||
return 0;
|
||||
|
||||
@@ -500,14 +469,108 @@ fb_close_existing(fb *ifp)
|
||||
|
||||
/* FIXME: these should be callbacks, not listed directly */
|
||||
|
||||
status = ifp->if_close_existing(ifp);
|
||||
|
||||
if (status <= -1) {
|
||||
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
|
||||
return BRLCAD_ERROR;
|
||||
#ifdef IF_X
|
||||
{
|
||||
if (BU_STR_EQUIV(ifp->if_name, X24_interface.if_name)) {
|
||||
int status = -1;
|
||||
if ((status = X24_close_existing(ifp)) <= -1) {
|
||||
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
|
||||
return BRLCAD_ERROR;
|
||||
}
|
||||
if (ifp->if_pbase != PIXEL_NULL) {
|
||||
free((void *)ifp->if_pbase);
|
||||
}
|
||||
free((void *)ifp->if_name);
|
||||
free((void *)ifp);
|
||||
return BRLCAD_OK;
|
||||
}
|
||||
}
|
||||
fb_put(ifp);
|
||||
return BRLCAD_OK;
|
||||
#endif /* IF_X */
|
||||
|
||||
#ifdef IF_WGL
|
||||
{
|
||||
if (BU_STR_EQUIV(ifp->if_name, wgl_interface.if_name)) {
|
||||
int status = -1;
|
||||
if ((status = wgl_close_existing(ifp)) <= -1) {
|
||||
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
|
||||
return BRLCAD_ERROR;
|
||||
}
|
||||
if (ifp->if_pbase != PIXEL_NULL)
|
||||
free((void *)ifp->if_pbase);
|
||||
free((void *)ifp->if_name);
|
||||
free((void *)ifp);
|
||||
return BRLCAD_OK;
|
||||
}
|
||||
}
|
||||
#endif /* IF_WGL */
|
||||
|
||||
#ifdef IF_OGL
|
||||
{
|
||||
if (BU_STR_EQUIV(ifp->if_name, ogl_interface.if_name)) {
|
||||
int status = -1;
|
||||
if ((status = ogl_close_existing(ifp)) <= -1) {
|
||||
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
|
||||
return BRLCAD_ERROR;
|
||||
}
|
||||
if (ifp->if_pbase != PIXEL_NULL)
|
||||
free((void *)ifp->if_pbase);
|
||||
free((void *)ifp->if_name);
|
||||
free((void *)ifp);
|
||||
return BRLCAD_OK;
|
||||
}
|
||||
}
|
||||
#endif /* IF_OGL */
|
||||
|
||||
#ifdef IF_RTGL
|
||||
{
|
||||
if (BU_STR_EQUIV(ifp->if_name, ogl_interface.if_name)) {
|
||||
int status = -1;
|
||||
if ((status = ogl_close_existing(ifp)) <= -1) {
|
||||
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
|
||||
return BRLCAD_ERROR;
|
||||
}
|
||||
if (ifp->if_pbase != PIXEL_NULL)
|
||||
free((void *)ifp->if_pbase);
|
||||
free((void *)ifp->if_name);
|
||||
free((void *)ifp);
|
||||
return BRLCAD_OK;
|
||||
}
|
||||
}
|
||||
#endif /* IF_RTGL */
|
||||
|
||||
#ifdef IF_TK
|
||||
{
|
||||
if (BU_STR_EQUIV(ifp->if_name, tk_interface.if_name)) {
|
||||
/* may need to close_existing here at some point */
|
||||
if (ifp->if_pbase != PIXEL_NULL)
|
||||
free((void *)ifp->if_pbase);
|
||||
free((void *)ifp->if_name);
|
||||
free((void *)ifp);
|
||||
return BRLCAD_OK;
|
||||
}
|
||||
}
|
||||
#endif /* IF_TK */
|
||||
|
||||
#ifdef IF_QT
|
||||
{
|
||||
if (BU_STR_EQUIV(ifp->if_name, qt_interface.if_name)) {
|
||||
int status = -1;
|
||||
if ((status = qt_close_existing(ifp)) <= -1) {
|
||||
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
|
||||
return BRLCAD_ERROR;
|
||||
}
|
||||
if (ifp->if_pbase != PIXEL_NULL)
|
||||
free((void *)ifp->if_pbase);
|
||||
free((void *)ifp->if_name);
|
||||
free((void *)ifp);
|
||||
return BRLCAD_OK;
|
||||
}
|
||||
}
|
||||
#endif /* IF_QT */
|
||||
|
||||
fb_log("fb_close_existing: cannot close device\nifp: %s\n", ifp->if_name);
|
||||
|
||||
return BRLCAD_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -722,7 +722,7 @@ fbo_configure_tcl(void *clientData, int argc, const char **argv)
|
||||
|
||||
/* configure the framebuffer window */
|
||||
if (fbop->fbo_fbs.fbs_fbp != FB_NULL)
|
||||
(void)fb_configure_window(fbop->fbo_fbs.fbs_fbp, width, height);
|
||||
fb_configureWindow(fbop->fbo_fbs.fbs_fbp, width, height);
|
||||
|
||||
return BRLCAD_OK;
|
||||
}
|
||||
|
||||
+54
-10
@@ -35,6 +35,7 @@
|
||||
|
||||
/* declare all the possible interfaces */
|
||||
#ifdef IF_X
|
||||
FB_EXPORT extern fb X_interface;
|
||||
FB_EXPORT extern fb X24_interface;
|
||||
#endif
|
||||
#ifdef IF_OGL
|
||||
@@ -65,19 +66,12 @@ __BEGIN_DECLS
|
||||
*
|
||||
* One of these is allocated for each active framebuffer. A pointer
|
||||
* to this structure is the first argument to all the library
|
||||
* routines. The details of the structure are hidden behind function
|
||||
* calls in the fb.h API - no code external to libfb should work
|
||||
* directly with structure members.
|
||||
* routines. TODO - see if this can move to a private header.
|
||||
*/
|
||||
struct fb_internal {
|
||||
uint32_t if_magic;
|
||||
uint32_t type_magic;
|
||||
/* Static information: per device TYPE. */
|
||||
int (*if_open)(struct fb_internal *ifp, const char *file, int _width, int _height); /**< @brief open device */
|
||||
int (*if_open_existing)(struct fb_internal *ifp, int width, int height, struct fb_platform_specific *fb_p); /**< @brief open device */
|
||||
int (*if_close_existing)(struct fb_internal *ifp); /**< @brief close embedded fb */
|
||||
struct fb_platform_specific *(*if_existing_get)(uint32_t magic); /**< @brief allocate memory for platform specific container*/
|
||||
void (*if_existing_put)(struct fb_platform_specific *fb_p); /**< @brief free memory for platform specific container */
|
||||
int (*if_close)(struct fb_internal *ifp); /**< @brief close device */
|
||||
int (*if_clear)(struct fb_internal *ifp, unsigned char *pp); /**< @brief clear device */
|
||||
ssize_t (*if_read)(struct fb_internal *ifp, int x, int y, unsigned char *pp, size_t count); /**< @brief read pixels */
|
||||
@@ -93,8 +87,6 @@ struct fb_internal {
|
||||
int (*if_writerect)(struct fb_internal *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp); /**< @brief write rectangle */
|
||||
int (*if_bwreadrect)(struct fb_internal *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp); /**< @brief read monochrome rectangle */
|
||||
int (*if_bwwriterect)(struct fb_internal *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp); /**< @brief write rectangle */
|
||||
int (*if_configure_window)(struct fb_internal *ifp, int width, int height); /**< @brief configure window */
|
||||
int (*if_refresh)(struct fb_internal *ifp, int x, int y, int w, int h); /**< @brief refresh window */
|
||||
int (*if_poll)(struct fb_internal *ifp); /**< @brief handle events */
|
||||
int (*if_flush)(struct fb_internal *ifp); /**< @brief flush output */
|
||||
int (*if_free)(struct fb_internal *ifp); /**< @brief free resources */
|
||||
@@ -131,6 +123,58 @@ struct fb_internal {
|
||||
} u1, u2, u3, u4, u5, u6;
|
||||
};
|
||||
|
||||
|
||||
#ifdef IF_X
|
||||
# ifdef HAVE_X11_XLIB_H
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xutil.h>
|
||||
# endif
|
||||
FB_EXPORT extern int _X24_open_existing(fb *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(fb *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(fb *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(fb *ifp, int width, int height, void *qapp, void *qwin, void *qpainter, void *draw, void **qimg);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Some functions and variables we couldn't hide.
|
||||
* Not for general consumption.
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
HIDDEN int
|
||||
DEVNAME_open(fb *ifp, const char *file, int width, int height)
|
||||
{
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FB(ifp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
-3573
File diff suppressed because it is too large
Load Diff
@@ -70,30 +70,6 @@ deb_open(fb *ifp, const char *file, int width, int height)
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN struct fb_platform_specific *
|
||||
deb_get_fbps(uint32_t UNUSED(magic))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN void
|
||||
deb_put_fbps(struct fb_platform_specific *UNUSED(fbps))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
deb_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
deb_close_existing(fb *UNUSED(ifp))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
deb_close(fb *ifp)
|
||||
@@ -103,17 +79,6 @@ deb_close(fb *ifp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
deb_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
deb_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
deb_clear(fb *ifp, unsigned char *pp)
|
||||
@@ -361,12 +326,7 @@ Usage: /dev/debug[#]\n\
|
||||
/* This is the ONLY thing that we "export" */
|
||||
fb debug_interface = {
|
||||
0,
|
||||
FB_DEBUG_MAGIC,
|
||||
deb_open,
|
||||
deb_open_existing,
|
||||
deb_close_existing,
|
||||
deb_get_fbps,
|
||||
deb_put_fbps,
|
||||
deb_close,
|
||||
deb_clear,
|
||||
deb_read,
|
||||
@@ -382,8 +342,6 @@ fb debug_interface = {
|
||||
deb_writerect,
|
||||
deb_bwreadrect,
|
||||
deb_bwwriterect,
|
||||
deb_configure_window,
|
||||
deb_refresh,
|
||||
deb_poll,
|
||||
deb_flush,
|
||||
deb_free,
|
||||
|
||||
@@ -100,42 +100,6 @@ dsk_open(fb *ifp, const char *file, int width, int height)
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN struct fb_platform_specific *
|
||||
dsk_get_fbps(uint32_t UNUSED(magic))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN void
|
||||
dsk_put_fbps(struct fb_platform_specific *UNUSED(fbps))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
dsk_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
dsk_close_existing(fb *UNUSED(ifp))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
dsk_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
dsk_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
dsk_close(fb *ifp)
|
||||
@@ -357,12 +321,7 @@ dsk_help(fb *ifp)
|
||||
|
||||
fb disk_interface = {
|
||||
0,
|
||||
FB_DISK_MAGIC,
|
||||
dsk_open,
|
||||
dsk_open_existing,
|
||||
dsk_close_existing,
|
||||
dsk_get_fbps,
|
||||
dsk_put_fbps,
|
||||
dsk_close,
|
||||
dsk_clear,
|
||||
dsk_read,
|
||||
@@ -378,8 +337,6 @@ fb disk_interface = {
|
||||
fb_sim_writerect,
|
||||
fb_sim_bwreadrect,
|
||||
fb_sim_bwwriterect,
|
||||
dsk_configure_window,
|
||||
dsk_refresh,
|
||||
fb_null, /* poll */
|
||||
fb_null, /* flush */
|
||||
dsk_free,
|
||||
|
||||
@@ -186,42 +186,6 @@ mem_open(fb *ifp, const char *file, int width, int height)
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN struct fb_platform_specific *
|
||||
mem_get_fbps(uint32_t UNUSED(magic))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN void
|
||||
mem_put_fbps(struct fb_platform_specific *UNUSED(fbps))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
mem_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
mem_close_existing(fb *UNUSED(ifp))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
mem_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
mem_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
mem_close(fb *ifp)
|
||||
@@ -470,12 +434,7 @@ mem_help(fb *ifp)
|
||||
/* This is the ONLY thing that we normally "export" */
|
||||
fb memory_interface = {
|
||||
0,
|
||||
FB_MEMORY_MAGIC,
|
||||
mem_open, /* device_open */
|
||||
mem_open_existing, /* existing device_open */
|
||||
mem_close_existing, /* existing device_close */
|
||||
mem_get_fbps,
|
||||
mem_put_fbps,
|
||||
mem_close, /* device_close */
|
||||
mem_clear, /* device_clear */
|
||||
mem_read, /* buffer_read */
|
||||
@@ -491,8 +450,6 @@ fb memory_interface = {
|
||||
fb_sim_writerect, /* rectangle write */
|
||||
fb_sim_bwreadrect,
|
||||
fb_sim_bwwriterect,
|
||||
mem_configure_window,
|
||||
mem_refresh,
|
||||
mem_poll, /* poll */
|
||||
mem_flush, /* flush */
|
||||
mem_close, /* free */
|
||||
|
||||
@@ -50,42 +50,6 @@ null_open(fb *ifp, const char *UNUSED(file), int width, int height)
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN struct fb_platform_specific *
|
||||
null_get_fbps(uint32_t UNUSED(magic))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN void
|
||||
null_put_fbps(struct fb_platform_specific *UNUSED(fbps))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
null_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
null_close_existing(fb *UNUSED(ifp))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
null_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
null_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
null_close(fb *ifp)
|
||||
@@ -256,12 +220,7 @@ null_help(fb *ifp)
|
||||
/* This is the ONLY thing that we normally "export" */
|
||||
fb null_interface = {
|
||||
0,
|
||||
FB_NULL_MAGIC,
|
||||
null_open, /* device_open */
|
||||
null_open_existing, /* existing device_open */
|
||||
null_close_existing,/* existing device_close */
|
||||
null_get_fbps,
|
||||
null_put_fbps,
|
||||
null_close, /* device_close */
|
||||
null_clear, /* device_clear */
|
||||
null_read, /* buffer_read */
|
||||
@@ -277,8 +236,6 @@ fb null_interface = {
|
||||
null_writerect, /* rectangle write */
|
||||
null_readrect, /* bw rectangle read */
|
||||
null_writerect, /* bw rectangle write */
|
||||
null_configure_window,
|
||||
null_refresh,
|
||||
null_poll, /* handle events */
|
||||
null_flush, /* flush output */
|
||||
null_free, /* free resources */
|
||||
|
||||
-2447
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,734 @@
|
||||
/* I F _ O S G . C P P
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 1989-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 if */
|
||||
/** @{ */
|
||||
/** @file if_osg.cpp
|
||||
*
|
||||
* A OpenSceneGraph Frame Buffer.
|
||||
*
|
||||
*/
|
||||
/** @} */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern "C" {
|
||||
#include "bu/log.h"
|
||||
#include "bu/str.h"
|
||||
#include "fb_private.h"
|
||||
#include "fb.h"
|
||||
}
|
||||
|
||||
#include <osg/GraphicsContext>
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
#include <osgGA/StateSetManipulator>
|
||||
|
||||
#include <osg/ImageUtils>
|
||||
#include <osg/TextureRectangle>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Timer>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
/* The following is a customization of StandardManipulator for Framebuffer applications */
|
||||
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* 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
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*
|
||||
* OrbitManipulator code Copyright (C) 2010 PCJohn (Jan Peciva)
|
||||
* while some pieces of code were taken from OSG.
|
||||
* Thanks to company Cadwork (www.cadwork.ch) and
|
||||
* Brno University of Technology (www.fit.vutbr.cz) for open-sourcing this work.
|
||||
*/
|
||||
|
||||
#include <osgGA/StandardManipulator>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgGA;
|
||||
|
||||
namespace osgGA {
|
||||
|
||||
|
||||
/** FrameBufferManipulator is base class for interacting with a framebuffer .*/
|
||||
class OSGGA_EXPORT FrameBufferManipulator : public StandardManipulator
|
||||
{
|
||||
typedef StandardManipulator inherited;
|
||||
|
||||
public:
|
||||
|
||||
FrameBufferManipulator( int flags = DEFAULT_SETTINGS );
|
||||
FrameBufferManipulator( const FrameBufferManipulator& om,
|
||||
const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
|
||||
|
||||
META_Object( osgGA, FrameBufferManipulator );
|
||||
|
||||
virtual void setByMatrix( const osg::Matrixd& matrix );
|
||||
virtual void setByInverseMatrix( const osg::Matrixd& matrix );
|
||||
virtual osg::Matrixd getMatrix() const;
|
||||
virtual osg::Matrixd getInverseMatrix() const;
|
||||
|
||||
virtual void setTransformation( const osg::Vec3d& eye, const osg::Quat& rotation );
|
||||
virtual void setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up );
|
||||
virtual void getTransformation( osg::Vec3d& eye, osg::Quat& rotation ) const;
|
||||
virtual void getTransformation( osg::Vec3d& eye, osg::Vec3d& center, osg::Vec3d& up ) const;
|
||||
|
||||
virtual osgUtil::SceneView::FusionDistanceMode getFusionDistanceMode() const;
|
||||
virtual float getFusionDistanceValue() const;
|
||||
|
||||
protected:
|
||||
|
||||
osg::Vec3d _center;
|
||||
osg::Quat _rotation;
|
||||
double _distance;
|
||||
|
||||
double _minimumDistance;
|
||||
static int _minimumDistanceFlagIndex;
|
||||
};
|
||||
|
||||
|
||||
int FrameBufferManipulator::_minimumDistanceFlagIndex = allocateRelativeFlag();
|
||||
|
||||
|
||||
/// Constructor.
|
||||
FrameBufferManipulator::FrameBufferManipulator( int flags )
|
||||
: inherited( flags ), _distance( 1. )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// Constructor.
|
||||
FrameBufferManipulator::FrameBufferManipulator( const FrameBufferManipulator& om, const CopyOp& copyOp )
|
||||
: osg::Object(om, copyOp), inherited( om, copyOp ), _center( om._center ),
|
||||
_rotation( om._rotation ), _distance( om._distance ), _minimumDistance( om._minimumDistance )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/** Set the position of the manipulator using a 4x4 matrix.*/
|
||||
void FrameBufferManipulator::setByMatrix( const osg::Matrixd& matrix )
|
||||
{
|
||||
_center = osg::Vec3d( 0., 0., -_distance ) * matrix;
|
||||
_rotation = matrix.getRotate();
|
||||
|
||||
// fix current rotation
|
||||
if( getVerticalAxisFixed() )
|
||||
fixVerticalAxis( _center, _rotation, true );
|
||||
}
|
||||
|
||||
|
||||
/** Set the position of the manipulator using a 4x4 matrix.*/
|
||||
void FrameBufferManipulator::setByInverseMatrix( const osg::Matrixd& matrix )
|
||||
{
|
||||
setByMatrix( osg::Matrixd::inverse( matrix ) );
|
||||
}
|
||||
|
||||
|
||||
/** Get the position of the manipulator as 4x4 matrix.*/
|
||||
osg::Matrixd FrameBufferManipulator::getMatrix() const
|
||||
{
|
||||
return osg::Matrixd::translate( 0., 0., _distance ) *
|
||||
osg::Matrixd::rotate( _rotation ) *
|
||||
osg::Matrixd::translate( _center );
|
||||
}
|
||||
|
||||
|
||||
/** Get the position of the manipulator as a inverse matrix of the manipulator,
|
||||
typically used as a model view matrix.*/
|
||||
osg::Matrixd FrameBufferManipulator::getInverseMatrix() const
|
||||
{
|
||||
return osg::Matrixd::translate( -_center ) *
|
||||
osg::Matrixd::rotate( _rotation.inverse() ) *
|
||||
osg::Matrixd::translate( 0.0, 0.0, -_distance );
|
||||
}
|
||||
|
||||
|
||||
// doc in parent
|
||||
void FrameBufferManipulator::setTransformation( const osg::Vec3d& eye, const osg::Quat& rotation )
|
||||
{
|
||||
_center = eye + rotation * osg::Vec3d( 0., 0., -_distance );
|
||||
_rotation = rotation;
|
||||
|
||||
// fix current rotation
|
||||
if( getVerticalAxisFixed() )
|
||||
fixVerticalAxis( _center, _rotation, true );
|
||||
}
|
||||
|
||||
|
||||
// doc in parent
|
||||
void FrameBufferManipulator::getTransformation( osg::Vec3d& eye, osg::Quat& rotation ) const
|
||||
{
|
||||
eye = _center - _rotation * osg::Vec3d( 0., 0., -_distance );
|
||||
rotation = _rotation;
|
||||
}
|
||||
|
||||
|
||||
// doc in parent
|
||||
void FrameBufferManipulator::setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up )
|
||||
{
|
||||
Vec3d lv( center - eye );
|
||||
|
||||
Vec3d f( lv );
|
||||
f.normalize();
|
||||
Vec3d s( f^up );
|
||||
s.normalize();
|
||||
Vec3d u( s^f );
|
||||
u.normalize();
|
||||
|
||||
osg::Matrixd rotation_matrix( s[0], u[0], -f[0], 0.0f,
|
||||
s[1], u[1], -f[1], 0.0f,
|
||||
s[2], u[2], -f[2], 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f );
|
||||
|
||||
_center = center;
|
||||
_distance = lv.length();
|
||||
_rotation = rotation_matrix.getRotate().inverse();
|
||||
|
||||
// fix current rotation
|
||||
if( getVerticalAxisFixed() )
|
||||
fixVerticalAxis( _center, _rotation, true );
|
||||
}
|
||||
|
||||
|
||||
// doc in parent
|
||||
void FrameBufferManipulator::getTransformation( osg::Vec3d& eye, osg::Vec3d& center, osg::Vec3d& up ) const
|
||||
{
|
||||
center = _center;
|
||||
eye = _center + _rotation * osg::Vec3d( 0., 0., _distance );
|
||||
up = _rotation * osg::Vec3d( 0., 1., 0. );
|
||||
}
|
||||
|
||||
/** Get the FusionDistanceMode. Used by SceneView for setting up stereo convergence.*/
|
||||
osgUtil::SceneView::FusionDistanceMode FrameBufferManipulator::getFusionDistanceMode() const
|
||||
{
|
||||
return osgUtil::SceneView::USE_FUSION_DISTANCE_VALUE;
|
||||
}
|
||||
|
||||
/** Get the FusionDistanceValue. Used by SceneView for setting up stereo convergence.*/
|
||||
float FrameBufferManipulator::getFusionDistanceValue() const
|
||||
{
|
||||
return _distance;
|
||||
}
|
||||
|
||||
} // end osgGA namespace
|
||||
|
||||
/*********************************************************************************************/
|
||||
/**************************** End FrameBufferManipulator *************************************/
|
||||
/*********************************************************************************************/
|
||||
|
||||
// KeyHandler --
|
||||
// Allow user to do interesting things with an
|
||||
// OcclusionQueryNode-enabled scene graph at run time.
|
||||
class KeyHandler : public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
KeyHandler( osg::Node& node )
|
||||
: _node( node ),
|
||||
_enable( true ),
|
||||
_debug( false )
|
||||
{}
|
||||
|
||||
bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& )
|
||||
{
|
||||
switch( ea.getEventType() )
|
||||
{
|
||||
case(osgGA::GUIEventAdapter::KEYUP):
|
||||
{
|
||||
if (ea.getKey()==osgGA::GUIEventAdapter::KEY_F6)
|
||||
{
|
||||
// F6 -- Toggle osgOQ testing.
|
||||
std::cout << "F6!";
|
||||
return true;
|
||||
}
|
||||
else if (ea.getKey()==osgGA::GUIEventAdapter::KEY_F7)
|
||||
{
|
||||
// F7 -- Toggle display of OQ test bounding volumes
|
||||
std::cout << "F7!";
|
||||
return true;
|
||||
}
|
||||
else if (ea.getKey()==osgGA::GUIEventAdapter::KEY_F8)
|
||||
{
|
||||
// F8 -- Gether stats and display
|
||||
std::cout << "F8!";
|
||||
return true;
|
||||
}
|
||||
else if (ea.getKey()==osgGA::GUIEventAdapter::KEY_F9)
|
||||
{
|
||||
// F9 -- Remove all OcclusionQueryNodes
|
||||
std::cout << "F9!";
|
||||
return true;
|
||||
}
|
||||
else if (ea.getKey()=='o')
|
||||
{
|
||||
std::cout << "o!";
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case(osgGA::GUIEventAdapter::PUSH):
|
||||
{
|
||||
std::cout << "PUSH!\n";
|
||||
return false;
|
||||
}
|
||||
case(osgGA::GUIEventAdapter::RELEASE):
|
||||
{
|
||||
std::cout << "RELEASE!\n";
|
||||
return false;
|
||||
}
|
||||
case(osgGA::GUIEventAdapter::DOUBLECLICK):
|
||||
{
|
||||
std::cout << "DOUBLECLICK!\n";
|
||||
return false;
|
||||
}
|
||||
case(osgGA::GUIEventAdapter::DRAG):
|
||||
{
|
||||
std::cout << "DRAG!\n";
|
||||
return false;
|
||||
}
|
||||
case(osgGA::GUIEventAdapter::MOVE):
|
||||
{
|
||||
std::cout << "MOVE!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
osg::Node& _node;
|
||||
|
||||
bool _enable, _debug;
|
||||
};
|
||||
/*********************************************************************************************/
|
||||
/*********************************** End KeyHandler ******************************************/
|
||||
/*********************************************************************************************/
|
||||
|
||||
|
||||
struct osginfo {
|
||||
osgViewer::Viewer *viewer;
|
||||
osg::Image *image;
|
||||
osg::TextureRectangle *texture;
|
||||
osg::Geometry *pictureQuad;
|
||||
osg::Timer *timer;
|
||||
int last_update_time;
|
||||
};
|
||||
|
||||
#define OSG(ptr) ((struct osginfo *)((ptr)->u6.p))
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_open(fb *ifp, const char *UNUSED(file), int width, int height)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
/* Get some memory for the osg specific stuff */
|
||||
if ((ifp->u6.p = (char *)calloc(1, sizeof(struct osginfo))) == NULL) {
|
||||
fb_log("fb_osg_open: osginfo malloc failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (width > 0)
|
||||
ifp->if_width = width;
|
||||
if (height > 0)
|
||||
ifp->if_height = height;
|
||||
|
||||
OSG(ifp)->timer = new osg::Timer;
|
||||
OSG(ifp)->last_update_time = 0;
|
||||
|
||||
OSG(ifp)->viewer = new osgViewer::Viewer();
|
||||
OSG(ifp)->viewer->setUpViewInWindow(0, 0, width, height);
|
||||
|
||||
OSG(ifp)->image = new osg::Image;
|
||||
OSG(ifp)->image->allocateImage(width, height, 1, GL_RGB, GL_UNSIGNED_BYTE);
|
||||
OSG(ifp)->image->setPixelBufferObject(new osg::PixelBufferObject(OSG(ifp)->image));
|
||||
OSG(ifp)->pictureQuad = osg::createTexturedQuadGeometry(osg::Vec3(0.0f,0.0f,0.0f),
|
||||
osg::Vec3(ifp->if_width,0.0f,0.0f), osg::Vec3(0.0f,0.0f, ifp->if_height), 0.0f, 0.0, OSG(ifp)->image->s(), OSG(ifp)->image->t());
|
||||
OSG(ifp)->texture = new osg::TextureRectangle(OSG(ifp)->image);
|
||||
OSG(ifp)->texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
|
||||
OSG(ifp)->texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
|
||||
OSG(ifp)->texture->setWrap(osg::Texture::WRAP_R,osg::Texture::REPEAT);
|
||||
OSG(ifp)->pictureQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0, OSG(ifp)->texture, osg::StateAttribute::ON);
|
||||
|
||||
|
||||
osg::Geode *geode = new osg::Geode;
|
||||
osg::StateSet* stateset = geode->getOrCreateStateSet();
|
||||
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
geode->addDrawable(OSG(ifp)->pictureQuad);
|
||||
|
||||
OSG(ifp)->viewer->getCamera()->setViewMatrix(osg::Matrix::identity());
|
||||
osg::Vec3 topleft(0.0f, 0.0f, 0.0f);
|
||||
osg::Vec3 bottomright(width, height, 0.0f);
|
||||
OSG(ifp)->viewer->getCamera()->setProjectionMatrixAsOrtho2D(-width/2,width/2,-height/2, height/2);
|
||||
OSG(ifp)->viewer->getCamera()->setClearColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
|
||||
|
||||
OSG(ifp)->viewer->setSceneData(geode);
|
||||
|
||||
OSG(ifp)->viewer->setCameraManipulator( new osgGA::FrameBufferManipulator() );
|
||||
OSG(ifp)->viewer->addEventHandler(new osgGA::StateSetManipulator(OSG(ifp)->viewer->getCamera()->getOrCreateStateSet()));
|
||||
OSG(ifp)->viewer->addEventHandler(new KeyHandler(*geode));
|
||||
|
||||
OSG(ifp)->viewer->realize();
|
||||
|
||||
OSG(ifp)->timer->setStartTick();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
osg_close(fb *ifp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
return (*OSG(ifp)->viewer).ViewerBase::run();
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_clear(fb *ifp, unsigned char *UNUSED(pp))
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN ssize_t
|
||||
osg_read(fb *ifp, int UNUSED(x), int UNUSED(y), unsigned char *UNUSED(pixelp), size_t count)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN ssize_t
|
||||
osg_write(fb *ifp, int xstart, int ystart, const unsigned char *pixelp, size_t count)
|
||||
{
|
||||
register int x;
|
||||
register int y;
|
||||
size_t scan_count; /* # pix on this scanline */
|
||||
size_t pix_count; /* # pixels to send */
|
||||
ssize_t ret;
|
||||
|
||||
//fb_log("write got called!");
|
||||
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
/* fast exit cases */
|
||||
pix_count = count;
|
||||
if (pix_count == 0)
|
||||
return 0; /* OK, no pixels transferred */
|
||||
|
||||
x = xstart;
|
||||
y = ystart;
|
||||
|
||||
if (x < 0 || x >= ifp->if_width ||
|
||||
y < 0 || y >= ifp->if_height)
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
while (pix_count) {
|
||||
void *scanline;
|
||||
|
||||
if (y >= ifp->if_height)
|
||||
break;
|
||||
|
||||
if (pix_count >= (size_t)(ifp->if_width-x))
|
||||
scan_count = (size_t)(ifp->if_width-x);
|
||||
else
|
||||
scan_count = pix_count;
|
||||
|
||||
scanline = (void *)(OSG(ifp)->image->data(0,y,0));
|
||||
|
||||
memcpy(scanline, pixelp, scan_count*3);
|
||||
|
||||
ret += scan_count;
|
||||
pix_count -= scan_count;
|
||||
x = 0;
|
||||
if (++y >= ifp->if_height)
|
||||
break;
|
||||
}
|
||||
|
||||
OSG(ifp)->image->dirty();
|
||||
if (OSG(ifp)->timer->time_m() - OSG(ifp)->last_update_time > 10) {
|
||||
OSG(ifp)->viewer->frame();
|
||||
OSG(ifp)->last_update_time = OSG(ifp)->timer->time_m();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_rmap(fb *ifp, ColorMap *UNUSED(cmp))
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_wmap(fb *ifp, const ColorMap *UNUSED(cmp))
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
fb_log("wmap got called!");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_view(fb *ifp, int UNUSED(xcenter), int UNUSED(ycenter), int UNUSED(xzoom), int UNUSED(yzoom))
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("view was called!\n");
|
||||
|
||||
/*fb_sim_view(ifp, xcenter, ycenter, xzoom, yzoom);*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_getview(fb *ifp, int *UNUSED(xcenter), int *UNUSED(ycenter), int *UNUSED(xzoom), int *UNUSED(yzoom))
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
/*fb_sim_getview(ifp, xcenter, ycenter, xzoom, yzoom);*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_setcursor(fb *ifp, const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_cursor(fb *ifp, int UNUSED(mode), int UNUSED(x), int UNUSED(y))
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
/*fb_sim_cursor(ifp, mode, x, y);*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_getcursor(fb *ifp, int *UNUSED(mode), int *UNUSED(x), int *UNUSED(y))
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
/*fb_sim_getcursor(ifp, mode, x, y);*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_readrect(fb *ifp, int UNUSED(xmin), int UNUSED(ymin), int width, int height, unsigned char *UNUSED(pp))
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
return width*height;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_writerect(fb *ifp, int UNUSED(xmin), int UNUSED(ymin), int width, int height, const unsigned char *UNUSED(pp))
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
fb_log("writerect got called!");
|
||||
|
||||
return width*height;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_poll(fb *ifp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_flush(fb *ifp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
fb_log("flush was called!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_free(fb *ifp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
osg_help(fb *ifp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
fb_log("Description: %s\n", osg_interface.if_type);
|
||||
fb_log("Device: %s\n", ifp->if_name);
|
||||
fb_log("Max width/height: %d %d\n",
|
||||
osg_interface.if_max_width,
|
||||
osg_interface.if_max_height);
|
||||
fb_log("Default width/height: %d %d\n",
|
||||
osg_interface.if_width,
|
||||
osg_interface.if_height);
|
||||
fb_log("Useful for Benchmarking/Debugging\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Functions for pre-exising windows */
|
||||
extern "C" int
|
||||
osg_close_existing(fb *ifp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
_osg_open_existing(fb *ifp, Display *dpy, Window win, Colormap cmap, int width, int height, osg::ref_ptr<osg::GraphicsContext> graphicsContext)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
if (!dpy || !win || !cmap || !width || !height || !graphicsContext) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
osg_open_existing(fb *ifp, int argc, const char **argv)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
if (argc != 10 || !argv) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
osg_refresh(fb *ifp, int x, int y, int w, int h){
|
||||
FB_CK_FB(ifp);
|
||||
if (!x || !y || !w || !h) return -1;
|
||||
|
||||
fb_log("refresh got called!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
osg_configureWindow(fb *ifp, int width, int height)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
|
||||
if (!width || !height) return;
|
||||
}
|
||||
|
||||
/* This is the ONLY thing that we normally "export" */
|
||||
fb osg_interface = {
|
||||
0,
|
||||
osg_open, /* device_open */
|
||||
osg_close, /* device_close */
|
||||
osg_clear, /* device_clear */
|
||||
osg_read, /* buffer_read */
|
||||
osg_write, /* buffer_write */
|
||||
osg_rmap, /* colormap_read */
|
||||
osg_wmap, /* colormap_write */
|
||||
osg_view, /* set view */
|
||||
osg_getview, /* get view */
|
||||
osg_setcursor, /* define cursor */
|
||||
osg_cursor, /* set cursor */
|
||||
osg_getcursor, /* get cursor */
|
||||
osg_readrect, /* rectangle read */
|
||||
osg_writerect, /* rectangle write */
|
||||
osg_readrect, /* bw rectangle read */
|
||||
osg_writerect, /* bw rectangle write */
|
||||
osg_poll, /* handle events */
|
||||
osg_flush, /* flush output */
|
||||
osg_free, /* free resources */
|
||||
osg_help, /* help message */
|
||||
"OpenSceneGraph", /* device description */
|
||||
32*1024, /* max width */
|
||||
32*1024, /* max height */
|
||||
bu_strdup("/dev/osg"), /* short device name */
|
||||
512, /* default/current width */
|
||||
512, /* default/current height */
|
||||
-1, /* select fd */
|
||||
-1, /* file descriptor */
|
||||
1, 1, /* zoom */
|
||||
256, 256, /* window center */
|
||||
0, 0, 0, /* cursor */
|
||||
PIXEL_NULL, /* page_base */
|
||||
PIXEL_NULL, /* page_curp */
|
||||
PIXEL_NULL, /* page_endp */
|
||||
-1, /* page_no */
|
||||
0, /* page_dirty */
|
||||
0L, /* page_curpos */
|
||||
0L, /* page_pixels */
|
||||
0, /* debug */
|
||||
{0}, /* u1 */
|
||||
{0}, /* u2 */
|
||||
{0}, /* u3 */
|
||||
{0}, /* u4 */
|
||||
{0}, /* u5 */
|
||||
{0} /* u6 */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
+46
-62
@@ -48,7 +48,7 @@
|
||||
class QMainWindow: public QWindow {
|
||||
|
||||
public:
|
||||
QMainWindow(fb *ifp, QImage *image, QWindow *parent = 0);
|
||||
QMainWindow(FBIO *ifp, QImage *image, QWindow *parent = 0);
|
||||
~QMainWindow();
|
||||
|
||||
virtual void render(QPainter *painter);
|
||||
@@ -62,7 +62,7 @@ protected:
|
||||
void exposeEvent(QExposeEvent *event);
|
||||
|
||||
private:
|
||||
fb *ifp;
|
||||
FBIO *ifp;
|
||||
QImage *image;
|
||||
QBackingStore *m_backingStore;
|
||||
bool m_update_pending;
|
||||
@@ -150,7 +150,7 @@ static struct modeflags {
|
||||
|
||||
|
||||
HIDDEN void
|
||||
qt_updstate(fb *ifp)
|
||||
qt_updstate(FBIO *ifp)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
|
||||
@@ -162,7 +162,7 @@ qt_updstate(fb *ifp)
|
||||
|
||||
int want, avail; /* Wanted/available image pixels */
|
||||
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
/*
|
||||
* Set ?wp to the number of whole zoomed image pixels we could display
|
||||
@@ -410,11 +410,11 @@ qt_updstate(fb *ifp)
|
||||
__BEGIN_DECLS
|
||||
|
||||
void
|
||||
qt_configureWindow(fb *ifp, int width, int height)
|
||||
qt_configureWindow(FBIO *ifp, int width, int height)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
if (!qi) {
|
||||
return;
|
||||
@@ -451,10 +451,10 @@ qt_configureWindow(fb *ifp, int width, int height)
|
||||
}
|
||||
|
||||
int
|
||||
qt_close_existing(fb *ifp)
|
||||
qt_close_existing(FBIO *ifp)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
if (qi->qi_image)
|
||||
delete qi->qi_image;
|
||||
@@ -468,7 +468,7 @@ __END_DECLS
|
||||
|
||||
|
||||
HIDDEN void
|
||||
qt_update(fb *ifp, int x1, int y1, int w, int h)
|
||||
qt_update(FBIO *ifp, int x1, int y1, int w, int h)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
|
||||
@@ -491,7 +491,7 @@ qt_update(fb *ifp, int x1, int y1, int w, int h)
|
||||
unsigned char *grn = qi->qi_grnmap;
|
||||
unsigned char *blu = qi->qi_blumap;
|
||||
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
/*
|
||||
* Figure out sizes of outermost image pixels
|
||||
@@ -605,10 +605,10 @@ qt_update(fb *ifp, int x1, int y1, int w, int h)
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_rmap(fb *ifp, ColorMap *cmp)
|
||||
qt_rmap(FBIO *ifp, ColorMap *cmp)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
memcpy(cmp, qi->qi_rgb_cmap, sizeof (ColorMap));
|
||||
|
||||
@@ -619,7 +619,7 @@ qt_rmap(fb *ifp, ColorMap *cmp)
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_wmap(fb *ifp, const ColorMap *cmp)
|
||||
qt_wmap(FBIO *ifp, const ColorMap *cmp)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
ColorMap *map = qi->qi_rgb_cmap;
|
||||
@@ -629,7 +629,7 @@ qt_wmap(fb *ifp, const ColorMap *cmp)
|
||||
unsigned char *grn = qi->qi_grnmap;
|
||||
unsigned char *blu = qi->qi_blumap;
|
||||
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
/* Did we have a linear colormap before this call? */
|
||||
waslincmap = qi->qi_flags & FLG_LINCMAP;
|
||||
@@ -690,12 +690,12 @@ qt_wmap(fb *ifp, const ColorMap *cmp)
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
qt_setup(fb *ifp, int width, int height)
|
||||
qt_setup(FBIO *ifp, int width, int height)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
int argc = 1;
|
||||
char *argv[] = {(char *)"Frame buffer"};
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
qi->qi_qwidth = width;
|
||||
qi->qi_qheight = height;
|
||||
@@ -730,7 +730,7 @@ qt_destroy(struct qtinfo *qi)
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
qt_open(fb *ifp, const char *file, int width, int height)
|
||||
qt_open(FBIO *ifp, const char *file, int width, int height)
|
||||
{
|
||||
struct qtinfo *qi;
|
||||
|
||||
@@ -738,7 +738,7 @@ qt_open(fb *ifp, const char *file, int width, int height)
|
||||
size_t size;
|
||||
unsigned char *mem = NULL;
|
||||
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
mode = MODE1_LINGERING;
|
||||
|
||||
if (file != NULL) {
|
||||
@@ -846,7 +846,7 @@ qt_open(fb *ifp, const char *file, int width, int height)
|
||||
}
|
||||
|
||||
int
|
||||
_qt_open_existing(fb *ifp, int width, int height, void *qapp, void *qwin, void *qpainter, void *draw, void **qimg)
|
||||
_qt_open_existing(FBIO *ifp, int width, int height, void *qapp, void *qwin, void *qpainter, void *draw, void **qimg)
|
||||
{
|
||||
struct qtinfo *qi;
|
||||
|
||||
@@ -854,7 +854,7 @@ _qt_open_existing(fb *ifp, int width, int height, void *qapp, void *qwin, void *
|
||||
size_t size;
|
||||
unsigned char *mem = NULL;
|
||||
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
mode = MODE1_LINGERING;
|
||||
|
||||
@@ -937,20 +937,9 @@ _qt_open_existing(fb *ifp, int width, int height, void *qapp, void *qwin, void *
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
qt_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
qt_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
qt_close(fb *ifp)
|
||||
qt_close(FBIO *ifp)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
|
||||
@@ -968,7 +957,7 @@ qt_close(fb *ifp)
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_clear(fb *ifp, unsigned char *pp)
|
||||
qt_clear(FBIO *ifp, unsigned char *pp)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
|
||||
@@ -977,7 +966,7 @@ qt_clear(fb *ifp, unsigned char *pp)
|
||||
int n;
|
||||
unsigned char *cp;
|
||||
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
if (pp == (unsigned char *)NULL) {
|
||||
red = grn = blu = 0;
|
||||
@@ -1011,12 +1000,12 @@ qt_clear(fb *ifp, unsigned char *pp)
|
||||
|
||||
|
||||
HIDDEN ssize_t
|
||||
qt_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
|
||||
qt_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
size_t maxcount;
|
||||
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
/* check origin bounds */
|
||||
if (x < 0 || x >= qi->qi_iwidth || y < 0 || y >= qi->qi_iheight)
|
||||
@@ -1036,12 +1025,12 @@ qt_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
|
||||
|
||||
|
||||
HIDDEN ssize_t
|
||||
qt_write(fb *ifp, int x, int y, const unsigned char *pixelp, size_t count)
|
||||
qt_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
size_t maxcount;
|
||||
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
/* Check origin bounds */
|
||||
if (x < 0 || x >= qi->qi_iwidth || y < 0 || y >= qi->qi_iheight)
|
||||
@@ -1076,11 +1065,11 @@ qt_write(fb *ifp, int x, int y, const unsigned char *pixelp, size_t count)
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
|
||||
qt_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
/* bypass if no change */
|
||||
if (ifp->if_xcenter == xcenter && ifp->if_ycenter == ycenter
|
||||
@@ -1110,9 +1099,9 @@ qt_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
|
||||
qt_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
|
||||
{
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
*xcenter = ifp->if_xcenter;
|
||||
*ycenter = ifp->if_ycenter;
|
||||
@@ -1124,7 +1113,7 @@ qt_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_setcursor(fb *UNUSED(ifp), const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
|
||||
qt_setcursor(FBIO *UNUSED(ifp), const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
|
||||
{
|
||||
fb_log("qt_setcursor\n");
|
||||
|
||||
@@ -1133,7 +1122,7 @@ qt_setcursor(fb *UNUSED(ifp), const unsigned char *UNUSED(bits), int UNUSED(xbit
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_cursor(fb *UNUSED(ifp), int UNUSED(mode), int UNUSED(x), int UNUSED(y))
|
||||
qt_cursor(FBIO *UNUSED(ifp), int UNUSED(mode), int UNUSED(x), int UNUSED(y))
|
||||
{
|
||||
fb_log("qt_cursor\n");
|
||||
|
||||
@@ -1142,7 +1131,7 @@ qt_cursor(fb *UNUSED(ifp), int UNUSED(mode), int UNUSED(x), int UNUSED(y))
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_getcursor(fb *UNUSED(ifp), int *UNUSED(mode), int *UNUSED(x), int *UNUSED(y))
|
||||
qt_getcursor(FBIO *UNUSED(ifp), int *UNUSED(mode), int *UNUSED(x), int *UNUSED(y))
|
||||
{
|
||||
fb_log("qt_getcursor\n");
|
||||
|
||||
@@ -1151,10 +1140,10 @@ qt_getcursor(fb *UNUSED(ifp), int *UNUSED(mode), int *UNUSED(x), int *UNUSED(y))
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
|
||||
qt_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
/* Clip arguments */
|
||||
if (xmin < 0)
|
||||
@@ -1192,10 +1181,10 @@ qt_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *p
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
|
||||
qt_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
/* Clip arguments */
|
||||
if (xmin < 0)
|
||||
@@ -1235,10 +1224,10 @@ qt_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned
|
||||
|
||||
|
||||
HIDDEN void
|
||||
qt_handle_event(fb *ifp, QEvent *event)
|
||||
qt_handle_event(FBIO *ifp, QEvent *event)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
FB_CK_fb(ifp);
|
||||
FB_CK_FBIO(ifp);
|
||||
|
||||
switch (event->type()) {
|
||||
case QEvent::MouseButtonPress:
|
||||
@@ -1301,7 +1290,7 @@ qt_handle_event(fb *ifp, QEvent *event)
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_poll(fb *UNUSED(ifp))
|
||||
qt_poll(FBIO *UNUSED(ifp))
|
||||
{
|
||||
fb_log("qt_poll\n");
|
||||
|
||||
@@ -1310,7 +1299,7 @@ qt_poll(fb *UNUSED(ifp))
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_flush(fb *ifp)
|
||||
qt_flush(FBIO *ifp)
|
||||
{
|
||||
struct qtinfo *qi = QI(ifp);
|
||||
|
||||
@@ -1323,7 +1312,7 @@ qt_flush(fb *ifp)
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_free(fb *UNUSED(ifp))
|
||||
qt_free(FBIO *UNUSED(ifp))
|
||||
{
|
||||
fb_log("qt_free\n");
|
||||
|
||||
@@ -1332,7 +1321,7 @@ qt_free(fb *UNUSED(ifp))
|
||||
|
||||
|
||||
HIDDEN int
|
||||
qt_help(fb *ifp)
|
||||
qt_help(FBIO *ifp)
|
||||
{
|
||||
fb_log("Description: %s\n", qt_interface.if_type);
|
||||
fb_log("Device: %s\n", ifp->if_name);
|
||||
@@ -1347,12 +1336,9 @@ qt_help(fb *ifp)
|
||||
}
|
||||
|
||||
|
||||
fb qt_interface = {
|
||||
FBIO qt_interface = {
|
||||
0,
|
||||
FB_QT_MAGIC,
|
||||
qt_open, /* device_open */
|
||||
qt_open_existing,
|
||||
qt_close_existing,
|
||||
qt_close, /* device_close */
|
||||
qt_clear, /* device_clear */
|
||||
qt_read, /* buffer_read */
|
||||
@@ -1368,8 +1354,6 @@ fb qt_interface = {
|
||||
qt_writerect, /* rectangle write */
|
||||
qt_readrect, /* bw rectangle read */
|
||||
qt_writerect, /* bw rectangle write */
|
||||
qt_configure_window,
|
||||
qt_refresh,
|
||||
qt_poll, /* handle events */
|
||||
qt_flush, /* flush output */
|
||||
qt_free, /* free resources */
|
||||
@@ -1406,7 +1390,7 @@ fb qt_interface = {
|
||||
* ===================================================== Main window class ===============================================
|
||||
*/
|
||||
|
||||
QMainWindow::QMainWindow(fb *fb, QImage *img, QWindow *win)
|
||||
QMainWindow::QMainWindow(FBIO *fb, QImage *img, QWindow *win)
|
||||
: QWindow(win)
|
||||
, m_update_pending(false)
|
||||
{
|
||||
|
||||
@@ -285,43 +285,6 @@ rem_open(register fb *ifp, const char *file, int width, int height)
|
||||
return 0; /* OK */
|
||||
}
|
||||
|
||||
HIDDEN struct fb_platform_specific *
|
||||
rem_get_fbps(uint32_t UNUSED(magic))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN void
|
||||
rem_put_fbps(struct fb_platform_specific *UNUSED(fbps))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
rem_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
rem_close_existing(fb *UNUSED(ifp))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
rem_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
rem_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
rem_close(fb *ifp)
|
||||
@@ -785,12 +748,7 @@ pkgerror(struct pkg_conn *UNUSED(pcpp), char *buf)
|
||||
|
||||
fb remote_interface = {
|
||||
0,
|
||||
FB_REMOTE_MAGIC,
|
||||
rem_open,
|
||||
rem_open_existing,
|
||||
rem_close_existing,
|
||||
rem_get_fbps,
|
||||
rem_put_fbps,
|
||||
rem_close,
|
||||
rem_clear,
|
||||
rem_read,
|
||||
@@ -806,8 +764,6 @@ fb remote_interface = {
|
||||
rem_writerect,
|
||||
rem_bwreadrect,
|
||||
rem_bwwriterect,
|
||||
rem_configure_window,
|
||||
rem_refresh,
|
||||
rem_poll,
|
||||
rem_flush,
|
||||
rem_free,
|
||||
|
||||
@@ -112,44 +112,6 @@ stk_open(fb *ifp, const char *file, int width, int height)
|
||||
return -1;
|
||||
}
|
||||
|
||||
HIDDEN struct fb_platform_specific *
|
||||
stk_get_fbps(uint32_t UNUSED(magic))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN void
|
||||
stk_put_fbps(struct fb_platform_specific *UNUSED(fbps))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
stk_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
stk_close_existing(fb *UNUSED(ifp))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
stk_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
stk_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
stk_close(fb *ifp)
|
||||
@@ -434,12 +396,7 @@ stk_help(fb *ifp)
|
||||
/* This is the ONLY thing that we normally "export" */
|
||||
fb stk_interface = {
|
||||
0,
|
||||
FB_STK_MAGIC,
|
||||
stk_open, /* device_open */
|
||||
stk_open_existing, /* device_open */
|
||||
stk_close_existing,
|
||||
stk_get_fbps,
|
||||
stk_put_fbps,
|
||||
stk_close, /* device_close */
|
||||
stk_clear, /* device_clear */
|
||||
stk_read, /* buffer_read */
|
||||
@@ -455,8 +412,6 @@ fb stk_interface = {
|
||||
stk_writerect, /* write rectangle */
|
||||
stk_bwreadrect, /* read bw rectangle */
|
||||
stk_bwwriterect, /* write bw rectangle */
|
||||
stk_configure_window,
|
||||
stk_refresh,
|
||||
stk_poll, /* handle events */
|
||||
stk_flush, /* flush output */
|
||||
stk_free, /* free resources */
|
||||
|
||||
@@ -1,654 +0,0 @@
|
||||
/* I F _ T K . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2007-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 if */
|
||||
/** @{ */
|
||||
/** @file if_tk.c
|
||||
*
|
||||
* Tk libfb interface.
|
||||
*
|
||||
*/
|
||||
/** @} */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef IF_TK
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#include <tcl.h>
|
||||
#include <tk.h>
|
||||
#include "bio.h"
|
||||
|
||||
#include "bu/color.h"
|
||||
#include "bu/log.h"
|
||||
#include "bu/str.h"
|
||||
|
||||
#include "fb_private.h"
|
||||
#include "fb.h"
|
||||
|
||||
|
||||
Tcl_Interp *fbinterp;
|
||||
Tk_Window fbwin;
|
||||
Tk_PhotoHandle fbphoto;
|
||||
int p[2] = {0, 0};
|
||||
|
||||
/* Note that Tk_PhotoPutBlock claims to have a faster
|
||||
* copy method when pixelSize is 4 and alphaOffset is
|
||||
* 3 - perhaps output could be massaged to generate this
|
||||
* type of information and speed up the process?
|
||||
*
|
||||
* Might as well use one block and set the three things
|
||||
* that actually change in tk_write
|
||||
*/
|
||||
Tk_PhotoImageBlock block = {
|
||||
NULL, /*Pointer to first pixel*/
|
||||
0, /*Width of block in pixels*/
|
||||
1, /*Height of block in pixels - always one for a scanline*/
|
||||
0, /*Address difference between successive lines*/
|
||||
3, /*Address difference between successive pixels on one scanline*/
|
||||
{
|
||||
RED,
|
||||
GRN,
|
||||
BLU,
|
||||
0 /* alpha */
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
char *tkwrite_buffer;
|
||||
|
||||
|
||||
HIDDEN int
|
||||
fb_tk_open(fb *ifp, const char *file, int width, int height)
|
||||
{
|
||||
int pid = -1;
|
||||
const char *cmd = "package require Tk";
|
||||
char image_create_cmd[255] = {'\0'};
|
||||
char canvas_create_cmd[255] = {'\0'};
|
||||
char reportcolorcmd[255] = {'\0'};
|
||||
const char canvas_pack_cmd[255] =
|
||||
"pack .fb_tk_canvas -fill both -expand true";
|
||||
const char place_image_cmd[255] =
|
||||
".fb_tk_canvas create image 0 0 -image fb_tk_photo -anchor nw";
|
||||
const char *wmclosecmd = "wm protocol . WM_DELETE_WINDOW {set CloseWindow \"close\"}";
|
||||
const char *bindclosecmd = "bind . <Button-3> {set CloseWindow \"close\"}";
|
||||
|
||||
char *buffer;
|
||||
char *linebuffer;
|
||||
|
||||
FB_CK_FB(ifp);
|
||||
if (file == (char *)NULL)
|
||||
fb_log("fb_open(0x%lx, NULL, %d, %d)\n",
|
||||
(unsigned long)ifp, width, height);
|
||||
else
|
||||
fb_log("fb_open(0x%lx, \"%s\", %d, %d)\n",
|
||||
(unsigned long)ifp, file, width, height);
|
||||
|
||||
/* check for default size */
|
||||
if (width <= 0)
|
||||
width = ifp->if_width;
|
||||
if (height <= 0)
|
||||
height = ifp->if_height;
|
||||
|
||||
/* set debug bit vector */
|
||||
if (file != NULL) {
|
||||
const char *cp;
|
||||
for (cp = file; *cp != '\0' && !isdigit((unsigned char)*cp); cp++)
|
||||
;
|
||||
sscanf(cp, "%d", &ifp->if_debug);
|
||||
} else {
|
||||
ifp->if_debug = 0;
|
||||
}
|
||||
|
||||
/* Give the user whatever width was asked for */
|
||||
ifp->if_width = width;
|
||||
ifp->if_height = height;
|
||||
|
||||
fbinterp = Tcl_CreateInterp();
|
||||
|
||||
if (Tcl_Init(fbinterp) == TCL_ERROR) {
|
||||
fb_log("Tcl_Init returned error in fb_open.");
|
||||
}
|
||||
|
||||
if (Tcl_Eval(fbinterp, cmd) != TCL_OK) {
|
||||
fb_log("Error returned attempting to start tk in fb_open.");
|
||||
}
|
||||
|
||||
fbwin = Tk_MainWindow(fbinterp);
|
||||
|
||||
Tk_GeometryRequest(fbwin, width, height);
|
||||
|
||||
Tk_MakeWindowExist(fbwin);
|
||||
|
||||
sprintf(image_create_cmd,
|
||||
"image create photo fb_tk_photo -height %d -width %d",
|
||||
width, height);
|
||||
|
||||
if (Tcl_Eval(fbinterp, image_create_cmd) != TCL_OK) {
|
||||
fb_log("Error returned attempting to create image in fb_open.");
|
||||
}
|
||||
|
||||
if ((fbphoto = Tk_FindPhoto(fbinterp, "fb_tk_photo")) == NULL) {
|
||||
fb_log("Image creation unsuccessful in fb_open.");
|
||||
}
|
||||
|
||||
sprintf(canvas_create_cmd,
|
||||
"canvas .fb_tk_canvas -highlightthickness 0 -height %d -width %d", width, height);
|
||||
|
||||
sprintf (reportcolorcmd,
|
||||
"bind . <Button-2> {puts \"At image (%%x, [expr %d - %%y]), real RGB = ([fb_tk_photo get %%x %%y])\n\"}", height);
|
||||
|
||||
if (Tcl_Eval(fbinterp, canvas_create_cmd) != TCL_OK) {
|
||||
fb_log("Error returned attempting to create canvas in fb_open.");
|
||||
}
|
||||
|
||||
if (Tcl_Eval(fbinterp, canvas_pack_cmd) != TCL_OK) {
|
||||
fb_log("Error returned attempting to pack canvas in fb_open. %s",
|
||||
Tcl_GetStringResult(fbinterp));
|
||||
}
|
||||
|
||||
if (Tcl_Eval(fbinterp, place_image_cmd) != TCL_OK) {
|
||||
fb_log("Error returned attempting to place image in fb_open. %s",
|
||||
Tcl_GetStringResult(fbinterp));
|
||||
}
|
||||
|
||||
/* Set our Tcl variable pertaining to whether a
|
||||
* window closing event has been seen from the
|
||||
* Window manager. WM_DELETE_WINDOW will be
|
||||
* bound to a command setting this variable to
|
||||
* the string "close", and a vwait watching
|
||||
* for a change to the CloseWindow variable ensures
|
||||
* a "lingering" tk window.
|
||||
*/
|
||||
Tcl_SetVar(fbinterp, "CloseWindow", "open", 0);
|
||||
if (Tcl_Eval(fbinterp, wmclosecmd) != TCL_OK) {
|
||||
fb_log("Error binding WM_DELETE_WINDOW.");
|
||||
}
|
||||
if (Tcl_Eval(fbinterp, bindclosecmd) != TCL_OK) {
|
||||
fb_log("Error binding right mouse button.");
|
||||
}
|
||||
if (Tcl_Eval(fbinterp, reportcolorcmd) != TCL_OK) {
|
||||
fb_log("Error binding middle mouse button.");
|
||||
}
|
||||
|
||||
while (Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT));
|
||||
|
||||
/* FIXME: malloc() is necessary here because there are callers
|
||||
* that acquire a BU_SYM_SYSCALL semaphore for libfb calls.
|
||||
* this should be investigated more closely to see if the
|
||||
* semaphore acquires are critical or if they can be pushed
|
||||
* down into libfb proper. in the meantime, manually call
|
||||
* malloc()/free().
|
||||
*/
|
||||
buffer = (char *)malloc(sizeof(uint32_t)*3+ifp->if_width*3);
|
||||
linebuffer = (char *)malloc(ifp->if_width*3);
|
||||
tkwrite_buffer = (char *)malloc(ifp->if_width*3);
|
||||
|
||||
if (pipe(p) == -1) {
|
||||
perror("pipe failed");
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
printf("boo, something bad\n");
|
||||
} else if (pid > 0) {
|
||||
int line = 0;
|
||||
uint32_t lines[3];
|
||||
int i;
|
||||
int y[2];
|
||||
y[0] = 0;
|
||||
|
||||
/* parent */
|
||||
while (y[0] >= 0) {
|
||||
int count;
|
||||
|
||||
/* If the Tk window gets a close event, bail */
|
||||
if (BU_STR_EQUAL(Tcl_GetVar(fbinterp, "CloseWindow", 0), "close")) {
|
||||
free(buffer);
|
||||
free(linebuffer);
|
||||
free(tkwrite_buffer);
|
||||
fclose(stdin);
|
||||
printf("Close Window event\n");
|
||||
Tcl_Eval(fbinterp, "destroy .");
|
||||
bu_exit(0, NULL);
|
||||
}
|
||||
|
||||
/* Unpack inputs from pipe */
|
||||
count = read(p[0], buffer, sizeof(uint32_t)*3+ifp->if_width*3);
|
||||
memcpy(lines, buffer, sizeof(uint32_t)*3);
|
||||
memcpy(linebuffer, buffer+sizeof(uint32_t)*3, ifp->if_width*3);
|
||||
y[0] = ntohl(lines[0]);
|
||||
count = ntohl(lines[1]);
|
||||
|
||||
if (y[0] < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
line++;
|
||||
block.pixelPtr = (unsigned char *)linebuffer;
|
||||
block.width = count;
|
||||
block.pitch = 3 * ifp->if_width;
|
||||
|
||||
#if defined(TK_MAJOR_VERSION) && TK_MAJOR_VERSION >= 8 && defined(TK_MINOR_VERSION) && TK_MINOR_VERSION >= 5
|
||||
Tk_PhotoPutBlock(fbinterp, fbphoto, &block, 0, ifp->if_height-y[0], count, 1, TK_PHOTO_COMPOSITE_SET);
|
||||
#else
|
||||
Tk_PhotoPutBlock(fbinterp, &block, 0, ifp->if_height-y[0], count, 1, TK_PHOTO_COMPOSITE_SET);
|
||||
#endif
|
||||
|
||||
do {
|
||||
i = Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT);
|
||||
} while (i);
|
||||
}
|
||||
/* very bad things will happen if the parent does not terminate here */
|
||||
free(buffer);
|
||||
free(linebuffer);
|
||||
free(tkwrite_buffer);
|
||||
fclose(stdin);
|
||||
Tcl_Eval(fbinterp, "vwait CloseWindow");
|
||||
if (BU_STR_EQUAL(Tcl_GetVar(fbinterp, "CloseWindow", 0), "close")) {
|
||||
printf("Close Window event\n");
|
||||
Tcl_Eval(fbinterp, "destroy .");
|
||||
}
|
||||
bu_exit(0, NULL);
|
||||
} else {
|
||||
/* child */
|
||||
printf("IMA CHILD\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN struct fb_platform_specific *
|
||||
tk_get_fbps(uint32_t UNUSED(magic))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN void
|
||||
tk_put_fbps(struct fb_platform_specific *UNUSED(fbps))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
tk_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
tk_close_existing(fb *UNUSED(ifp))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
tk_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
tk_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HIDDEN int
|
||||
fb_tk_close(fb *ifp)
|
||||
{
|
||||
int y[2];
|
||||
int ret;
|
||||
y[0] = -1;
|
||||
y[1] = 0;
|
||||
printf("Entering fb_tk_close\n");
|
||||
FB_CK_FB(ifp);
|
||||
ret = write(p[1], y, sizeof(y));
|
||||
close(p[1]);
|
||||
printf("Sent write (ret=%d) from fb_tk_close\n", ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_clear(fb *ifp, unsigned char *pp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
if (pp == 0)
|
||||
fb_log("fb_clear(0x%lx, NULL)\n", (unsigned long)ifp);
|
||||
else
|
||||
fb_log("fb_clear(0x%lx, &[%d %d %d])\n",
|
||||
(unsigned long)ifp,
|
||||
(int)(pp[RED]), (int)(pp[GRN]),
|
||||
(int)(pp[BLU]));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN ssize_t
|
||||
tk_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("fb_read(0x%lx, %4d, %4d, 0x%lx, %ld)\n",
|
||||
(unsigned long)ifp, x, y,
|
||||
(unsigned long)pixelp, (long)count);
|
||||
return (ssize_t)count;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN ssize_t
|
||||
tk_write(fb *ifp, int UNUSED(x), int y, const unsigned char *pixelp, size_t count)
|
||||
{
|
||||
uint32_t line[3];
|
||||
|
||||
FB_CK_FB(ifp);
|
||||
/* Set local values of Tk_PhotoImageBlock */
|
||||
block.pixelPtr = (unsigned char *)pixelp;
|
||||
block.width = count;
|
||||
block.pitch = 3 * ifp->if_width;
|
||||
|
||||
/* Pack values to be sent to parent */
|
||||
line[0] = htonl(y);
|
||||
line[1] = htonl((long)count);
|
||||
line[2] = 0;
|
||||
|
||||
memcpy(tkwrite_buffer, line, sizeof(uint32_t)*3);
|
||||
memcpy(tkwrite_buffer+sizeof(uint32_t)*3, block.pixelPtr, 3 * ifp->if_width);
|
||||
|
||||
/* Send values and data to parent for display */
|
||||
if (write(p[1], tkwrite_buffer, 3 * ifp->if_width + 3*sizeof(uint32_t)) == -1) {
|
||||
perror("Unable to write to pipe");
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return (ssize_t)count;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_rmap(fb *ifp, ColorMap *cmp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("fb_rmap(0x%lx, 0x%lx)\n",
|
||||
(unsigned long)ifp, (unsigned long)cmp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_wmap(fb *ifp, const ColorMap *cmp)
|
||||
{
|
||||
int i;
|
||||
|
||||
FB_CK_FB(ifp);
|
||||
if (cmp == NULL)
|
||||
fb_log("fb_wmap(0x%lx, NULL)\n",
|
||||
(unsigned long)ifp);
|
||||
else
|
||||
fb_log("fb_wmap(0x%lx, 0x%lx)\n",
|
||||
(unsigned long)ifp, (unsigned long)cmp);
|
||||
|
||||
if (ifp->if_debug & FB_DEBUG_CMAP && cmp != NULL) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
fb_log("%3d: [ 0x%4lx, 0x%4lx, 0x%4lx ]\n",
|
||||
i,
|
||||
(unsigned long)cmp->cm_red[i],
|
||||
(unsigned long)cmp->cm_green[i],
|
||||
(unsigned long)cmp->cm_blue[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("fb_view(0x%lx, %4d, %4d, %4d, %4d)\n",
|
||||
(unsigned long)ifp, xcenter, ycenter, xzoom, yzoom);
|
||||
fb_sim_view(ifp, xcenter, ycenter, xzoom, yzoom);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("fb_getview(0x%lx, 0x%x, 0x%x, 0x%x, 0x%x)\n",
|
||||
(unsigned long)ifp, xcenter, ycenter, xzoom, yzoom);
|
||||
fb_sim_getview(ifp, xcenter, ycenter, xzoom, yzoom);
|
||||
fb_log(" <= %d %d %d %d\n",
|
||||
*xcenter, *ycenter, *xzoom, *yzoom);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_setcursor(fb *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("fb_setcursor(0x%lx, 0x%lx, %d, %d, %d, %d)\n",
|
||||
(unsigned long)ifp, bits, xbits, ybits, xorig, yorig);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_cursor(fb *ifp, int mode, int x, int y)
|
||||
{
|
||||
fb_log("fb_cursor(0x%lx, %d, %4d, %4d)\n",
|
||||
(unsigned long)ifp, mode, x, y);
|
||||
fb_sim_cursor(ifp, mode, x, y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_getcursor(fb *ifp, int *mode, int *x, int *y)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("fb_getcursor(0x%lx, 0x%x, 0x%x, 0x%x)\n",
|
||||
(unsigned long)ifp, mode, x, y);
|
||||
fb_sim_getcursor(ifp, mode, x, y);
|
||||
fb_log(" <= %d %d %d\n", *mode, *x, *y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("fb_readrect(0x%lx, (%4d, %4d), %4d, %4d, 0x%lx)\n",
|
||||
(unsigned long)ifp, xmin, ymin, width, height,
|
||||
(unsigned long)pp);
|
||||
return width*height;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("fb_writerect(0x%lx, %4d, %4d, %4d, %4d, 0x%lx)\n",
|
||||
(unsigned long)ifp, xmin, ymin, width, height,
|
||||
(unsigned long)pp);
|
||||
return width*height;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_bwreadrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("fb_bwreadrect(0x%lx, (%4d, %4d), %4d, %4d, 0x%lx)\n",
|
||||
(unsigned long)ifp, xmin, ymin, width, height,
|
||||
(unsigned long)pp);
|
||||
return width*height;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_bwwriterect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("fb_bwwriterect(0x%lx, %4d, %4d, %4d, %4d, 0x%lx)\n",
|
||||
(unsigned long)ifp, xmin, ymin, width, height,
|
||||
(unsigned long)pp);
|
||||
return width*height;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_poll(fb *ifp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
while (Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT));
|
||||
fb_log("fb_poll(0x%lx)\n", (unsigned long)ifp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_flush(fb *ifp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("if_flush(0x%lx)\n", (unsigned long)ifp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
tk_free(fb *ifp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("fb_free(0x%lx)\n", (unsigned long)ifp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*ARGSUSED*/
|
||||
HIDDEN int
|
||||
tk_help(fb *ifp)
|
||||
{
|
||||
FB_CK_FB(ifp);
|
||||
fb_log("Description: %s\n", tk_interface.if_type);
|
||||
fb_log("Device: %s\n", ifp->if_name);
|
||||
fb_log("Max width/height: %d %d\n",
|
||||
tk_interface.if_max_width,
|
||||
tk_interface.if_max_height);
|
||||
fb_log("Default width/height: %d %d\n",
|
||||
tk_interface.if_width,
|
||||
tk_interface.if_height);
|
||||
fb_log("\
|
||||
Usage: /dev/tk[#]\n\
|
||||
where # is a optional bit vector from:\n\
|
||||
1 debug buffered I/O calls\n\
|
||||
2 show colormap entries in rmap/wmap calls\n\
|
||||
4 show actual pixel values in read/write calls\n");
|
||||
/*8 buffered read/write values - ifdef'd out*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This is the ONLY thing that we "export" */
|
||||
fb tk_interface = {
|
||||
0,
|
||||
FB_TK_MAGIC,
|
||||
fb_tk_open,
|
||||
tk_open_existing,
|
||||
tk_close_existing,
|
||||
tk_get_fbps,
|
||||
tk_put_fbps,
|
||||
fb_tk_close,
|
||||
tk_clear,
|
||||
tk_read,
|
||||
tk_write,
|
||||
tk_rmap,
|
||||
tk_wmap,
|
||||
tk_view,
|
||||
tk_getview,
|
||||
tk_setcursor,
|
||||
tk_cursor,
|
||||
tk_getcursor,
|
||||
tk_readrect,
|
||||
tk_writerect,
|
||||
tk_bwreadrect,
|
||||
tk_bwwriterect,
|
||||
tk_configure_window,
|
||||
tk_refresh,
|
||||
tk_poll,
|
||||
tk_flush,
|
||||
tk_free,
|
||||
tk_help,
|
||||
"Debugging Interface",
|
||||
32*1024, /* max width */
|
||||
32*1024, /* max height */
|
||||
"/dev/tk",
|
||||
512, /* current/default width */
|
||||
512, /* current/default height */
|
||||
-1, /* select fd */
|
||||
-1, /* file descriptor */
|
||||
1, 1, /* zoom */
|
||||
256, 256, /* window center */
|
||||
0, 0, 0, /* cursor */
|
||||
PIXEL_NULL, /* page_base */
|
||||
PIXEL_NULL, /* page_curp */
|
||||
PIXEL_NULL, /* page_endp */
|
||||
-1, /* page_no */
|
||||
0, /* page_ref */
|
||||
0L, /* page_curpos */
|
||||
0L, /* page_pixels */
|
||||
0, /* debug */
|
||||
{0}, /* u1 */
|
||||
{0}, /* u2 */
|
||||
{0}, /* u3 */
|
||||
{0}, /* u4 */
|
||||
{0}, /* u5 */
|
||||
{0} /* u6 */
|
||||
};
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/* quell empty-compilation unit warnings */
|
||||
static const int unused = 0;
|
||||
|
||||
#endif /* IF_TK */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
-2169
File diff suppressed because it is too large
Load Diff
+339
@@ -47,9 +47,346 @@
|
||||
/* private headers */
|
||||
#include "brlcad_version.h"
|
||||
|
||||
|
||||
#define FB_TCL_CKMAG(_ptr, _magic, _str) { \
|
||||
struct bu_vls _fb_vls = BU_VLS_INIT_ZERO; \
|
||||
\
|
||||
if (!(_ptr)) { \
|
||||
bu_vls_printf(&_fb_vls, "ERROR: null %s ptr, file %s, line %d\n", \
|
||||
_str, __FILE__, __LINE__); \
|
||||
Tcl_AppendResult(interp, bu_vls_addr(&_fb_vls), (char *)NULL); \
|
||||
bu_vls_free(&_fb_vls); \
|
||||
\
|
||||
return TCL_ERROR; \
|
||||
} else if (*((uint32_t *)(_ptr)) != (_magic)) { \
|
||||
bu_vls_printf(&_fb_vls, "ERROR: bad %s ptr %p, s/b x%x, was x%lx, file %s, line %d\n", \
|
||||
_str, (void *)_ptr, _magic, (unsigned long)*((uint32_t *)(_ptr)), __FILE__, __LINE__); \
|
||||
Tcl_AppendResult(interp, bu_vls_addr(&_fb_vls), (char *)NULL); \
|
||||
bu_vls_free(&_fb_vls); \
|
||||
\
|
||||
return TCL_ERROR; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define FB_TCL_CK_fb(_p) FB_TCL_CKMAG(_p, FB_MAGIC, "fb")
|
||||
|
||||
/* from libfb/fb_obj.c */
|
||||
extern int Fbo_Init(Tcl_Interp *interp);
|
||||
|
||||
/* XXX -- At some point these routines should be moved to fb */
|
||||
#ifdef IF_WGL
|
||||
extern fb wgl_interface;
|
||||
static const char *wgl_device_name = "/dev/wgl";
|
||||
extern void wgl_configureWindow(fb *ifp, int width, int height);
|
||||
extern int wgl_open_existing(fb *ifp, int argc, const char **argv);
|
||||
extern int wgl_refresh(fb *ifp, int x, int y, int w, int h);
|
||||
#endif
|
||||
|
||||
#ifdef IF_OGL
|
||||
extern fb ogl_interface;
|
||||
static const char *ogl_device_name = "/dev/ogl";
|
||||
extern void ogl_configureWindow(fb *ifp, int width, int height);
|
||||
extern int ogl_open_existing(fb *ifp, int argc, const char **argv);
|
||||
extern int ogl_refresh(fb *ifp, int x, int y, int w, int h);
|
||||
#endif
|
||||
|
||||
#ifdef IF_X
|
||||
extern fb X24_interface;
|
||||
static const char *X_device_name = "/dev/X";
|
||||
extern void X24_configureWindow(fb *ifp, int width, int height);
|
||||
extern int X24_open_existing(fb *ifp, int argc, const char **argv);
|
||||
extern int X24_refresh(fb *ifp, int x, int y, int w, int h);
|
||||
#endif
|
||||
|
||||
#ifdef IF_TK
|
||||
extern fb tk_interface;
|
||||
static const char *tk_device_name = "/dev/tk";
|
||||
#if 0
|
||||
/*XXX TJM implement this interface */
|
||||
extern void tk_configureWindow(fb *ifp, int width, int height);
|
||||
extern int tk_open_existing(fb *ifp, int argc, const char **argv);
|
||||
extern int tk_refresh(fb *ifp, int x, int y, int w, int h);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef IF_QT
|
||||
extern fb qt_interface;
|
||||
static const char *qt_device_name = "/dev/Qt";
|
||||
extern void qt_configureWindow(fb *ifp, int width, int height);
|
||||
#endif
|
||||
|
||||
int
|
||||
#if !defined(IF_X) && !defined(IF_WGL) && !defined(IF_OGL) && !defined(IF_TK)
|
||||
fb_cmd_open_existing(void *clientData, int argc, const char **UNUSED(argv))
|
||||
#else
|
||||
fb_cmd_open_existing(void *clientData, int argc, const char **argv)
|
||||
#endif
|
||||
{
|
||||
Tcl_Interp *interp = (Tcl_Interp *)clientData;
|
||||
register fb *ifp;
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
int found = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
bu_log("fb_open_existing: wrong number of args\n");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if ((ifp = (fb *)calloc(sizeof(fb), 1)) == FB_NULL) {
|
||||
bu_log("fb_open_existing: failed to allocate ifp memory\n");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
#ifdef IF_X
|
||||
if (BU_STR_EQUIV(argv[1], X_device_name)) {
|
||||
found=1;
|
||||
*ifp = X24_interface; /* struct copy */
|
||||
|
||||
ifp->if_name = (char *)malloc((unsigned)strlen(X_device_name) + 1);
|
||||
bu_strlcpy(ifp->if_name, X_device_name, strlen(X_device_name)+1);
|
||||
|
||||
/* Mark OK by filling in magic number */
|
||||
ifp->if_magic = FB_MAGIC;
|
||||
|
||||
if ((X24_open_existing(ifp, argc - 1, argv + 1)) <= -1) {
|
||||
ifp->if_magic = 0; /* sanity */
|
||||
free((void *) ifp->if_name);
|
||||
free((void *) ifp);
|
||||
bu_log("fb_open_existing: failed to open X framebuffer\n");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
#endif /* IF_X */
|
||||
|
||||
#ifdef IF_TK
|
||||
#if 0
|
||||
/* XXX TJM implement tk_open_existing */
|
||||
if (BU_STR_EQUIV(argv[1], tk_device_name)) {
|
||||
found=1;
|
||||
*ifp = tk_interface; /* struct copy */
|
||||
|
||||
ifp->if_name = malloc((unsigned)strlen(tk_device_name) + 1);
|
||||
bu_strlcpy(ifp->if_name, tk_device_name, strlen(tk_device_name)+1);
|
||||
|
||||
/* Mark OK by filling in magic number */
|
||||
ifp->if_magic = FB_MAGIC;
|
||||
|
||||
if ((tk_open_existing(ifp, argc - 1, argv + 1)) <= -1) {
|
||||
ifp->if_magic = 0; /* sanity */
|
||||
free((void *) ifp->if_name);
|
||||
free((void *) ifp);
|
||||
bu_log("fb_open_existing: failed to open tk framebuffer\n");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* IF_TK */
|
||||
|
||||
#ifdef IF_WGL
|
||||
if (BU_STR_EQUIV(argv[1], wgl_device_name)) {
|
||||
found=1;
|
||||
*ifp = wgl_interface; /* struct copy */
|
||||
|
||||
ifp->if_name = malloc((unsigned)strlen(wgl_device_name) + 1);
|
||||
bu_strlcpy(ifp->if_name, wgl_device_name, strlen(wgl_device_name)+1);
|
||||
|
||||
/* Mark OK by filling in magic number */
|
||||
ifp->if_magic = FB_MAGIC;
|
||||
|
||||
if ((wgl_open_existing(ifp, argc - 1, argv + 1)) <= -1) {
|
||||
ifp->if_magic = 0; /* sanity */
|
||||
free((void *) ifp->if_name);
|
||||
free((void *) ifp);
|
||||
bu_log("fb_open_existing: failed to open wgl framebuffer\n");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
#endif /* IF_WGL */
|
||||
|
||||
#ifdef IF_OGL
|
||||
if (BU_STR_EQUIV(argv[1], ogl_device_name)) {
|
||||
found=1;
|
||||
*ifp = ogl_interface; /* struct copy */
|
||||
|
||||
ifp->if_name = (char *)malloc((unsigned)strlen(ogl_device_name) + 1);
|
||||
bu_strlcpy(ifp->if_name, ogl_device_name, strlen(ogl_device_name)+1);
|
||||
|
||||
/* Mark OK by filling in magic number */
|
||||
ifp->if_magic = FB_MAGIC;
|
||||
|
||||
if ((ogl_open_existing(ifp, argc - 1, argv + 1)) <= -1) {
|
||||
ifp->if_magic = 0; /* sanity */
|
||||
free((void *) ifp->if_name);
|
||||
free((void *) ifp);
|
||||
bu_log("fb_open_existing: failed to open ogl framebuffer\n");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
#endif /* IF_OGL */
|
||||
|
||||
/* FIXME: a printed pointer address string is a blatant security
|
||||
* and integrity violation worst practice. do not use, do not
|
||||
* pass go, find a better data-based approach.
|
||||
*/
|
||||
if (found) {
|
||||
bu_vls_printf(&vls, "%p", (void *)ifp);
|
||||
Tcl_AppendResult(interp, bu_vls_addr(&vls), (char *)NULL);
|
||||
bu_vls_free(&vls);
|
||||
ifp->if_magic = 0; /* sanity */
|
||||
free((void *) ifp->if_name);
|
||||
free((void *) ifp);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
ifp->if_magic = 0; /* sanity */
|
||||
free((void *) ifp->if_name);
|
||||
free((void *) ifp);
|
||||
|
||||
bu_vls_printf(&vls, "fb_open_existing: supports only the following device types\n");
|
||||
#ifdef IF_X
|
||||
bu_vls_strcat(&vls, X_device_name);
|
||||
bu_vls_strcat(&vls, "\n");
|
||||
#endif /* IF_X */
|
||||
#ifdef IF_WGL
|
||||
bu_vls_strcat(&vls, wgl_device_name);
|
||||
bu_vls_strcat(&vls, "\n");
|
||||
#endif /* IF_WGL */
|
||||
#ifdef IF_OGL
|
||||
bu_vls_strcat(&vls, ogl_device_name);
|
||||
bu_vls_strcat(&vls, "\n");
|
||||
#endif /* IF_OGL */
|
||||
#ifdef IF_TK
|
||||
bu_vls_strcat(&vls, tk_device_name);
|
||||
bu_vls_strcat(&vls, "\n");
|
||||
#endif /* IF_TK */
|
||||
Tcl_AppendResult(interp, bu_vls_addr(&vls), (char *)NULL);
|
||||
bu_vls_free(&vls);
|
||||
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fb_cmd_close_existing(ClientData UNUSED(clientData), int argc, const char **argv)
|
||||
{
|
||||
fb *ifp;
|
||||
|
||||
if (argc != 2) {
|
||||
/* XXX need help message */
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (sscanf(argv[1], "%lu", (unsigned long *)&ifp) != 1) {
|
||||
bu_log("fb_close_existing: failed to provide ifp\n");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* FB_TCL_CK_fb(ifp); */
|
||||
return fb_close_existing(ifp);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fb_configureWindow(fb *ifp, int width, int height)
|
||||
{
|
||||
/* unknown/unset framebuffer */
|
||||
if (!ifp || !ifp->if_name || width < 0 || height < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef IF_X
|
||||
if (!bu_strncmp(ifp->if_name, X_device_name, strlen(X_device_name))) {
|
||||
X24_configureWindow(ifp, width, height);
|
||||
}
|
||||
#endif /* IF_X */
|
||||
#ifdef IF_WGL
|
||||
if (!bu_strncmp(ifp->if_name, wgl_device_name, strlen(wgl_device_name))) {
|
||||
wgl_configureWindow(ifp, width, height);
|
||||
}
|
||||
#endif /* IF_WGL */
|
||||
#ifdef IF_OGL
|
||||
if (!bu_strncmp(ifp->if_name, ogl_device_name, strlen(ogl_device_name))) {
|
||||
ogl_configureWindow(ifp, width, height);
|
||||
}
|
||||
#endif /* IF_OGL */
|
||||
#ifdef IF_TK
|
||||
#if 0
|
||||
/* XXX TJM implement tk_configureWindow */
|
||||
if (!bu_strncmp(ifp->if_name, tk_device_name, strlen(tk_device_name))) {
|
||||
tk_configureWindow(ifp, width, height);
|
||||
}
|
||||
#endif
|
||||
#endif /* IF_TK */
|
||||
#ifdef IF_QT
|
||||
if (!bu_strncmp(ifp->if_name, qt_device_name, strlen(qt_device_name))) {
|
||||
qt_configureWindow(ifp, width, height);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fb_refresh(fb *ifp, int x, int y, int w, int h)
|
||||
{
|
||||
int status=0;
|
||||
|
||||
/* what does negative mean? */
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
if (w < 0)
|
||||
w = 0;
|
||||
if (h < 0)
|
||||
h = 0;
|
||||
|
||||
if (w == 0 || h == 0) {
|
||||
/* nothing to refresh */
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
if (!ifp || !ifp->if_name) {
|
||||
/* unset/unknown framebuffer */
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
#ifdef IF_X
|
||||
status = -1;
|
||||
if (!bu_strncmp(ifp->if_name, X_device_name, strlen(X_device_name))) {
|
||||
status = X24_refresh(ifp, x, y, w, h);
|
||||
}
|
||||
#endif /* IF_X */
|
||||
#ifdef IF_WGL
|
||||
status = -1;
|
||||
if (!bu_strncmp(ifp->if_name, wgl_device_name, strlen(wgl_device_name))) {
|
||||
status = wgl_refresh(ifp, x, y, w, h);
|
||||
}
|
||||
#endif /* IF_WGL */
|
||||
#ifdef IF_OGL
|
||||
status = -1;
|
||||
if (!bu_strncmp(ifp->if_name, ogl_device_name, strlen(ogl_device_name))) {
|
||||
status = ogl_refresh(ifp, x, y, w, h);
|
||||
}
|
||||
#endif /* IF_OGL */
|
||||
#ifdef IF_TK
|
||||
#if 0
|
||||
/* XXX TJM implement tk_refresh */
|
||||
status = -1;
|
||||
if (!bu_strncmp(ifp->if_name, tk_device_name, strlen(tk_device_name))) {
|
||||
status = tk_refresh(ifp, x, y, w, h);
|
||||
}
|
||||
#endif
|
||||
#endif /* IF_TK */
|
||||
|
||||
if (status < 0) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Hook function wrapper to the fb_common_file_size Tcl command
|
||||
*/
|
||||
@@ -114,6 +451,8 @@ int
|
||||
Fb_Init(Tcl_Interp *interp)
|
||||
{
|
||||
static struct bu_cmdtab cmdtab[] = {
|
||||
{"fb_open_existing", fb_cmd_open_existing},
|
||||
{"fb_close_existing", fb_cmd_close_existing},
|
||||
{"fb_common_file_size", fb_cmd_common_file_size},
|
||||
{(const char *)NULL, BU_CMD_NULL}
|
||||
};
|
||||
|
||||
+28
-1
@@ -1791,7 +1791,34 @@ ged_draw_guts(struct ged *gedp, int argc, const char *argv[], int kind)
|
||||
int
|
||||
ged_draw(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
return ged_draw_guts(gedp, argc, argv, 1);
|
||||
int i;
|
||||
int ret;
|
||||
struct ged_display_list *gdlp = NULL;
|
||||
for (i = 1; i < argc; ++i) {
|
||||
/* Skip any options */
|
||||
if (argv[i][0] == '-')
|
||||
continue;
|
||||
|
||||
bu_log("draw %s\n", argv[i]);
|
||||
}
|
||||
|
||||
bu_log("ged_gdp before draw:\n");
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, gedp->ged_gdp->gd_headDisplay)) {
|
||||
bu_log("%s\n", bu_vls_addr(&gdlp->gdl_path));
|
||||
gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
}
|
||||
|
||||
ret = ged_draw_guts(gedp, argc, argv, 1);
|
||||
|
||||
bu_log("ged_gdp after draw:\n");
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, gedp->ged_gdp->gd_headDisplay)) {
|
||||
bu_log("%s\n", bu_vls_addr(&gdlp->gdl_path));
|
||||
gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Regular → Executable
@@ -24,7 +24,6 @@ set(LIBTCLCAD_SRCS
|
||||
tkImgFmtPIX.c
|
||||
cmdhist_obj.c
|
||||
)
|
||||
set_property(SOURCE tclcad_obj.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
BRLCAD_ADDLIB(libtclcad "${LIBTCLCAD_SRCS}" "libged;libdm;${TCLCAD_XLIBS}")
|
||||
SET_TARGET_PROPERTIES(libtclcad PROPERTIES VERSION 20.0.1 SOVERSION 20)
|
||||
set(tclcad_ignore_files tclcad_private.h)
|
||||
|
||||
+122
-99
@@ -62,51 +62,34 @@
|
||||
#include "ged.h"
|
||||
#include "dm/dm-Null.h"
|
||||
|
||||
#include "fb.h"
|
||||
|
||||
#ifdef DM_X
|
||||
# ifdef WITH_TK
|
||||
# include "tk.h"
|
||||
#ifdef HAVE_TK
|
||||
# include "tk.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
# include <X11/Xutil.h>
|
||||
# include "dm/dm_xvars.h"
|
||||
# include "dm/dm-X.h"
|
||||
#endif /* DM_X */
|
||||
|
||||
#ifdef DM_TK
|
||||
# ifdef WITH_TK
|
||||
# include "tk.h"
|
||||
# endif
|
||||
# include "dm/dm_xvars.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 */
|
||||
#endif /* X11 */
|
||||
|
||||
#ifdef DM_OSG
|
||||
# include "dm/dm_xvars.h"
|
||||
# include "dm/dm-osg.h"
|
||||
#endif /* DM_OSG */
|
||||
|
||||
#ifdef DM_WGL
|
||||
# include <tkwinport.h>
|
||||
# include "dm/dm_xvars.h"
|
||||
# include "dm/dm-wgl.h"
|
||||
#ifdef HAVE_TK
|
||||
# ifdef _WIN32
|
||||
# include <tkwinport.h>
|
||||
# endif
|
||||
#endif /* DM_WGL */
|
||||
|
||||
#ifdef DM_QT
|
||||
# include "dm/dm_xvars.h"
|
||||
#endif /* DM_QT */
|
||||
#include "dm/dm_xvars.h"
|
||||
|
||||
/* Private headers */
|
||||
#include "tclcad_private.h"
|
||||
#include "fb/fb_platform_specific.h"
|
||||
|
||||
#include "brlcad_version.h"
|
||||
|
||||
/* For open_existing functionality - need a better solution */
|
||||
#include "../libfb/fb_private.h"
|
||||
|
||||
#define TO_UNLIMITED -1
|
||||
|
||||
@@ -2294,7 +2277,9 @@ to_configure(struct ged *gedp,
|
||||
|
||||
/* configure the framebuffer window */
|
||||
if (gdvp->gdv_fbs.fbs_fbp != FB_NULL)
|
||||
(void)fb_configure_window(gdvp->gdv_fbs.fbs_fbp, gdvp->gdv_dmp->dm_width, gdvp->gdv_dmp->dm_height);
|
||||
fb_configureWindow(gdvp->gdv_fbs.fbs_fbp,
|
||||
gdvp->gdv_dmp->dm_width,
|
||||
gdvp->gdv_dmp->dm_height);
|
||||
|
||||
{
|
||||
char cdimX[32];
|
||||
@@ -13206,85 +13191,137 @@ HIDDEN void to_dm_get_display_image(struct ged *gedp, unsigned char **idata)
|
||||
HIDDEN int
|
||||
to_open_fbs(struct ged_dm_view *gdvp, Tcl_Interp *interp)
|
||||
{
|
||||
struct fb_platform_specific *fb_ps;
|
||||
#ifdef DM_X
|
||||
struct X24_fb_info *xfb_ps;
|
||||
#endif
|
||||
#ifdef DM_OGL
|
||||
struct ogl_fb_info *ofb_ps;
|
||||
#endif
|
||||
#ifdef DM_WGL
|
||||
struct wgl_fb_info *wfb_ps;
|
||||
#endif
|
||||
#ifdef DM_QT
|
||||
struct qt_fb_info *qtfb_ps;
|
||||
#endif
|
||||
|
||||
/* already open */
|
||||
if (gdvp->gdv_fbs.fbs_fbp != FB_NULL)
|
||||
return TCL_OK;
|
||||
|
||||
/* don't use bu_calloc so we can fail slightly more gracefully */
|
||||
gdvp->gdv_fbs.fbs_fbp = fb_get();
|
||||
if ((gdvp->gdv_fbs.fbs_fbp == FB_NULL)) {
|
||||
Tcl_Obj *obj;
|
||||
|
||||
obj = Tcl_GetObjResult(interp);
|
||||
if (Tcl_IsShared(obj))
|
||||
obj = Tcl_DuplicateObj(obj);
|
||||
|
||||
Tcl_AppendStringsToObj(obj, "openfb: failed to allocate framebuffer memory\n",
|
||||
(char *)NULL);
|
||||
|
||||
Tcl_SetObjResult(interp, obj);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
switch (gdvp->gdv_dmp->dm_type) {
|
||||
#ifdef DM_X
|
||||
case DM_TYPE_X:
|
||||
fb_ps = fb_get_platform_specific(FB_X24_MAGIC);
|
||||
xfb_ps = (struct X24_fb_info *)fb_ps->data;
|
||||
xfb_ps->dpy = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy;
|
||||
xfb_ps->win = ((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->pix;
|
||||
xfb_ps->cwinp = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.priv_vars)->win;
|
||||
xfb_ps->cmap = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.priv_vars)->cmap;
|
||||
xfb_ps->vip = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.priv_vars)->vip;
|
||||
xfb_ps->gc = ((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->gc;
|
||||
gdvp->gdv_fbs.fbs_fbp = fb_open_existing("X", gdvp->gdv_dmp->dm_width, gdvp->gdv_dmp->dm_height, fb_ps);
|
||||
fb_put_platform_specific(fb_ps);
|
||||
fb_set_interface(gdvp->gdv_fbs.fbs_fbp, "X24");
|
||||
fb_set_name(gdvp->gdv_fbs.fbs_fbp, "/dev/X");
|
||||
/* Mark OK by filling in magic number */
|
||||
fb_set_magic(gdvp->gdv_fbs.fbs_fbp, FB_MAGIC);
|
||||
|
||||
_X24_open_existing(gdvp->gdv_fbs.fbs_fbp,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->pix,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip,
|
||||
gdvp->gdv_dmp->dm_width,
|
||||
gdvp->gdv_dmp->dm_height,
|
||||
((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->gc);
|
||||
break;
|
||||
#endif
|
||||
#ifdef DM_TK
|
||||
#if 0
|
||||
/* XXX TJM implement _tk_open_existing */
|
||||
case DM_TYPE_TK:
|
||||
fb_set_interface(gdvp->gdv_fbs.fbs_fbp, &tk_interface);
|
||||
fb_set_name(gdvp->gdv_fbs.fbs_fbp, "/dev/tk");
|
||||
/* Mark OK by filling in magic number */
|
||||
fb_set_magic(gdvp->gdv_fbs.fbs_fbp, FB_MAGIC);
|
||||
|
||||
_tk_open_existing(gdvp->gdv_fbs.fbs_fbp,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->pix,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip,
|
||||
gdvp->gdv_dmp->dm_width,
|
||||
gdvp->gdv_dmp->dm_height,
|
||||
((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->gc);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DM_OGL
|
||||
case DM_TYPE_OGL:
|
||||
fb_ps = fb_get_platform_specific(FB_OGL_MAGIC);
|
||||
ofb_ps = (struct ogl_fb_info *)fb_ps->data;
|
||||
ofb_ps->dpy = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy;
|
||||
ofb_ps->win = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win;
|
||||
ofb_ps->cmap = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap;
|
||||
ofb_ps->vip = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip;
|
||||
ofb_ps->glxc = ((struct ogl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->glxc;
|
||||
ofb_ps->double_buffer = ((struct ogl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->mvars.doublebuffer;
|
||||
ofb_ps->soft_cmap = 0;
|
||||
gdvp->gdv_fbs.fbs_fbp = fb_open_existing("ogl", gdvp->gdv_dmp->dm_width, gdvp->gdv_dmp->dm_height, fb_ps);
|
||||
fb_put_platform_specific(fb_ps);
|
||||
fb_set_interface(gdvp->gdv_fbs.fbs_fbp, "ogl");
|
||||
fb_set_name(gdvp->gdv_fbs.fbs_fbp, "/dev/ogl");
|
||||
/* Mark OK by filling in magic number */
|
||||
fb_set_magic(gdvp->gdv_fbs.fbs_fbp, FB_MAGIC);
|
||||
|
||||
_ogl_open_existing(gdvp->gdv_fbs.fbs_fbp,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip,
|
||||
gdvp->gdv_dmp->dm_width,
|
||||
gdvp->gdv_dmp->dm_height,
|
||||
((struct ogl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->glxc,
|
||||
((struct ogl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->mvars.doublebuffer,
|
||||
0);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef DM_OSG
|
||||
case DM_TYPE_OSG:
|
||||
#if 0
|
||||
fb_set_interface(gdvp->gdv_fbs.fbs_fbp, "osg");
|
||||
fb_set_name(gdvp->gdv_fbs.fbs_fbp, "/dev/osg");
|
||||
/* Mark OK by filling in magic number */
|
||||
fb_set_magic(gdvp->gdv_fbs.fbs_fbp, FB_MAGIC);
|
||||
|
||||
_osg_open_existing(gdvp->gdv_fbs.fbs_fbp,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip,
|
||||
gdvp->gdv_dmp->dm_width,
|
||||
gdvp->gdv_dmp->dm_height,
|
||||
((struct osg_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->viewer,
|
||||
((struct osg_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->mvars.doublebuffer,
|
||||
0);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef DM_WGL
|
||||
case DM_TYPE_WGL:
|
||||
fb_ps = fb_get_platform_specific(FB_WGL_MAGIC);
|
||||
wfb_ps = (struct wgl_fb_info *)fb_ps->data;
|
||||
wfb_ps->dpy = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy;
|
||||
wfb_ps->win = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win;
|
||||
wfb_ps->cmap = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap;
|
||||
wfb_ps->vip = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip;
|
||||
wfb_ps->hdc = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->hdc;
|
||||
wfb_ps->glxc = ((struct wgl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->glxc;
|
||||
wfb_ps->double_buffer = ((struct wgl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->mvars.doublebuffer
|
||||
wfb_ps->soft_cmap = 0;
|
||||
gdvp->gdv_fbs.fbs_fbp = fb_open_existing("wgl", gdvp->gdv_dmp->dm_width, gdvp->gdv_dmp->dm_height, fb_ps);
|
||||
fb_put_platform_specific(fb_ps);
|
||||
fb_set_interface(gdvp->gdv_fbs.fbs_fbp, "wgl");
|
||||
fb_set_name(gdvp->gdv_fbs.fbs_fbp, "/dev/wgl");
|
||||
/* Mark OK by filling in magic number */
|
||||
fb_set_magic(gdvp->gdv_fbs.fbs_fbp, FB_MAGIC);
|
||||
|
||||
_wgl_open_existing(gdvp->gdv_fbs.fbs_fbp,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip,
|
||||
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->hdc,
|
||||
gdvp->gdv_dmp->dm_width,
|
||||
gdvp->gdv_dmp->dm_height,
|
||||
((struct wgl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->glxc,
|
||||
((struct wgl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->mvars.doublebuffer,
|
||||
0);
|
||||
break;
|
||||
#endif
|
||||
#ifdef DM_QT
|
||||
case DM_TYPE_QT:
|
||||
fb_ps = fb_get_platform_specific(FB_QT_MAGIC);
|
||||
qtfb_ps = (struct wgl_fb_info *)fb_ps->data;
|
||||
qtfb_ps->qapp = NULL;
|
||||
qtfb_ps->qwin = NULL;
|
||||
qtfb_ps->qpainter = NULL;
|
||||
qtfb_ps->draw = NULL;
|
||||
qtfb_ps->qimg = NULL;
|
||||
/*gdvp->gdv_fbs.fbs_fbp = fb_open_existing("Qt", gdvp->gdv_dmp->dm_width, gdvp->gdv_dmp->dm_height, fb_ps);*/
|
||||
fb_put_platform_specific(fb_ps);
|
||||
fb_set_interface(gdvp->gdv_fbs.fbs_fbp, "Qt");
|
||||
fb_set_name(gdvp->gdv_fbs.fbs_fbp, "/dev/Qt");
|
||||
/* Mark OK by filling in magic number */
|
||||
fb_set_magic(gdvp->gdv_fbs.fbs_fbp, FB_MAGIC);
|
||||
|
||||
gdvp->gdv_dmp->dm_openFb(gdvp->gdv_dmp, gdvp->gdv_fbs.fbs_fbp);
|
||||
|
||||
break;
|
||||
@@ -13307,20 +13344,6 @@ to_open_fbs(struct ged_dm_view *gdvp, Tcl_Interp *interp)
|
||||
}
|
||||
}
|
||||
|
||||
if ((gdvp->gdv_fbs.fbs_fbp == FB_NULL)) {
|
||||
Tcl_Obj *obj;
|
||||
|
||||
obj = Tcl_GetObjResult(interp);
|
||||
if (Tcl_IsShared(obj))
|
||||
obj = Tcl_DuplicateObj(obj);
|
||||
|
||||
Tcl_AppendStringsToObj(obj, "openfb: failed to allocate framebuffer memory\n",
|
||||
(char *)NULL);
|
||||
|
||||
Tcl_SetObjResult(interp, obj);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
+2
-33
@@ -37,41 +37,14 @@ else(LEX_EXECUTABLE AND YACC_EXECUTABLE)
|
||||
CMAKEFILES(points)
|
||||
endif(LEX_EXECUTABLE AND YACC_EXECUTABLE)
|
||||
|
||||
if(WIN32 AND BRLCAD_ENABLE_OPENGL)
|
||||
set(MGED_DM_SOURCES "${MGED_DM_SOURCES};dm-wgl.c")
|
||||
set_property(SOURCE dm-wgl.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
endif(WIN32 AND BRLCAD_ENABLE_OPENGL)
|
||||
|
||||
if(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_TK)
|
||||
set(MGED_DM_SOURCES "${MGED_DM_SOURCES};dm-ogl.c")
|
||||
set_property(SOURCE dm-ogl.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
endif(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_TK)
|
||||
|
||||
if(BRLCAD_ENABLE_OSG)
|
||||
set(MGED_DM_SOURCES "${MGED_DM_SOURCES};dm-osg.c")
|
||||
set_property(SOURCE dm-osg.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
set(MGED_DM_SOURCES "${MGED_DM_SOURCES};dm-osg.cpp")
|
||||
endif(BRLCAD_ENABLE_OSG)
|
||||
|
||||
if(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_TK)
|
||||
set(MGED_DM_SOURCES "${MGED_DM_SOURCES};dm-X.c")
|
||||
set_property(SOURCE dm-X.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
endif(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_TK)
|
||||
|
||||
if(BRLCAD_ENABLE_QT AND BRLCAD_ENABLE_TK)
|
||||
set(MGED_DM_SOURCES "${MGED_DM_SOURCES};dm-qt.c")
|
||||
set_property(SOURCE dm-qt.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
endif(BRLCAD_ENABLE_QT AND BRLCAD_ENABLE_TK)
|
||||
|
||||
#if(BRLCAD_ENABLE_TK)
|
||||
# set(MGED_DM_SOURCES "${MGED_DM_SOURCES};dm-tk.c")
|
||||
# set_property(SOURCE dm-tk.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
#endif(BRLCAD_ENABLE_TK)
|
||||
|
||||
if(BRLCAD_ENABLE_RTGL)
|
||||
set(MGED_DM_SOURCES "${MGED_DM_SOURCES};dm-rtgl.c")
|
||||
set_property(SOURCE dm-rtgl.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
|
||||
endif(BRLCAD_ENABLE_RTGL)
|
||||
|
||||
set(MGED_SOURCES
|
||||
adc.c
|
||||
arbs.c
|
||||
@@ -168,12 +141,8 @@ set(mged_ignore_files
|
||||
comb_bool.h
|
||||
comb_bool_parse.y
|
||||
comb_bool_scan.l
|
||||
dm-ogl.c
|
||||
dm-osg.c
|
||||
dm-osg.cpp
|
||||
dm-qt.c
|
||||
dm-rtgl.c
|
||||
dm-tk.c
|
||||
dm-wgl.c
|
||||
fbserv.h
|
||||
htmlLibraryUi.h
|
||||
menu.h
|
||||
|
||||
+2
-2
@@ -188,10 +188,10 @@ mged_fb_open(void)
|
||||
# endif
|
||||
#endif /* DM_OGL */
|
||||
#ifdef DM_OSG
|
||||
#if 0
|
||||
# if defined(HAVE_TK)
|
||||
if (dmp->dm_type == DM_TYPE_OSG)
|
||||
Osg_fb_open();
|
||||
#endif
|
||||
# endif
|
||||
#endif /* DM_OSG */
|
||||
#ifdef DM_RTGL
|
||||
if (dmp->dm_type == DM_TYPE_RTGL)
|
||||
|
||||
-205
@@ -1,205 +0,0 @@
|
||||
/* D M - X . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2004-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program 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 program 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 mged/dm-X.c
|
||||
*
|
||||
* Routines specific to MGED's use of LIBDM's X display manager.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#ifdef HAVE_TK
|
||||
# include "tk.h"
|
||||
#endif
|
||||
|
||||
#include "bu.h"
|
||||
#include "vmath.h"
|
||||
#include "mater.h"
|
||||
#include "raytrace.h"
|
||||
#include "dm/dm_xvars.h"
|
||||
#include "dm/dm-X.h"
|
||||
#include "fb.h"
|
||||
#include "fb/fb_platform_specific.h"
|
||||
|
||||
#include "./mged.h"
|
||||
#include "./sedit.h"
|
||||
#include "./mged_dm.h"
|
||||
|
||||
extern void dm_var_init(struct dm_list *initial_dm_list); /* defined in attach.c */
|
||||
|
||||
|
||||
static void
|
||||
dirty_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
dirty = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
zclip_hook(const struct bu_structparse *sdp,
|
||||
const char *name,
|
||||
void *base,
|
||||
const char *value)
|
||||
{
|
||||
view_state->vs_gvp->gv_zclip = dmp->dm_zclip;
|
||||
dirty_hook(sdp, name, base, value);
|
||||
}
|
||||
|
||||
|
||||
struct bu_structparse X_vparse[] = {
|
||||
{"%g", 1, "bound", DM_O(dm_bound), dirty_hook, NULL, NULL},
|
||||
{"%d", 1, "useBound", DM_O(dm_boundFlag), dirty_hook, NULL, NULL},
|
||||
{"%d", 1, "zclip", DM_O(dm_zclip), zclip_hook, NULL, NULL},
|
||||
{"%d", 1, "debug", DM_O(dm_debugLevel), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL},
|
||||
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
This routine is being called from doEvent() to handle Expose events.
|
||||
*/
|
||||
static int
|
||||
X_doevent(ClientData UNUSED(clientData), XEvent *eventPtr)
|
||||
{
|
||||
if (eventPtr->type == Expose && eventPtr->xexpose.count == 0) {
|
||||
dirty = 1;
|
||||
|
||||
/* no further processing of this event */
|
||||
return TCL_RETURN;
|
||||
}
|
||||
|
||||
/* allow further processing of this event */
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
X_dm(int argc, const char *argv[])
|
||||
{
|
||||
if (BU_STR_EQUAL(argv[0], "set")) {
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
if (argc < 2) {
|
||||
/* Bare set command, print out current settings */
|
||||
bu_vls_struct_print2(&vls, "dm_X internal variables", X_vparse, (const char *)dmp);
|
||||
} else if (argc == 2) {
|
||||
bu_vls_struct_item_named(&vls, X_vparse, argv[1], (const char *)dmp, COMMA);
|
||||
} else {
|
||||
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
|
||||
int ret;
|
||||
|
||||
bu_vls_printf(&tmp_vls, "%s=\"", argv[1]);
|
||||
bu_vls_from_argv(&tmp_vls, argc-2, (const char **)argv+2);
|
||||
bu_vls_putc(&tmp_vls, '\"');
|
||||
ret = bu_struct_parse(&tmp_vls, X_vparse, (char *)dmp);
|
||||
bu_vls_free(&tmp_vls);
|
||||
if (ret < 0) {
|
||||
bu_vls_free(&vls);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
Tcl_AppendResult(INTERP, bu_vls_addr(&vls), (char *)NULL);
|
||||
bu_vls_free(&vls);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
return common_dm(argc, argv);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
X_dm_init(struct dm_list *o_dm_list,
|
||||
int argc,
|
||||
const char *argv[])
|
||||
{
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
dm_var_init(o_dm_list);
|
||||
|
||||
/* register application provided routines */
|
||||
cmd_hook = X_dm;
|
||||
|
||||
#ifdef HAVE_TK
|
||||
Tk_DeleteGenericHandler(doEvent, (ClientData)NULL);
|
||||
#endif
|
||||
|
||||
if ((dmp = dm_open(INTERP, DM_TYPE_X, argc-1, argv)) == DM_NULL)
|
||||
return TCL_ERROR;
|
||||
|
||||
/* keep display manager in sync */
|
||||
dmp->dm_perspective = mged_variables->mv_perspective_mode;
|
||||
|
||||
eventHandler = X_doevent;
|
||||
|
||||
#ifdef HAVE_TK
|
||||
Tk_CreateGenericHandler(doEvent, (ClientData)NULL);
|
||||
#endif
|
||||
|
||||
(void)DM_CONFIGURE_WIN(dmp, 0);
|
||||
|
||||
bu_vls_printf(&vls, "mged_bind_dm %s", bu_vls_addr(&dmp->dm_pathName));
|
||||
Tcl_Eval(INTERP, bu_vls_addr(&vls));
|
||||
bu_vls_free(&vls);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
X_fb_open(void)
|
||||
{
|
||||
struct fb_platform_specific *fb_ps;
|
||||
struct X24_fb_info *xfb_ps;
|
||||
|
||||
fb_ps = fb_get_platform_specific(FB_X24_MAGIC);
|
||||
xfb_ps = (struct X24_fb_info *)fb_ps->data;
|
||||
xfb_ps->dpy = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy;
|
||||
xfb_ps->win = ((struct x_vars *)dmp->dm_vars.priv_vars)->pix;
|
||||
xfb_ps->cwinp = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->win;
|
||||
xfb_ps->cmap = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->cmap;
|
||||
xfb_ps->vip = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->vip;
|
||||
xfb_ps->gc = ((struct x_vars *)dmp->dm_vars.priv_vars)->gc;
|
||||
|
||||
fbp = fb_open_existing("X", dmp->dm_width, dmp->dm_height, fb_ps);
|
||||
fb_put_platform_specific(fb_ps);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,391 +0,0 @@
|
||||
/* D M - O G L . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2004-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program 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 program 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 mged/dm-ogl.c
|
||||
*
|
||||
* Routines specific to MGED's use of LIBDM's OpenGl display manager.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
/* 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
|
||||
|
||||
#ifdef HAVE_GL_DEVICE_H
|
||||
# include <gl/device.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TK
|
||||
# include "tk.h"
|
||||
#endif
|
||||
|
||||
#include "bu.h"
|
||||
#include "vmath.h"
|
||||
#include "mater.h"
|
||||
#include "raytrace.h"
|
||||
#include "dm/dm_xvars.h"
|
||||
#include "dm/dm-ogl.h"
|
||||
|
||||
#include "./mged.h"
|
||||
#include "./sedit.h"
|
||||
#include "./mged_dm.h"
|
||||
|
||||
#include "fb/fb_platform_specific.h"
|
||||
#include "fb.h"
|
||||
|
||||
extern void dm_var_init(); /* defined in attach.c */
|
||||
|
||||
/* external sp_hook functions */
|
||||
extern void cs_set_bg(const struct bu_structparse *, const char *, void *, const char *); /* defined in color_scheme.c */
|
||||
|
||||
static int Ogl_dm();
|
||||
static int Ogl_doevent();
|
||||
|
||||
/* local sp_hook functions */
|
||||
static void Ogl_colorchange(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void zclip_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void establish_zbuffer(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void establish_lighting(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void establish_transparency(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void do_fogHint(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void dirty_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void debug_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void logfile_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void bound_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void boundFlag_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
|
||||
struct bu_structparse Ogl_vparse[] = {
|
||||
{"%d", 1, "depthcue", Ogl_MV_O(cueing_on), Ogl_colorchange, NULL, NULL },
|
||||
{"%d", 1, "zclip", Ogl_MV_O(zclipping_on), zclip_hook, NULL, NULL },
|
||||
{"%d", 1, "zbuffer", Ogl_MV_O(zbuffer_on), establish_zbuffer, NULL, NULL },
|
||||
{"%d", 1, "lighting", Ogl_MV_O(lighting_on), establish_lighting, NULL, NULL },
|
||||
{"%d", 1, "transparency", Ogl_MV_O(transparency_on), establish_transparency, NULL, NULL },
|
||||
{"%d", 1, "fastfog", Ogl_MV_O(fastfog), do_fogHint, NULL, NULL },
|
||||
{"%g", 1, "density", Ogl_MV_O(fogdensity), dirty_hook, NULL, NULL },
|
||||
{"%d", 1, "has_zbuf", Ogl_MV_O(zbuf), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
|
||||
{"%d", 1, "has_rgb", Ogl_MV_O(rgb), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
|
||||
{"%d", 1, "has_doublebuffer", Ogl_MV_O(doublebuffer), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
|
||||
{"%d", 1, "depth", Ogl_MV_O(depth), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
|
||||
{"%d", 1, "debug", Ogl_MV_O(debug), debug_hook, NULL, NULL },
|
||||
{"%V", 1, "log", Ogl_MV_O(log), logfile_hook, NULL, NULL },
|
||||
{"%g", 1, "bound", Ogl_MV_O(bound), bound_hook, NULL, NULL },
|
||||
{"%d", 1, "useBound", Ogl_MV_O(boundFlag), boundFlag_hook, NULL, NULL },
|
||||
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
Ogl_dm_init(struct dm_list *o_dm_list,
|
||||
int argc,
|
||||
const char *argv[])
|
||||
{
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
dm_var_init(o_dm_list);
|
||||
|
||||
/* register application provided routines */
|
||||
cmd_hook = Ogl_dm;
|
||||
|
||||
Tk_DeleteGenericHandler(doEvent, (ClientData)NULL);
|
||||
|
||||
if ((dmp = dm_open(INTERP, DM_TYPE_OGL, argc-1, argv)) == DM_NULL)
|
||||
return TCL_ERROR;
|
||||
|
||||
/*XXXX this eventually needs to move into Ogl's private structure */
|
||||
dmp->dm_vp = &view_state->vs_gvp->gv_scale;
|
||||
dmp->dm_perspective = mged_variables->mv_perspective_mode;
|
||||
|
||||
eventHandler = Ogl_doevent;
|
||||
Tk_CreateGenericHandler(doEvent, (ClientData)NULL);
|
||||
(void)DM_CONFIGURE_WIN(dmp, 0);
|
||||
|
||||
bu_vls_printf(&vls, "mged_bind_dm %s", bu_vls_addr(&dmp->dm_pathName));
|
||||
Tcl_Eval(INTERP, bu_vls_addr(&vls));
|
||||
bu_vls_free(&vls);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Ogl_fb_open()
|
||||
{
|
||||
struct fb_platform_specific *fb_ps;
|
||||
struct ogl_fb_info *ofb_ps;
|
||||
fb_ps = fb_get_platform_specific(FB_OGL_MAGIC);
|
||||
ofb_ps = (struct ogl_fb_info *)fb_ps->data;
|
||||
ofb_ps->dpy = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy;
|
||||
ofb_ps->win = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->win;
|
||||
ofb_ps->cmap = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->cmap;
|
||||
ofb_ps->vip = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->vip;
|
||||
ofb_ps->glxc = ((struct ogl_vars *)dmp->dm_vars.priv_vars)->glxc;
|
||||
ofb_ps->double_buffer = ((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.doublebuffer;
|
||||
ofb_ps->soft_cmap = 0;
|
||||
fbp = fb_open_existing("ogl", dmp->dm_width, dmp->dm_height, fb_ps);
|
||||
fb_put_platform_specific(fb_ps);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This routine is being called from doEvent() to handle Expose events.
|
||||
*/
|
||||
static int
|
||||
Ogl_doevent(ClientData UNUSED(clientData),
|
||||
XEvent *eventPtr)
|
||||
{
|
||||
if (eventPtr->type == Expose && eventPtr->xexpose.count == 0) {
|
||||
if (!glXMakeCurrent(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct dm_xvars *)dmp->dm_vars.pub_vars)->win,
|
||||
((struct ogl_vars *)dmp->dm_vars.priv_vars)->glxc))
|
||||
/* allow further processing of this event */
|
||||
return TCL_OK;
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
dirty = 1;
|
||||
|
||||
/* no further processing of this event */
|
||||
return TCL_RETURN;
|
||||
}
|
||||
|
||||
/* allow further processing of this event */
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Implement display-manager specific commands, from MGED "dm" command.
|
||||
*/
|
||||
static int
|
||||
Ogl_dm(int argc,
|
||||
const char *argv[])
|
||||
{
|
||||
if (BU_STR_EQUAL(argv[0], "set")) {
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
if (argc < 2) {
|
||||
/* Bare set command, print out current settings */
|
||||
bu_vls_struct_print2(&vls,
|
||||
"dm_ogl internal variables",
|
||||
Ogl_vparse,
|
||||
(const char *)&((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars);
|
||||
} else if (argc == 2) {
|
||||
bu_vls_struct_item_named(&vls,
|
||||
Ogl_vparse,
|
||||
argv[1],
|
||||
(const char *)&((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars,
|
||||
COMMA);
|
||||
} else {
|
||||
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
|
||||
int ret;
|
||||
|
||||
bu_vls_printf(&tmp_vls, "%s=\"", argv[1]);
|
||||
bu_vls_from_argv(&tmp_vls, argc-2, (const char **)argv+2);
|
||||
bu_vls_putc(&tmp_vls, '\"');
|
||||
ret = bu_struct_parse(&tmp_vls,
|
||||
Ogl_vparse,
|
||||
(char *)&((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars);
|
||||
bu_vls_free(&tmp_vls);
|
||||
if (ret < 0) {
|
||||
bu_vls_free(&vls);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
Tcl_AppendResult(INTERP, bu_vls_addr(&vls), (char *)NULL);
|
||||
bu_vls_free(&vls);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
return common_dm(argc, argv);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Ogl_colorchange(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
if (((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.cueing_on) {
|
||||
glEnable(GL_FOG);
|
||||
} else {
|
||||
glDisable(GL_FOG);
|
||||
}
|
||||
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
establish_zbuffer(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
(void)DM_MAKE_CURRENT(dmp);
|
||||
(void)DM_SET_ZBUFFER(dmp, ((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.zbuffer_on);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
establish_lighting(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
(void)DM_MAKE_CURRENT(dmp);
|
||||
(void)DM_SET_LIGHT(dmp, ((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.lighting_on);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
establish_transparency(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
(void)DM_MAKE_CURRENT(dmp);
|
||||
(void)DM_SET_TRANSPARENCY(dmp, ((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.transparency_on);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
do_fogHint(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
dm_fogHint(dmp, ((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.fastfog);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dirty_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
dirty = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
zclip_hook(const struct bu_structparse *sdp,
|
||||
const char *name,
|
||||
void *base,
|
||||
const char *value)
|
||||
{
|
||||
fastf_t bounds[6] = { GED_MIN, GED_MAX, GED_MIN, GED_MAX, GED_MIN, GED_MAX };
|
||||
|
||||
dmp->dm_zclip = ((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.zclipping_on;
|
||||
view_state->vs_gvp->gv_zclip = dmp->dm_zclip;
|
||||
dirty_hook(sdp, name, base, value);
|
||||
|
||||
if (dmp->dm_zclip) {
|
||||
bounds[4] = -1.0;
|
||||
bounds[5] = 1.0;
|
||||
}
|
||||
|
||||
(void)DM_MAKE_CURRENT(dmp);
|
||||
(void)DM_SET_WIN_BOUNDS(dmp, bounds);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
debug_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
DM_DEBUG(dmp, ((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.debug);
|
||||
}
|
||||
|
||||
static void
|
||||
logfile_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
DM_LOGFILE(dmp, bu_vls_addr(&((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.log));
|
||||
}
|
||||
|
||||
static void
|
||||
bound_hook(const struct bu_structparse *sdp,
|
||||
const char *name,
|
||||
void *base,
|
||||
const char *value)
|
||||
{
|
||||
dmp->dm_bound =
|
||||
((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.bound;
|
||||
dirty_hook(sdp, name, base, value);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
boundFlag_hook(const struct bu_structparse *sdp,
|
||||
const char *name,
|
||||
void *base,
|
||||
const char *value)
|
||||
{
|
||||
dmp->dm_boundFlag =
|
||||
((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.boundFlag;
|
||||
dirty_hook(sdp, name, base, value);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -23,6 +23,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
#include "common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -34,13 +35,17 @@
|
||||
#endif
|
||||
|
||||
#include "dm/dm_xvars.h"
|
||||
#include "fbio.h"
|
||||
}
|
||||
#include "dm/dm-osg.h"
|
||||
|
||||
extern "C" {
|
||||
#include "./mged.h"
|
||||
#include "./sedit.h"
|
||||
#include "./mged_dm.h"
|
||||
}
|
||||
|
||||
extern void dm_var_init(struct dm_list *initial_dm_list); /* defined in attach.c */
|
||||
extern "C" void dm_var_init(struct dm_list *initial_dm_list); /* defined in attach.c */
|
||||
|
||||
static void
|
||||
dirty_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
@@ -92,6 +97,33 @@ struct bu_structparse osg_vparse[] = {
|
||||
{"", 0, NULL, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
extern "C" void
|
||||
Osg_fb_open()
|
||||
{
|
||||
const char *osg_name = "/dev/osg";
|
||||
|
||||
if ((fbp = (fb *)calloc(sizeof(fb), 1)) == fb_NULL) {
|
||||
Tcl_AppendResult(INTERP, "Osg_fb_open: failed to allocate framebuffer memory\n",
|
||||
(char *)NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
*fbp = osg_interface; /* struct copy */
|
||||
|
||||
fbp->if_name = (char *)bu_malloc((unsigned)strlen(osg_name)+1, "if_name");
|
||||
bu_strlcpy(fbp->if_name, osg_name, strlen(osg_name)+1);
|
||||
|
||||
/* Mark OK by filling in magic number */
|
||||
fbp->if_magic = FB_MAGIC;
|
||||
_osg_open_existing(fbp,
|
||||
((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct dm_xvars *)dmp->dm_vars.pub_vars)->win,
|
||||
((struct dm_xvars *)dmp->dm_vars.pub_vars)->cmap,
|
||||
dmp->dm_width, dmp->dm_height,
|
||||
((struct osg_vars *)dmp->dm_vars.priv_vars)->graphicsContext);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This routine is being called from doEvent() to handle Expose events.
|
||||
*/
|
||||
@@ -144,8 +176,7 @@ Osg_dm(int argc, const char *argv[])
|
||||
return common_dm(argc, argv);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
extern "C" int
|
||||
Osg_dm_init(struct dm_list *o_dm_list,
|
||||
int argc,
|
||||
const char *argv[])
|
||||
@@ -155,7 +186,7 @@ Osg_dm_init(struct dm_list *o_dm_list,
|
||||
dm_var_init(o_dm_list);
|
||||
|
||||
/* register application provided routines */
|
||||
cmd_hook = Osg_dm;
|
||||
cmd_hook = (int (*)())Osg_dm;
|
||||
|
||||
Tk_DeleteGenericHandler(doEvent, (ClientData)NULL);
|
||||
if ((dmp = dm_open(INTERP, DM_TYPE_OSG, argc-1, argv)) == DM_NULL)
|
||||
@@ -164,7 +195,7 @@ Osg_dm_init(struct dm_list *o_dm_list,
|
||||
/* keep display manager in sync */
|
||||
dmp->dm_perspective = mged_variables->mv_perspective_mode;
|
||||
|
||||
eventHandler = Osg_doevent;
|
||||
eventHandler = (int (*)())Osg_doevent;
|
||||
Tk_CreateGenericHandler(doEvent, (ClientData)NULL);
|
||||
|
||||
(void)DM_CONFIGURE_WIN(dmp, 0);
|
||||
+1
-1
@@ -161,7 +161,7 @@ Qt_fb_open(void)
|
||||
{
|
||||
char *Qt_name = "/dev/Qt";
|
||||
|
||||
if ((fbp = (fb *)calloc(sizeof(fb), 1)) == FB_NULL) {
|
||||
if ((fbp = (FBIO *)calloc(sizeof(FBIO), 1)) == FBIO_NULL) {
|
||||
Tcl_AppendResult(INTERP, "Qt_fb_open: failed to allocate framebuffer memory\n",
|
||||
(char *)NULL);
|
||||
return;
|
||||
|
||||
@@ -1,354 +0,0 @@
|
||||
/* D M - R T G L . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2004-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program 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 program 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 mged/dm-rtgl.c
|
||||
*
|
||||
* Routines specific to MGED's use of LIBDM's Ray Tracing OpenGl display manager.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_GL_GLX_H
|
||||
# include <GL/glx.h>
|
||||
#endif
|
||||
#ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
#ifdef HAVE_GL_DEVICE_H
|
||||
# include <gl/device.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TK
|
||||
# include "tk.h"
|
||||
#endif
|
||||
|
||||
#include "bu.h"
|
||||
#include "vmath.h"
|
||||
#include "mater.h"
|
||||
#include "raytrace.h"
|
||||
#include "dm/dm_xvars.h"
|
||||
#include "dm/dm-rtgl.h"
|
||||
#include "fb/fb_platform_specific.h"
|
||||
#include "fb.h"
|
||||
|
||||
#include "./mged.h"
|
||||
#include "./sedit.h"
|
||||
#include "./mged_dm.h"
|
||||
|
||||
|
||||
extern void dm_var_init(); /* defined in attach.c */
|
||||
extern void cs_set_bg(); /* defined in color_scheme.c */
|
||||
|
||||
static int Rtgl_dm();
|
||||
static int Rtgl_doevent();
|
||||
|
||||
/* local sp_hook functions */
|
||||
static void Rtgl_colorchange(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void zclip_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void establish_zbuffer(const struct bu_structparse *, const char *, void *, const char *)
|
||||
static void establish_lighting(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void establish_transparency(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void do_fogHint(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void dirty_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void debug_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void bound_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void boundFlag_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
|
||||
struct bu_structparse Rtgl_vparse[] = {
|
||||
{"%d", 1, "depthcue", Rtgl_MV_O(cueing_on), Rtgl_colorchange },
|
||||
{"%d", 1, "zclip", Rtgl_MV_O(zclipping_on), zclip_hook },
|
||||
{"%d", 1, "zbuffer", Rtgl_MV_O(zbuffer_on), establish_zbuffer },
|
||||
{"%d", 1, "lighting", Rtgl_MV_O(lighting_on), establish_lighting },
|
||||
{"%d", 1, "transparency", Rtgl_MV_O(transparency_on), establish_transparency },
|
||||
{"%d", 1, "fastfog", Rtgl_MV_O(fastfog), do_fogHint },
|
||||
{"%g", 1, "density", Rtgl_MV_O(fogdensity), dirty_hook },
|
||||
{"%d", 1, "has_zbuf", Rtgl_MV_O(zbuf), BU_STRUCTPARSE_FUNC_NULL },
|
||||
{"%d", 1, "has_rgb", Rtgl_MV_O(rgb), BU_STRUCTPARSE_FUNC_NULL },
|
||||
{"%d", 1, "has_doublebuffer", Rtgl_MV_O(doublebuffer), BU_STRUCTPARSE_FUNC_NULL },
|
||||
{"%d", 1, "depth", Rtgl_MV_O(depth), BU_STRUCTPARSE_FUNC_NULL },
|
||||
{"%d", 1, "debug", Rtgl_MV_O(debug), debug_hook },
|
||||
{"%g", 1, "bound", Rtgl_MV_O(bound), bound_hook },
|
||||
{"%d", 1, "useBound", Rtgl_MV_O(boundFlag), boundFlag_hook },
|
||||
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL }
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
Rtgl_dm_init(struct dm_list *o_dm_list,
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
dm_var_init(o_dm_list);
|
||||
|
||||
/* register application provided routines */
|
||||
cmd_hook = Rtgl_dm;
|
||||
|
||||
Tk_DeleteGenericHandler(doEvent, (ClientData)NULL);
|
||||
|
||||
if ((dmp = dm_open(INTERP, DM_TYPE_RTGL, argc-1, argv)) == DM_NULL)
|
||||
return TCL_ERROR;
|
||||
|
||||
/*XXXX this eventually needs to move into Rtgl's private structure */
|
||||
dmp->dm_vp = &view_state->vs_gvp->gv_scale;
|
||||
dmp->dm_perspective = mged_variables->mv_perspective_mode;
|
||||
|
||||
eventHandler = Rtgl_doevent;
|
||||
Tk_CreateGenericHandler(doEvent, (ClientData)NULL);
|
||||
(void)DM_CONFIGURE_WIN(dmp, 0);
|
||||
|
||||
bu_vls_printf(&vls, "mged_bind_dm %s", bu_vls_addr(&dmp->dm_pathName));
|
||||
Tcl_Eval(INTERP, bu_vls_addr(&vls));
|
||||
bu_vls_free(&vls);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Rtgl_fb_open()
|
||||
{
|
||||
struct fb_platform_specific *fb_ps;
|
||||
struct ogl_fb_info *ofb_ps;
|
||||
fb_ps = fb_get_platform_specific(FB_OGL_MAGIC);
|
||||
ofb_ps = (struct ogl_fb_info *)fb_ps->data;
|
||||
ofb_ps->dpy = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy;
|
||||
ofb_ps->win = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->win;
|
||||
ofb_ps->cmap = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->cmap;
|
||||
ofb_ps->vip = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->vip;
|
||||
ofb_ps->glxc = ((struct ogl_vars *)dmp->dm_vars.priv_vars)->glxc;
|
||||
ofb_ps->double_buffer = ((struct ogl_vars *)dmp->dm_vars.priv_vars)->mvars.doublebuffer;
|
||||
ofb_ps->soft_cmap = 0;
|
||||
fbp = fb_open_existing("ogl", dmp->dm_width, dmp->dm_height, fb_ps);
|
||||
fb_put_platform_specific(fb_ps);
|
||||
fb_set_name(fbp, "/dev/rtgl");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This routine is being called from doEvent() to handle Expose events.
|
||||
*/
|
||||
static int
|
||||
Rtgl_doevent(ClientData clientData,
|
||||
XEvent *eventPtr)
|
||||
{
|
||||
if (!glXMakeCurrent(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct dm_xvars *)dmp->dm_vars.pub_vars)->win,
|
||||
((struct rtgl_vars *)dmp->dm_vars.priv_vars)->glxc))
|
||||
/* allow further processing of this event */
|
||||
return TCL_OK;
|
||||
|
||||
if (eventPtr->type == Expose && eventPtr->xexpose.count == 0) {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
dirty = 1;
|
||||
|
||||
/* no further processing of this event */
|
||||
return TCL_RETURN;
|
||||
}
|
||||
|
||||
/* allow further processing of this event */
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Implement display-manager specific commands, from MGED "dm" command.
|
||||
*/
|
||||
static int
|
||||
Rtgl_dm(int argc,
|
||||
const char *argv[])
|
||||
{
|
||||
if (BU_STR_EQUAL(argv[0], "set")) {
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
if (argc < 2) {
|
||||
/* Bare set command, print out current settings */
|
||||
bu_vls_struct_print2(&vls,
|
||||
"dm_rtgl internal variables",
|
||||
Rtgl_vparse,
|
||||
(const char *)&((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars);
|
||||
} else if (argc == 2) {
|
||||
bu_vls_struct_item_named(&vls,
|
||||
Rtgl_vparse,
|
||||
argv[1],
|
||||
(const char *)&((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars,
|
||||
COMMA);
|
||||
} else {
|
||||
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
bu_vls_printf(&tmp_vls, "%s=\"", argv[1]);
|
||||
bu_vls_from_argv(&tmp_vls, argc-2, (const char **)argv+2);
|
||||
bu_vls_putc(&tmp_vls, '\"');
|
||||
bu_struct_parse(&tmp_vls,
|
||||
Rtgl_vparse,
|
||||
(char *)&((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars);
|
||||
bu_vls_free(&tmp_vls);
|
||||
}
|
||||
|
||||
Tcl_AppendResult(INTERP, bu_vls_addr(&vls), (char *)NULL);
|
||||
bu_vls_free(&vls);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
return common_dm(argc, argv);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Rtgl_colorchange(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
if (((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars.cueing_on) {
|
||||
glEnable(GL_FOG);
|
||||
} else {
|
||||
glDisable(GL_FOG);
|
||||
}
|
||||
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
establish_zbuffer(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
(void)DM_SET_ZBUFFER(dmp, ((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars.zbuffer_on);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
establish_lighting(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
(void)DM_SET_LIGHT(dmp, ((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars.lighting_on);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
establish_transparency(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
(void)DM_SET_TRANSPARENCY(dmp, ((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars.transparency_on);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
do_fogHint(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
dm_fogHint(dmp, ((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars.fastfog);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dirty_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
dirty = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
zclip_hook(const struct bu_structparse *sdp,
|
||||
const char *name,
|
||||
void *base,
|
||||
const char *value)
|
||||
{
|
||||
fastf_t bounds[6] = { GED_MIN, GED_MAX, GED_MIN, GED_MAX, GED_MIN, GED_MAX };
|
||||
|
||||
dmp->dm_zclip = ((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars.zclipping_on;
|
||||
view_state->vs_gvp->gv_zclip = dmp->dm_zclip;
|
||||
dirty_hook(sdp, name, base, value);
|
||||
|
||||
if (dmp->dm_zclip) {
|
||||
bounds[4] = -1.0;
|
||||
bounds[5] = 1.0;
|
||||
}
|
||||
|
||||
DM_SET_WIN_BOUNDS(dmp, bounds);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
debug_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
DM_DEBUG(dmp, ((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars.debug);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
bound_hook(const struct bu_structparse *sdp,
|
||||
const char *name,
|
||||
void *base,
|
||||
const char *value)
|
||||
{
|
||||
dmp->dm_bound =
|
||||
((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars.bound;
|
||||
dirty_hook(sdp, name, base, value);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
boundFlag_hook(const struct bu_structparse *sdp,
|
||||
const char *name,
|
||||
void *base,
|
||||
const char *value)
|
||||
{
|
||||
dmp->dm_boundFlag =
|
||||
((struct rtgl_vars *)dmp->dm_vars.priv_vars)->mvars.boundFlag;
|
||||
dirty_hook(sdp, name, base, value);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,185 +0,0 @@
|
||||
/* D M - T K . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2004-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program 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 program 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 mged/dm-tk.c
|
||||
*
|
||||
* Routines specific to MGED's use of LIBDM's Tk display manager.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef HAVE_TK
|
||||
# include "tk.h"
|
||||
#endif
|
||||
|
||||
#include "bu.h"
|
||||
#include "vmath.h"
|
||||
#include "mater.h"
|
||||
#include "raytrace.h"
|
||||
#include "dm/dm_xvars.h"
|
||||
#include "dm/dm-tk.h"
|
||||
#include "fbio.h"
|
||||
|
||||
#include "./mged.h"
|
||||
#include "./sedit.h"
|
||||
#include "./mged_dm.h"
|
||||
|
||||
extern int _tk_open_existing(); /* XXX TJM will be defined in libfb/if_tk.c */
|
||||
extern void dm_var_init(struct dm_list *initial_dm_list); /* defined in attach.c */
|
||||
|
||||
static int tk_dm(int argc, const char *argv[]);
|
||||
|
||||
/* local sp_hook functions */
|
||||
static void dirty_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void zclip_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
|
||||
static Tk_GenericProc tk_doevent;
|
||||
|
||||
struct bu_structparse tk_vparse[] = {
|
||||
{"%g", 1, "bound", DM_O(dm_bound), dirty_hook, NULL, NULL},
|
||||
{"%d", 1, "useBound", DM_O(dm_boundFlag), dirty_hook, NULL, NULL},
|
||||
{"%d", 1, "zclip", DM_O(dm_zclip), zclip_hook, NULL, NULL},
|
||||
{"%d", 1, "debug", DM_O(dm_debugLevel), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL},
|
||||
{"", 0, NULL, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
tk_dm_init(struct dm_list *o_dm_list,
|
||||
int argc,
|
||||
const char *argv[])
|
||||
{
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
dm_var_init(o_dm_list);
|
||||
|
||||
/* register application provided routines */
|
||||
cmd_hook = tk_dm;
|
||||
|
||||
Tk_DeleteGenericHandler(doEvent, (ClientData)NULL);
|
||||
dmp = dm_open(INTERP, DM_TYPE_TK, argc-1, argv);
|
||||
if (dmp == DM_NULL)
|
||||
return TCL_ERROR;
|
||||
|
||||
/* keep display manager in sync */
|
||||
dmp->dm_perspective = mged_variables->mv_perspective_mode;
|
||||
|
||||
eventHandler = tk_doevent;
|
||||
Tk_CreateGenericHandler(doEvent, (ClientData)NULL);
|
||||
(void)DM_CONFIGURE_WIN(dmp, 0);
|
||||
|
||||
bu_vls_printf(&vls, "mged_bind_dm %s", bu_vls_addr(&dmp->dm_pathName));
|
||||
Tcl_Eval(INTERP, bu_vls_addr(&vls));
|
||||
bu_vls_free(&vls);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tk_fb_open(void)
|
||||
{
|
||||
fbp = (fb *)calloc(sizeof(fb), 1);
|
||||
if (fbp == FB_NULL) {
|
||||
Tcl_AppendResult(INTERP, "tk_dm_init: failed to allocate framebuffer memory\n",
|
||||
(char *)NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This routine is being called from doEvent() to handle Expose events.
|
||||
*/
|
||||
static int
|
||||
tk_doevent(ClientData UNUSED(clientData), XEvent *eventPtr)
|
||||
{
|
||||
if (eventPtr->type == Expose && eventPtr->xexpose.count == 0) {
|
||||
dirty = 1;
|
||||
|
||||
/* no further processing of this event */
|
||||
return TCL_RETURN;
|
||||
}
|
||||
|
||||
/* allow further processing of this event */
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
tk_dm(int argc, const char *argv[])
|
||||
{
|
||||
if (BU_STR_EQUAL(argv[0], "set")) {
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
if (argc < 2) {
|
||||
/* Bare set command, print out current settings */
|
||||
bu_vls_struct_print2(&vls, "dm_Tk internal variables", tk_vparse, (const char *)dmp);
|
||||
} else if (argc == 2) {
|
||||
bu_vls_struct_item_named(&vls, tk_vparse, argv[1], (const char *)dmp, COMMA);
|
||||
} else {
|
||||
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
bu_vls_printf(&tmp_vls, "%s=\"", argv[1]);
|
||||
bu_vls_from_argv(&tmp_vls, argc-2, (const char **)argv+2);
|
||||
bu_vls_putc(&tmp_vls, '\"');
|
||||
bu_struct_parse(&tmp_vls, tk_vparse, (char *)dmp);
|
||||
bu_vls_free(&tmp_vls);
|
||||
}
|
||||
|
||||
Tcl_AppendResult(INTERP, bu_vls_addr(&vls), (char *)NULL);
|
||||
bu_vls_free(&vls);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
return common_dm(argc, argv);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dirty_hook(void)
|
||||
{
|
||||
dirty = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
zclip_hook(const struct bu_structparse *sdp,
|
||||
const char *name,
|
||||
void *base,
|
||||
const char *value)
|
||||
{
|
||||
view_state->vs_gvp->gv_zclip = dmp->dm_zclip;
|
||||
dirty_hook(sdp, name, base, value);
|
||||
}
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,375 +0,0 @@
|
||||
/* D M - W G L . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2004-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program 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 program 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 mged/dm-wgl.c
|
||||
*
|
||||
* Routines specific to MGED's use of LIBDM's OpenGl display manager.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bio.h"
|
||||
|
||||
#ifdef HAVE_GL_GLX_H
|
||||
# include <GL/glx.h>
|
||||
#endif
|
||||
#ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
#ifdef HAVE_GL_DEVICE_H
|
||||
# include <gl/device.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TK
|
||||
# include "tk.h"
|
||||
#endif
|
||||
|
||||
#include "bu.h"
|
||||
#include "vmath.h"
|
||||
#include "mater.h"
|
||||
#include "ged.h"
|
||||
#include "dm/dm_xvars.h"
|
||||
#include "dm/dm-wgl.h"
|
||||
|
||||
#include "./mged.h"
|
||||
#include "./sedit.h"
|
||||
#include "./mged_dm.h"
|
||||
|
||||
|
||||
extern void dm_var_init(); /* defined in attach.c */
|
||||
|
||||
/* external sp_hook functions */
|
||||
extern void cs_set_bg(const struct bu_structparse *, const char *, void *, const char *); /* defined in color_scheme.c */
|
||||
|
||||
static int Wgl_dm();
|
||||
static int Wgl_doevent();
|
||||
|
||||
/* local sp_hook functions */
|
||||
static void Wgl_colorchange(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void boundFlag_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void bound_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void debug_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void logfile_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void dirty_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void do_fogHint(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void establish_lighting(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void establish_transparency(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void establish_zbuffer(const struct bu_structparse *, const char *, void *, const char *);
|
||||
static void zclip_hook(const struct bu_structparse *, const char *, void *, const char *);
|
||||
|
||||
struct bu_structparse Wgl_vparse[] = {
|
||||
{"%d", 1, "depthcue", Wgl_MV_O(cueing_on), Wgl_colorchange },
|
||||
{"%d", 1, "zclip", Wgl_MV_O(zclipping_on), zclip_hook },
|
||||
{"%d", 1, "zbuffer", Wgl_MV_O(zbuffer_on), establish_zbuffer },
|
||||
{"%d", 1, "lighting", Wgl_MV_O(lighting_on), establish_lighting },
|
||||
{"%d", 1, "transparency", Wgl_MV_O(transparency_on), establish_transparency },
|
||||
{"%d", 1, "fastfog", Wgl_MV_O(fastfog), do_fogHint },
|
||||
{"%g", 1, "density", Wgl_MV_O(fogdensity), dirty_hook },
|
||||
{"%d", 1, "has_zbuf", Wgl_MV_O(zbuf), BU_STRUCTPARSE_FUNC_NULL },
|
||||
{"%d", 1, "has_rgb", Wgl_MV_O(rgb), BU_STRUCTPARSE_FUNC_NULL },
|
||||
{"%d", 1, "has_doublebuffer", Wgl_MV_O(doublebuffer), BU_STRUCTPARSE_FUNC_NULL },
|
||||
{"%d", 1, "depth", Wgl_MV_O(depth), BU_STRUCTPARSE_FUNC_NULL },
|
||||
{"%d", 1, "debug", Wgl_MV_O(debug), debug_hook },
|
||||
{"%V", 1, "log", Wgl_MV_O(log), logfile_hook, NULL, NULL },
|
||||
{"%g", 1, "bound", Wgl_MV_O(bound), bound_hook },
|
||||
{"%d", 1, "useBound", Wgl_MV_O(boundFlag), boundFlag_hook },
|
||||
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL }
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
Wgl_dm_init(struct dm_list *o_dm_list,
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
dm_var_init(o_dm_list);
|
||||
|
||||
/* register application provided routines */
|
||||
cmd_hook = Wgl_dm;
|
||||
|
||||
Tk_DeleteGenericHandler(doEvent, (ClientData)NULL);
|
||||
|
||||
if ((dmp = dm_open(INTERP, DM_TYPE_WGL, argc-1, argv)) == DM_NULL)
|
||||
return TCL_ERROR;
|
||||
|
||||
/*XXXX this eventually needs to move into Wgl's private structure */
|
||||
dmp->dm_vp = &view_state->vs_gvp->gv_scale;
|
||||
dmp->dm_perspective = mged_variables->mv_perspective_mode;
|
||||
|
||||
eventHandler = Wgl_doevent;
|
||||
Tk_CreateGenericHandler(doEvent, (ClientData)NULL);
|
||||
(void)DM_CONFIGURE_WIN(dmp, 0);
|
||||
|
||||
bu_vls_printf(&vls, "mged_bind_dm %s", bu_vls_addr(&dmp->dm_pathName));
|
||||
Tcl_Eval(INTERP, bu_vls_addr(&vls));
|
||||
bu_vls_free(&vls);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Wgl_fb_open()
|
||||
{
|
||||
char *wgl_name = "/dev/wgl";
|
||||
|
||||
if ((fbp = (fb *)calloc(sizeof(fb), 1)) == FB_NULL) {
|
||||
Tcl_AppendResult(INTERP, "Wgl_fb_open: failed to allocate framebuffer memory\n",
|
||||
(char *)NULL);
|
||||
return;
|
||||
}
|
||||
fb_set_interface(fbp, "wgl");
|
||||
fb_set_name(fbp, wgl_name);
|
||||
/* Mark OK by filling in magic number */
|
||||
fb_set_magic(fbp, FB_MAGIC);
|
||||
|
||||
_wgl_open_existing(fbp,
|
||||
((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
|
||||
((struct dm_xvars *)dmp->dm_vars.pub_vars)->win,
|
||||
((struct dm_xvars *)dmp->dm_vars.pub_vars)->cmap,
|
||||
((struct dm_xvars *)dmp->dm_vars.pub_vars)->vip,
|
||||
((struct dm_xvars *)dmp->dm_vars.pub_vars)->hdc,
|
||||
dmp->dm_width, dmp->dm_height,
|
||||
((struct wgl_vars *)dmp->dm_vars.priv_vars)->glxc,
|
||||
((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars.doublebuffer, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This routine is being called from doEvent() to handle Expose events.
|
||||
*/
|
||||
static int
|
||||
Wgl_doevent(ClientData clientData,
|
||||
XEvent *eventPtr)
|
||||
{
|
||||
if (!wglMakeCurrent(((struct dm_xvars *)dmp->dm_vars.pub_vars)->hdc,
|
||||
((struct wgl_vars *)dmp->dm_vars.priv_vars)->glxc))
|
||||
return TCL_OK;
|
||||
|
||||
if (eventPtr->type == Expose && eventPtr->xexpose.count == 0) {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
dirty = 1;
|
||||
|
||||
/* no further processing of this event */
|
||||
return TCL_RETURN;
|
||||
}
|
||||
|
||||
/* allow further processing of this event */
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Implement display-manager specific commands, from MGED "dm" command.
|
||||
*/
|
||||
static int
|
||||
Wgl_dm(int argc,
|
||||
const char *argv[])
|
||||
{
|
||||
if (BU_STR_EQUAL(argv[0], "set")) {
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
if (argc < 2) {
|
||||
/* Bare set command, print out current settings */
|
||||
bu_vls_struct_print2(&vls,
|
||||
"dm_wgl internal variables",
|
||||
Wgl_vparse,
|
||||
(const char *)&((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars);
|
||||
} else if (argc == 2) {
|
||||
bu_vls_struct_item_named(&vls,
|
||||
Wgl_vparse,
|
||||
argv[1],
|
||||
(const char *)&((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars,
|
||||
COMMA);
|
||||
} else {
|
||||
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
bu_vls_printf(&tmp_vls, "%s=\"", argv[1]);
|
||||
bu_vls_from_argv(&tmp_vls, argc-2, (const char **)argv+2);
|
||||
bu_vls_putc(&tmp_vls, '\"');
|
||||
bu_struct_parse(&tmp_vls,
|
||||
Wgl_vparse,
|
||||
(char *)&((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars);
|
||||
bu_vls_free(&tmp_vls);
|
||||
}
|
||||
|
||||
Tcl_AppendResult(INTERP, bu_vls_addr(&vls), (char *)NULL);
|
||||
bu_vls_free(&vls);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
return common_dm(argc, argv);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Wgl_colorchange(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
if (((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars.cueing_on) {
|
||||
glEnable(GL_FOG);
|
||||
} else {
|
||||
glDisable(GL_FOG);
|
||||
}
|
||||
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
establish_zbuffer(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
(void)DM_MAKE_CURRENT(dmp);
|
||||
(void)DM_SET_ZBUFFER(dmp, ((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars.zbuffer_on);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
establish_lighting(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
(void)DM_MAKE_CURRENT(dmp);
|
||||
(void)DM_SET_LIGHT(dmp, ((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars.lighting_on);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
establish_transparency(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
(void)DM_MAKE_CURRENT(dmp);
|
||||
(void)DM_SET_TRANSPARENCY(dmp, ((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars.transparency_on);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
do_fogHint(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
dm_fogHint(dmp, ((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars.fastfog);
|
||||
view_state->vs_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dirty_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
dirty = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
zclip_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
fastf_t bounds[6] = { GED_MIN, GED_MAX, GED_MIN, GED_MAX, GED_MIN, GED_MAX };
|
||||
|
||||
dmp->dm_zclip = ((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars.zclipping_on;
|
||||
view_state->vs_gvp->gv_zclip = dmp->dm_zclip;
|
||||
dirty_hook(NULL, NULL, NULL, NULL);
|
||||
|
||||
if (dmp->dm_zclip) {
|
||||
bounds[4] = -1.0;
|
||||
bounds[5] = 1.0;
|
||||
}
|
||||
|
||||
(void)DM_MAKE_CURRENT(dmp);
|
||||
(void)DM_SET_WIN_BOUNDS(dmp, bounds);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
debug_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
DM_DEBUG(dmp, ((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars.debug);
|
||||
}
|
||||
|
||||
static void
|
||||
logfile_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
/*DM_LOGFILE(dmp, bu_vls_addr(&(((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars.log)));*/
|
||||
}
|
||||
|
||||
static void
|
||||
bound_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
dmp->dm_bound =
|
||||
((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars.bound;
|
||||
dirty_hook(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
boundFlag_hook(const struct bu_structparse *UNUSED(sdp),
|
||||
const char *UNUSED(name),
|
||||
void *UNUSED(base),
|
||||
const char *UNUSED(value))
|
||||
{
|
||||
dmp->dm_boundFlag =
|
||||
((struct wgl_vars *)dmp->dm_vars.priv_vars)->mvars.boundFlag;
|
||||
dirty_hook(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
+1
-1
@@ -151,7 +151,7 @@ doEvent(ClientData clientData, XEvent *eventPtr)
|
||||
dirty = 1;
|
||||
|
||||
if (fbp)
|
||||
(void)fb_configure_window(fbp, conf->width, conf->height);
|
||||
fb_configureWindow(fbp, conf->width, conf->height);
|
||||
|
||||
/* no further processing of this event */
|
||||
status = TCL_RETURN;
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ void (*cur_sigint)(); /* Current SIGINT status */
|
||||
int interactive = 1; /* >0 means interactive */
|
||||
int cbreak_mode = 0; /* >0 means in cbreak_mode */
|
||||
|
||||
#if defined(DM_X) || defined(DM_TK) || defined(DM_OGL) || defined(DM_WGL)
|
||||
#if defined(DM_OSG)
|
||||
# if defined(HAVE_TK)
|
||||
int classic_mged=0;
|
||||
# else
|
||||
|
||||
@@ -112,6 +112,28 @@ SetTargetFolder(zlib-static "Third Party Libraries")
|
||||
SetTargetFolder(example "Third Party Executables")
|
||||
SetTargetFolder(minigzip "Third Party Executables")
|
||||
|
||||
# FreeType Libraries
|
||||
set(freetype_ALIASES ENABLE_FREETYPE)
|
||||
set(freetype_DESCRIPTION "
|
||||
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.
|
||||
")
|
||||
THIRD_PARTY(freetype FREETYPE ft freetype_DESCRIPTION
|
||||
ALIASES ${freetype_ALIASES} FIND_NAME Freetype)
|
||||
if(BRLCAD_FREETYPE_BUILD)
|
||||
set(FREETYPE_LIBRARY freetype CACHE STRING "libfreetype" FORCE)
|
||||
set(FREETYPE_INCLUDE_DIR
|
||||
${CMAKE_CURRENT_BINARY_DIR}/freetype/include
|
||||
${BRLCAD_SOURCE_DIR}/src/other/freetype/include
|
||||
CACHE STRING "FreeType include dirs" FORCE
|
||||
)
|
||||
set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR}" CACHE STRING "Directory containing FreeType headers." FORCE)
|
||||
set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}" CACHE STRING "FreeType Libraries")
|
||||
endif(BRLCAD_FREETYPE_BUILD)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# The incrtTcl subdirectory isn't directly referenced, but its
|
||||
# subdirectories are used - mark incrTcl as ignored
|
||||
@@ -753,6 +775,42 @@ SetTargetFolder(libvds-static "Third Party Libraries")
|
||||
SetTargetFolder(stdvds "Third Party Libraries")
|
||||
SetTargetFolder(stdvds-static "Third Party Libraries")
|
||||
|
||||
|
||||
# OpenSceneGraph Libraries
|
||||
set(openscenegraph_ALIASES ENABLE_OPENSCENEGRAPH)
|
||||
set(openscenegraph_DESCRIPTION "
|
||||
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.
|
||||
")
|
||||
THIRD_PARTY(openscenegraph OSG osg openscenegraph_DESCRIPTION
|
||||
ALIASES ${openscenegraph_ALIASES} FIND_NAME OpenSceneGraph FIND_COMPONENTS
|
||||
osgText osgViewer FLAGS NOSYS)
|
||||
if(BRLCAD_OSG_BUILD)
|
||||
set(OSG_LIBRARY osg CACHE STRING "libosg" FORCE)
|
||||
set(OSGUTIL_LIBRARY osgUtil CACHE STRING "osgutil" FORCE)
|
||||
set(OSGDB_LIBRARY osgDB CACHE STRING "osgdb" FORCE)
|
||||
set(OSGGA_LIBRARY osgGA CACHE STRING "osgGA" FORCE)
|
||||
set(OSGTEXT_LIBRARY osgText CACHE STRING "osg Text library" FORCE)
|
||||
set(OSGVIEWER_LIBRARY osgViewer CACHE STRING "osg Viewer library" FORCE)
|
||||
set(OPENTHREADS_LIBRARY OpenThreads CACHE STRING "OpenThreads library" FORCE)
|
||||
set(OPENTHREADS_INCLUDE_DIR
|
||||
${CMAKE_CURRENT_BINARY_DIR}/openscenegraph/src/OpenThreads/include
|
||||
${BRLCAD_SOURCE_DIR}/src/other/openscenegraph/src/OpenThreads/include
|
||||
CACHE STRING "OpenThreads include dirs" FORCE
|
||||
)
|
||||
set(OSG_INCLUDE_DIR
|
||||
${CMAKE_CURRENT_BINARY_DIR}/openscenegraph/include
|
||||
${BRLCAD_SOURCE_DIR}/src/other/openscenegraph/include
|
||||
CACHE STRING "OpenSceneGraph include dirs" FORCE
|
||||
)
|
||||
set(OSG_INCLUDE_DIR "${OSG_INCLUDE_DIR}" CACHE STRING "Directory containing OpenSceneGraph headers." FORCE)
|
||||
set(OSG_LIBRARIES "${OSG_LIBRARY};${OSGUTIL_LIBRARY};${OSGDB_LIBRARY};${OSGGA_LIBRARY};${OSGTEXT_LIBRARY};${OSGVIEWER_LIBRARY};${OPENTHREADS_LIBRARY}" CACHE STRING "OpenSceneGraph Libraries")
|
||||
else(BRLCAD_OSG_BUILD)
|
||||
find_package(OpenThreads)
|
||||
endif(BRLCAD_OSG_BUILD)
|
||||
|
||||
# gdiam
|
||||
|
||||
set(libgdiam_ALIASES ENABLE_GDIAM)
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
# CMakeLists.txt
|
||||
#
|
||||
# Copyright 2013, 2014 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# Written by John Cary <cary@txcorp.com>
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
#
|
||||
#
|
||||
# Say
|
||||
#
|
||||
# cmake CMakeLists.txt
|
||||
#
|
||||
# to create a Makefile that builds a static version of the library. For a
|
||||
# dynamic library, use
|
||||
#
|
||||
# cmake CMakeLists.txt -DBUILD_SHARED_LIBS:BOOL=true
|
||||
#
|
||||
# instead. Please refer to the cmake manual for further options, in
|
||||
# particular, how to modify compilation and linking parameters.
|
||||
#
|
||||
# Some notes.
|
||||
#
|
||||
# . `cmake' will overwrite FreeType's original (top-level) `Makefile' file.
|
||||
#
|
||||
# . You can use `cmake' directly on a freshly cloned FreeType git
|
||||
# repository.
|
||||
#
|
||||
# . `CMakeLists.txt' is provided as-is since it is not used by the
|
||||
# developer team.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
project(freetype)
|
||||
|
||||
set(VERSION_MAJOR "2")
|
||||
set(VERSION_MINOR "5")
|
||||
set(VERSION_PATCH "3")
|
||||
set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
|
||||
# Compiler definitions for building the library
|
||||
add_definitions(-DFT2_BUILD_LIBRARY)
|
||||
|
||||
# Specify library include directories
|
||||
include_directories("${PROJECT_SOURCE_DIR}/include")
|
||||
|
||||
# Create the configuration file
|
||||
message(STATUS "Creating directory, ${PROJECT_BINARY_DIR}/include.")
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include)
|
||||
|
||||
# For the auto-generated ftconfig.h file
|
||||
include_directories("${PROJECT_BINARY_DIR}/include")
|
||||
message(STATUS "Creating ${PROJECT_BINARY_DIR}/include/ftconfig.h.")
|
||||
execute_process(
|
||||
COMMAND sed -e "s/FT_CONFIG_OPTIONS_H/<ftoption.h>/" -e "s/FT_CONFIG_STANDARD_LIBRARY_H/<ftstdlib.h>/" -e "s?/undef ?#undef ?"
|
||||
INPUT_FILE ${PROJECT_SOURCE_DIR}/builds/unix/ftconfig.in
|
||||
OUTPUT_FILE ${PROJECT_BINARY_DIR}/include/ftconfig.h
|
||||
)
|
||||
|
||||
set(BASE_SRCS
|
||||
src/autofit/autofit.c
|
||||
src/base/ftadvanc.c
|
||||
src/base/ftbbox.c
|
||||
src/base/ftbitmap.c
|
||||
src/base/ftcalc.c
|
||||
src/base/ftcid.c
|
||||
src/base/ftdbgmem.c
|
||||
src/base/ftdebug.c
|
||||
src/base/ftfstype.c
|
||||
src/base/ftgasp.c
|
||||
src/base/ftgloadr.c
|
||||
src/base/ftglyph.c
|
||||
src/base/ftgxval.c
|
||||
src/base/ftinit.c
|
||||
src/base/ftlcdfil.c
|
||||
src/base/ftmm.c
|
||||
src/base/ftobjs.c
|
||||
src/base/ftotval.c
|
||||
src/base/ftoutln.c
|
||||
src/base/ftpatent.c
|
||||
src/base/ftpfr.c
|
||||
src/base/ftrfork.c
|
||||
src/base/ftsnames.c
|
||||
src/base/ftstream.c
|
||||
src/base/ftstroke.c
|
||||
src/base/ftsynth.c
|
||||
src/base/ftsystem.c
|
||||
src/base/fttrigon.c
|
||||
src/base/fttype1.c
|
||||
src/base/ftutil.c
|
||||
src/base/ftwinfnt.c
|
||||
src/base/ftxf86.c
|
||||
src/bdf/bdf.c
|
||||
src/bzip2/ftbzip2.c
|
||||
src/cache/ftcache.c
|
||||
src/cff/cff.c
|
||||
src/cid/type1cid.c
|
||||
src/gzip/ftgzip.c
|
||||
src/lzw/ftlzw.c
|
||||
src/pcf/pcf.c
|
||||
src/pfr/pfr.c
|
||||
src/psaux/psaux.c
|
||||
src/pshinter/pshinter.c
|
||||
src/psnames/psmodule.c
|
||||
src/raster/raster.c
|
||||
src/sfnt/sfnt.c
|
||||
src/smooth/smooth.c
|
||||
src/truetype/truetype.c
|
||||
src/type1/type1.c
|
||||
src/type42/type42.c
|
||||
src/winfonts/winfnt.c
|
||||
)
|
||||
|
||||
include_directories("src/truetype")
|
||||
include_directories("src/sfnt")
|
||||
include_directories("src/autofit")
|
||||
include_directories("src/smooth")
|
||||
include_directories("src/raster")
|
||||
include_directories("src/psaux")
|
||||
include_directories("src/psnames")
|
||||
|
||||
add_library(freetype ${BASE_SRCS})
|
||||
|
||||
# Installations
|
||||
# Note the trailing slash in the argument to the `DIRECTORY' directive
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
|
||||
DESTINATION include/freetype2
|
||||
PATTERN "internal" EXCLUDE
|
||||
)
|
||||
install(TARGETS freetype
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
# Packaging
|
||||
# CPack version numbers for release tarball name.
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}})
|
||||
if (NOT DEFINED CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_NAME}")
|
||||
endif ()
|
||||
if (NOT DEFINED CPACK_SOURCE_PACKAGE_FILE_NAME)
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME
|
||||
"${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}-r${PROJECT_REV}"
|
||||
CACHE INTERNAL "tarball basename"
|
||||
)
|
||||
endif ()
|
||||
set(CPACK_SOURCE_GENERATOR TGZ)
|
||||
set(CPACK_SOURCE_IGNORE_FILES
|
||||
"/CVS/;/.svn/;.swp$;.#;/#;/build/;/serial/;/ser/;/parallel/;/par/;~;/preconfig.out;/autom4te.cache/;/.config")
|
||||
set(CPACK_GENERATOR TGZ)
|
||||
include(CPack)
|
||||
|
||||
# add make dist target
|
||||
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
|
||||
|
||||
# eof
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,204 @@
|
||||
# FreeType 2 top Jamfile.
|
||||
#
|
||||
# Copyright 2001-2014 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# The HDRMACRO is already defined in FTJam and is used to add
|
||||
# the content of certain macros to the list of included header
|
||||
# files.
|
||||
#
|
||||
# We can compile FreeType 2 with classic Jam however thanks to
|
||||
# the following code
|
||||
#
|
||||
if ! $(JAM_TOOLSET)
|
||||
{
|
||||
rule HDRMACRO
|
||||
{
|
||||
# nothing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# We need to invoke a SubDir rule if the FT2 source directory top is not the
|
||||
# current directory. This allows us to build FreeType 2 as part of a larger
|
||||
# project easily.
|
||||
#
|
||||
if $(FT2_TOP) != $(DOT)
|
||||
{
|
||||
SubDir FT2_TOP ;
|
||||
}
|
||||
|
||||
|
||||
# The following macros define the include directory, the source directory,
|
||||
# and the final library name (without library extensions). They can be
|
||||
# replaced by other definitions when the library is compiled as part of
|
||||
# a larger project.
|
||||
#
|
||||
|
||||
# Name of FreeType include directory during compilation.
|
||||
# This is relative to FT2_TOP.
|
||||
#
|
||||
FT2_INCLUDE_DIR ?= include ;
|
||||
|
||||
# Name of FreeType source directory during compilation.
|
||||
# This is relative to FT2_TOP.
|
||||
#
|
||||
FT2_SRC_DIR ?= src ;
|
||||
|
||||
# Name of final library, without extension.
|
||||
#
|
||||
FT2_LIB ?= $(LIBPREFIX)freetype ;
|
||||
|
||||
|
||||
# Define FT2_BUILD_INCLUDE to point to your build-specific directory.
|
||||
# This is prepended to FT2_INCLUDE_DIR. It can be used to specify
|
||||
# the location of a custom <ft2build.h> which will point to custom
|
||||
# versions of `ftmodule.h' and `ftoption.h', for example.
|
||||
#
|
||||
FT2_BUILD_INCLUDE ?= ;
|
||||
|
||||
# The list of modules to compile on any given build of the library.
|
||||
# By default, this will contain _all_ modules defined in FT2_SRC_DIR.
|
||||
#
|
||||
# IMPORTANT: You'll need to change the content of `ftmodule.h' as well
|
||||
# if you modify this list or provide your own.
|
||||
#
|
||||
FT2_COMPONENTS ?= autofit # auto-fitter
|
||||
base # base component (public APIs)
|
||||
bdf # BDF font driver
|
||||
cache # cache sub-system
|
||||
cff # CFF/CEF font driver
|
||||
cid # PostScript CID-keyed font driver
|
||||
pcf # PCF font driver
|
||||
bzip2 # support for bzip2-compressed PCF font
|
||||
gzip # support for gzip-compressed PCF font
|
||||
lzw # support for LZW-compressed PCF font
|
||||
pfr # PFR/TrueDoc font driver
|
||||
psaux # common PostScript routines module
|
||||
pshinter # PostScript hinter module
|
||||
psnames # PostScript names handling
|
||||
raster # monochrome rasterizer
|
||||
smooth # anti-aliased rasterizer
|
||||
sfnt # SFNT-based format support routines
|
||||
truetype # TrueType font driver
|
||||
type1 # PostScript Type 1 font driver
|
||||
type42 # PostScript Type 42 (embedded TrueType) driver
|
||||
winfonts # Windows FON/FNT font driver
|
||||
;
|
||||
|
||||
|
||||
# Don't touch.
|
||||
#
|
||||
FT2_INCLUDE = $(FT2_BUILD_INCLUDE)
|
||||
[ FT2_SubDir $(FT2_INCLUDE_DIR) ] ;
|
||||
|
||||
FT2_SRC = [ FT2_SubDir $(FT2_SRC_DIR) ] ;
|
||||
|
||||
# Location of API Reference Documentation
|
||||
#
|
||||
if $(DOC_DIR)
|
||||
{
|
||||
DOC_DIR = $(DOCDIR:T) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
DOC_DIR = docs/reference ;
|
||||
}
|
||||
|
||||
|
||||
# Only used by FreeType developers.
|
||||
#
|
||||
if $(DEBUG_HINTER)
|
||||
{
|
||||
CCFLAGS += -DDEBUG_HINTER ;
|
||||
}
|
||||
|
||||
|
||||
# We need `freetype2/include' in the current include path in order to
|
||||
# compile any part of FreeType 2.
|
||||
#: updating documentation for upcoming release
|
||||
|
||||
HDRS += $(FT2_INCLUDE) ;
|
||||
|
||||
|
||||
# We need to #define FT2_BUILD_LIBRARY so that our sources find the
|
||||
# internal headers
|
||||
#
|
||||
DEFINES += FT2_BUILD_LIBRARY ;
|
||||
|
||||
# Uncomment the following line if you want to build individual source files
|
||||
# for each FreeType 2 module. This is only useful during development, and
|
||||
# is better defined as an environment variable anyway!
|
||||
#
|
||||
# FT2_MULTI = true ;
|
||||
|
||||
|
||||
# The file <config/ftheader.h> is used to define macros that are later used
|
||||
# in #include statements. It needs to be parsed in order to record these
|
||||
# definitions.
|
||||
#
|
||||
HDRMACRO [ FT2_SubDir include freetype config ftheader.h ] ;
|
||||
HDRMACRO [ FT2_SubDir include freetype internal internal.h ] ;
|
||||
|
||||
|
||||
# Now include the Jamfile in `freetype2/src', used to drive the compilation
|
||||
# of each FreeType 2 component and/or module.
|
||||
#
|
||||
SubInclude FT2_TOP $(FT2_SRC_DIR) ;
|
||||
|
||||
# Handle the generation of the `ftexport.sym' file which contain the list
|
||||
# of exported symbols. This can be used on Unix by libtool.
|
||||
#
|
||||
SubInclude FT2_TOP $(FT2_SRC_DIR) tools ;
|
||||
|
||||
rule GenExportSymbols
|
||||
{
|
||||
local apinames = apinames$(SUFEXE) ;
|
||||
local headers = [ Glob $(2) : *.h ] ;
|
||||
|
||||
LOCATE on $(1) = $(ALL_LOCATE_TARGET) ;
|
||||
|
||||
APINAMES on $(1) = apinames$(SUFEXE) ;
|
||||
|
||||
Depends $(1) : $(apinames) $(headers) ;
|
||||
GenExportSymbols1 $(1) : $(headers) ;
|
||||
Clean clean : $(1) ;
|
||||
}
|
||||
|
||||
actions GenExportSymbols1 bind APINAMES
|
||||
{
|
||||
$(APINAMES) $(2) > $(1)
|
||||
}
|
||||
|
||||
GenExportSymbols ftexport.sym : include include/cache ;
|
||||
|
||||
# Test files (hinter debugging). Only used by FreeType developers.
|
||||
#
|
||||
if $(DEBUG_HINTER)
|
||||
{
|
||||
SubInclude FT2_TOP tests ;
|
||||
}
|
||||
|
||||
rule RefDoc
|
||||
{
|
||||
Depends $1 : all ;
|
||||
NotFile $1 ;
|
||||
Always $1 ;
|
||||
}
|
||||
|
||||
actions RefDoc
|
||||
{
|
||||
python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.5.3 --output=$(DOC_DIR) $(FT2_INCLUDE)/*.h $(FT2_INCLUDE)/config/*.h
|
||||
}
|
||||
|
||||
RefDoc refdoc ;
|
||||
|
||||
|
||||
# end of top Jamfile
|
||||
@@ -0,0 +1,71 @@
|
||||
# FreeType 2 JamRules.
|
||||
#
|
||||
# Copyright 2001, 2002, 2003 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# This file contains the Jam rules needed to build the FreeType 2 library.
|
||||
# It is shared by all Jamfiles and is included only once in the build
|
||||
# process.
|
||||
#
|
||||
|
||||
|
||||
# Call SubDirHdrs on a list of directories.
|
||||
#
|
||||
rule AddSubDirHdrs
|
||||
{
|
||||
local x ;
|
||||
|
||||
for x in $(<)
|
||||
{
|
||||
SubDirHdrs $(x) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Determine prefix of library file. We must use "libxxxxx" on Unix systems,
|
||||
# while all other simply use the real name.
|
||||
#
|
||||
if $(UNIX)
|
||||
{
|
||||
LIBPREFIX ?= lib ;
|
||||
}
|
||||
else
|
||||
{
|
||||
LIBPREFIX ?= "" ;
|
||||
}
|
||||
|
||||
# FT2_TOP contains the location of the FreeType source directory. You can
|
||||
# set it to a specific value if you want to compile the library as part of a
|
||||
# larger project.
|
||||
#
|
||||
FT2_TOP ?= $(DOT) ;
|
||||
|
||||
# Define a new rule used to declare a sub directory of the Nirvana source
|
||||
# tree.
|
||||
#
|
||||
rule FT2_SubDir
|
||||
{
|
||||
if $(FT2_TOP) = $(DOT)
|
||||
{
|
||||
return [ FDirName $(<) ] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return [ FDirName $(FT2_TOP) $(<) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
# We also set ALL_LOCATE_TARGET in order to place all object and library
|
||||
# files in "objs".
|
||||
#
|
||||
ALL_LOCATE_TARGET ?= [ FT2_SubDir objs ] ;
|
||||
|
||||
|
||||
# end of Jamrules
|
||||
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# FreeType 2 build system -- top-level Makefile
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000, 2002, 2006 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Project names
|
||||
#
|
||||
PROJECT := freetype
|
||||
PROJECT_TITLE := FreeType
|
||||
|
||||
# The variable TOP_DIR holds the path to the topmost directory in the project
|
||||
# engine source hierarchy. If it is not defined, default it to `.'.
|
||||
#
|
||||
TOP_DIR ?= .
|
||||
|
||||
# The variable OBJ_DIR gives the location where object files and the
|
||||
# FreeType library are built.
|
||||
#
|
||||
OBJ_DIR ?= $(TOP_DIR)/objs
|
||||
|
||||
|
||||
include $(TOP_DIR)/builds/toplevel.mk
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,83 @@
|
||||
FreeType 2.5.3
|
||||
==============
|
||||
|
||||
Homepage: http://www.freetype.org
|
||||
|
||||
FreeType is a freely available software library to render fonts.
|
||||
|
||||
It is written in C, designed to be small, efficient, highly
|
||||
customizable, and portable while capable of producing high-quality
|
||||
output (glyph images) of most vector and bitmap font formats.
|
||||
|
||||
Please read the docs/CHANGES file, it contains IMPORTANT
|
||||
INFORMATION.
|
||||
|
||||
Read the files `docs/INSTALL*' for installation instructions; see
|
||||
the file `docs/LICENSE.TXT' for the available licenses.
|
||||
|
||||
The FreeType 2 API reference is located in `docs/reference'; use the
|
||||
file `ft2-toc.html' as the top entry point. Additional
|
||||
documentation is available as a separate package from our sites. Go
|
||||
to
|
||||
|
||||
http://download.savannah.gnu.org/releases/freetype/
|
||||
|
||||
and download one of the following files.
|
||||
|
||||
freetype-doc-2.5.3.tar.bz2
|
||||
freetype-doc-2.5.3.tar.gz
|
||||
ftdoc253.zip
|
||||
|
||||
To view the documentation online, go to
|
||||
|
||||
http://www.freetype.org/freetype2/documentation.html
|
||||
|
||||
|
||||
Mailing Lists
|
||||
=============
|
||||
|
||||
The preferred way of communication with the FreeType team is using
|
||||
e-mail lists.
|
||||
|
||||
general use and discussion: freetype@nongnu.org
|
||||
engine internals, porting, etc.: freetype-devel@nongnu.org
|
||||
announcements: freetype-announce@nongnu.org
|
||||
|
||||
The lists are moderated; see
|
||||
|
||||
http://www.freetype.org/contact.html
|
||||
|
||||
how to subscribe.
|
||||
|
||||
|
||||
Bugs
|
||||
====
|
||||
|
||||
Please report bugs by e-mail to `freetype-devel@nongnu.org'. Don't
|
||||
forget to send a detailed explanation of the problem -- there is
|
||||
nothing worse than receiving a terse message that only says `it
|
||||
doesn't work'.
|
||||
|
||||
Alternatively, you may submit a bug report at
|
||||
|
||||
https://savannah.nongnu.org/bugs/?group=freetype
|
||||
|
||||
|
||||
Enjoy!
|
||||
|
||||
|
||||
The FreeType Team
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright 2006-2014 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
this file you indicate that you have read the license and understand
|
||||
and accept it fully.
|
||||
|
||||
|
||||
--- end of README ---
|
||||
@@ -0,0 +1,50 @@
|
||||
The git archive doesn't contain pre-built configuration scripts for
|
||||
UNIXish platforms. To generate them say
|
||||
|
||||
sh autogen.sh
|
||||
|
||||
which in turn depends on the following packages:
|
||||
|
||||
automake (1.10.1)
|
||||
libtool (2.2.4)
|
||||
autoconf (2.62)
|
||||
|
||||
The versions given in parentheses are known to work. Newer versions
|
||||
should work too, of course. Note that autogen.sh also sets up proper
|
||||
file permissions for the `configure' and auxiliary scripts.
|
||||
|
||||
The autogen.sh script now checks the version of above three packages
|
||||
whether they match the numbers above. Otherwise it will complain and
|
||||
suggest either upgrading or using an environment variable to point to
|
||||
a more recent version of the required tool(s).
|
||||
|
||||
Note that `aclocal' is provided by the `automake' package on Linux,
|
||||
and that `libtoolize' is called `glibtoolize' on Darwin (OS X).
|
||||
|
||||
|
||||
For static builds which don't use platform specific optimizations, no
|
||||
configure script is necessary at all; saying
|
||||
|
||||
make setup ansi
|
||||
make
|
||||
|
||||
should work on all platforms which have GNU make (or makepp).
|
||||
|
||||
|
||||
Similarly, a build with `cmake' can be done directly from the git
|
||||
repository.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright 2005-2010, 2013 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
this file you indicate that you have read the license and understand
|
||||
and accept it fully.
|
||||
|
||||
|
||||
--- end of README.git ---
|
||||
Executable
+166
@@ -0,0 +1,166 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright 2005-2010, 2013 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
run ()
|
||||
{
|
||||
echo "running \`$*'"
|
||||
eval $*
|
||||
|
||||
if test $? != 0 ; then
|
||||
echo "error while running \`$*'"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
get_major_version ()
|
||||
{
|
||||
echo $1 | sed -e 's/\([0-9][0-9]*\)\..*/\1/g'
|
||||
}
|
||||
|
||||
get_minor_version ()
|
||||
{
|
||||
echo $1 | sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'
|
||||
}
|
||||
|
||||
get_patch_version ()
|
||||
{
|
||||
# tricky: some version numbers don't include a patch
|
||||
# separated with a point, but something like 1.4-p6
|
||||
patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'`
|
||||
if test "$patch" = "$1"; then
|
||||
patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\-p\([0-9][0-9]*\).*/\1/g'`
|
||||
# if there isn't any patch number, default to 0
|
||||
if test "$patch" = "$1"; then
|
||||
patch=0
|
||||
fi
|
||||
fi
|
||||
echo $patch
|
||||
}
|
||||
|
||||
# $1: version to check
|
||||
# $2: minimum version
|
||||
|
||||
compare_to_minimum_version ()
|
||||
{
|
||||
MAJOR1=`get_major_version $1`
|
||||
MAJOR2=`get_major_version $2`
|
||||
if test $MAJOR1 -lt $MAJOR2; then
|
||||
echo 0
|
||||
return
|
||||
else
|
||||
if test $MAJOR1 -gt $MAJOR2; then
|
||||
echo 1
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
MINOR1=`get_minor_version $1`
|
||||
MINOR2=`get_minor_version $2`
|
||||
if test $MINOR1 -lt $MINOR2; then
|
||||
echo 0
|
||||
return
|
||||
else
|
||||
if test $MINOR1 -gt $MINOR2; then
|
||||
echo 1
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
PATCH1=`get_patch_version $1`
|
||||
PATCH2=`get_patch_version $2`
|
||||
if test $PATCH1 -lt $PATCH2; then
|
||||
echo 0
|
||||
else
|
||||
echo 1
|
||||
fi
|
||||
}
|
||||
|
||||
# check the version of a given tool against a minimum version number
|
||||
#
|
||||
# $1: tool path
|
||||
# $2: tool usual name (e.g. `aclocal')
|
||||
# $3: tool variable (e.g. `ACLOCAL')
|
||||
# $4: minimum version to check against
|
||||
# $5: option field index used to extract the tool version from the
|
||||
# output of --version
|
||||
|
||||
check_tool_version ()
|
||||
{
|
||||
field=$5
|
||||
# assume the output of "[TOOL] --version" is "toolname (GNU toolname foo bar) version"
|
||||
if test "$field"x = x; then
|
||||
field=3 # default to 3 for all GNU autotools, after filtering enclosed string
|
||||
fi
|
||||
version=`$1 --version | head -1 | sed 's/([^)]*)/()/g' | cut -d ' ' -f $field`
|
||||
version_check=`compare_to_minimum_version $version $4`
|
||||
if test "$version_check"x = 0x; then
|
||||
echo "ERROR: Your version of the \`$2' tool is too old."
|
||||
echo " Minimum version $4 is required (yours is version $version)."
|
||||
echo " Please upgrade or use the $3 variable to point to a more recent one."
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
if test ! -f ./builds/unix/configure.raw; then
|
||||
echo "You must be in the same directory as \`autogen.sh'."
|
||||
echo "Bootstrapping doesn't work if srcdir != builddir."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# On MacOS X, the GNU libtool is named `glibtool'.
|
||||
HOSTOS=`uname`
|
||||
if test "$LIBTOOLIZE"x != x; then
|
||||
:
|
||||
elif test "$HOSTOS"x = Darwinx; then
|
||||
LIBTOOLIZE=glibtoolize
|
||||
else
|
||||
LIBTOOLIZE=libtoolize
|
||||
fi
|
||||
|
||||
if test "$ACLOCAL"x = x; then
|
||||
ACLOCAL=aclocal
|
||||
fi
|
||||
|
||||
if test "$AUTOCONF"x = x; then
|
||||
AUTOCONF=autoconf
|
||||
fi
|
||||
|
||||
check_tool_version $ACLOCAL aclocal ACLOCAL 1.10.1
|
||||
check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4
|
||||
check_tool_version $AUTOCONF autoconf AUTOCONF 2.62
|
||||
|
||||
# This sets freetype_major, freetype_minor, and freetype_patch.
|
||||
eval `sed -nf version.sed include/freetype.h`
|
||||
|
||||
# We set freetype-patch to an empty value if it is zero.
|
||||
if test "$freetype_patch" = ".0"; then
|
||||
freetype_patch=
|
||||
fi
|
||||
|
||||
cd builds/unix
|
||||
|
||||
echo "generating \`configure.ac'"
|
||||
sed -e "s;@VERSION@;$freetype_major$freetype_minor$freetype_patch;" \
|
||||
< configure.raw > configure.ac
|
||||
|
||||
run aclocal -I . --force
|
||||
run $LIBTOOLIZE --force --copy --install
|
||||
run autoconf --force
|
||||
|
||||
chmod +x mkinstalldirs
|
||||
chmod +x install-sh
|
||||
|
||||
cd ../..
|
||||
|
||||
chmod +x ./configure
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,109 @@
|
||||
|
||||
README for the builds/amiga subdirectory.
|
||||
|
||||
Copyright 2005, 2013 by
|
||||
Werner Lemberg and Detlef Würkner.
|
||||
|
||||
This file is part of the FreeType project, and may only be used, modified,
|
||||
and distributed under the terms of the FreeType project license,
|
||||
LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
indicate that you have read the license and understand and accept it
|
||||
fully.
|
||||
|
||||
|
||||
The makefile.os4 is for the AmigaOS4 SDK. To use it, type
|
||||
"make -f makefile.os4", it produces a link library libft2_ppc.a.
|
||||
|
||||
The makefile is for ppc-morphos-gcc-2.95.3-bin.tgz (gcc 2.95.3 hosted on
|
||||
68k-Amiga producing MorphOS-PPC-binaries from http://www.morphos.de).
|
||||
To use it, type "make assign", then "make"; it produces a link library
|
||||
libft2_ppc.a.
|
||||
|
||||
The smakefile is a makefile for Amiga SAS/C 6.58 (no longer available,
|
||||
latest sold version was 6.50, updates can be found in Aminet). It is
|
||||
based on the version found in the sourcecode of ttf.library 0.83b for
|
||||
FreeType 1.3.1 from Richard Griffith (ragriffi@sprynet.com,
|
||||
http://ragriffi.home.sprynet.com).
|
||||
|
||||
You will also need the latest include files and amiga.lib from the
|
||||
Amiga web site (http://www.amiga.com/3.9/download/NDK3.9.lha) for
|
||||
AmigaOS 3.9; the generated code should work under AmigaOS 2.04 and up.
|
||||
|
||||
To use it, call "smake assign" and then "smake" from the builds/amiga
|
||||
directory. The results are:
|
||||
|
||||
- A link library "ft2_680x0.lib" (where x depends on the setting of
|
||||
the CPU entry in the smakefile) containing all FreeType2 parts
|
||||
except of the init code, debugging code, and the system interface
|
||||
code.
|
||||
|
||||
- ftsystem.o, an object module containing the standard version of the
|
||||
system interface code which uses fopen() fclose() fread() fseek()
|
||||
ftell() malloc() realloc() and free() from lib:sc.lib (not pure).
|
||||
|
||||
- ftsystempure.o, an object module containing the pure version of the
|
||||
system interface code which uses Open() Close() Read() Seek()
|
||||
ExamineFH() AsmAllocPooled() AsmFreePooled() etc. This version can
|
||||
be used in both normal programs and in Amiga run-time shared system
|
||||
librarys (can be linked with lib:libinit.o, no copying of DATA and
|
||||
BSS hunks for each OpenLibrary() necessary). Source code is in
|
||||
src/base/ftsystem.c.
|
||||
|
||||
- ftdebug.o, an object module containing the standard version of the
|
||||
debugging code which uses vprintf() and exit() (not pure).
|
||||
Debugging can be turned on in FT:include/config/ftoption.h and with
|
||||
FT_SetTraceLevel().
|
||||
|
||||
- ftdebugpure.o, an object module containing the pure version of the
|
||||
debugging code which uses KVPrintf() from lib:debug.lib and no
|
||||
exit(). For debugging of Amiga run-time shared system libraries.
|
||||
Source code is in src/base/ftdebug.c.
|
||||
|
||||
- NO ftinit.o. Because linking with a link library should result in
|
||||
linking only the needed object modules in it, but standard
|
||||
ftsystem.o would force ALL FreeType2 modules to be linked to your
|
||||
program, I decided to use a different scheme: You must #include
|
||||
FT:src/base/ftinit.c in your sourcecode and specify with #define
|
||||
statements which modules you need. See include/config/ftmodule.h.
|
||||
|
||||
|
||||
To use in your own programs:
|
||||
|
||||
- Insert the #define and #include statements from top of
|
||||
include/config/ftmodule.h in your source code and uncomment the
|
||||
#define statements for the FreeType2 modules you need.
|
||||
|
||||
- You can use either PARAMETERS=REGISTER or PARAMETERS=STACK for
|
||||
calling the FreeType2 functions, because the link library and the
|
||||
object files are compiled with PARAMETERS=BOTH.
|
||||
|
||||
- "smake assign" (assign "FT:" to the FreeType2 main directory).
|
||||
|
||||
- Compile your program.
|
||||
|
||||
- Link with either ftsystem.o or ftsystempure.o, if debugging enabled
|
||||
with either ftdebug.o or (ftdebugpure.o and lib:debug.lib), and with
|
||||
ft2_680x0.lib as link library.
|
||||
|
||||
|
||||
To adapt to other compilers:
|
||||
|
||||
- The standard ANSI C maximum length of 31 significant characters in
|
||||
identifiers is not enough for FreeType2. Check if your compiler has
|
||||
a minimum length of 40 significant characters or can be switched to
|
||||
it. "idlen=40" is the option for SAS/C. Setting #define
|
||||
HAVE_LIMIT_ON_IDENTS in an include file may also work (not tested).
|
||||
|
||||
- Make sure that the include directory in builds/amiga is searched
|
||||
before the normal FreeType2 include directory, so you are able to
|
||||
replace problematic include files with your own version (same may be
|
||||
useful for the src directory).
|
||||
|
||||
- An example of how to replace/workaround a problematic include file
|
||||
is include/config/ftconfig.h; it changes a #define that would
|
||||
prevent SAS/C from generating XDEF's where it should do that and
|
||||
then includes the standard FreeType2 include file.
|
||||
|
||||
Local Variables:
|
||||
coding: latin-1
|
||||
End:
|
||||
@@ -0,0 +1,55 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftconfig.h */
|
||||
/* */
|
||||
/* Amiga-specific configuration file (specification only). */
|
||||
/* */
|
||||
/* Copyright 2005-2007, 2013 by */
|
||||
/* Werner Lemberg and Detlef Würkner. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
/*
|
||||
* This is an example how to override the default FreeType2 header files
|
||||
* with Amiga-specific changes. When the compiler searches this directory
|
||||
* before the default directory, we can do some modifications.
|
||||
*
|
||||
* Here we must change FT_EXPORT_DEF so that SAS/C does
|
||||
* generate the needed XDEFs.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#define FT_EXPORT_DEF( x ) extern x
|
||||
#endif
|
||||
|
||||
#undef FT_EXPORT_DEF
|
||||
#define FT_EXPORT_DEF( x ) x
|
||||
|
||||
/* Now include the original file */
|
||||
#ifndef __MORPHOS__
|
||||
#ifdef __SASC
|
||||
#include "FT:include/config/ftconfig.h"
|
||||
#else
|
||||
#include "/FT/include/config/ftconfig.h"
|
||||
#endif
|
||||
#else
|
||||
/* We must define that, it seems that
|
||||
* lib/gcc-lib/ppc-morphos/2.95.3/include/syslimits.h is missing in
|
||||
* ppc-morphos-gcc-2.95.3-bin.tgz (gcc for 68k producing MorphOS PPC elf
|
||||
* binaries from http://www.morphos.de)
|
||||
*/
|
||||
#define _LIBC_LIMITS_H_
|
||||
#include "/FT/include/config/ftconfig.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
coding: latin-1
|
||||
End:
|
||||
*/
|
||||
@@ -0,0 +1,160 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftmodule.h */
|
||||
/* */
|
||||
/* Amiga-specific FreeType module selection. */
|
||||
/* */
|
||||
/* Copyright 2005 by */
|
||||
/* Werner Lemberg and Detlef Würkner. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
/*
|
||||
* To avoid that all your programs include all FreeType modules,
|
||||
* you copy the following piece of source code into your own
|
||||
* source file and specify which modules you really need in your
|
||||
* application by uncommenting the appropriate lines.
|
||||
*/
|
||||
/*
|
||||
//#define FT_USE_AUTOFIT // autofitter
|
||||
//#define FT_USE_RASTER // monochrome rasterizer
|
||||
//#define FT_USE_SMOOTH // anti-aliasing rasterizer
|
||||
//#define FT_USE_TT // truetype font driver
|
||||
//#define FT_USE_T1 // type1 font driver
|
||||
//#define FT_USE_T42 // type42 font driver
|
||||
//#define FT_USE_T1CID // cid-keyed type1 font driver // no cmap support
|
||||
//#define FT_USE_CFF // opentype font driver
|
||||
//#define FT_USE_BDF // bdf bitmap font driver
|
||||
//#define FT_USE_PCF // pcf bitmap font driver
|
||||
//#define FT_USE_PFR // pfr font driver
|
||||
//#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver
|
||||
//#define FT_USE_OTV // opentype validator
|
||||
//#define FT_USE_GXV // truetype gx validator
|
||||
#include "FT:src/base/ftinit.c"
|
||||
*/
|
||||
|
||||
/* Make sure that the needed support modules are built in.
|
||||
* Dependencies can be found by searching for FT_Get_Module.
|
||||
*/
|
||||
|
||||
#ifdef FT_USE_T42
|
||||
#define FT_USE_TT
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_TT
|
||||
#define FT_USE_SFNT
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_CFF
|
||||
#define FT_USE_SFNT
|
||||
#define FT_USE_PSHINT
|
||||
#define FT_USE_PSNAMES
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_T1
|
||||
#define FT_USE_PSAUX
|
||||
#define FT_USE_PSHINT
|
||||
#define FT_USE_PSNAMES
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_T1CID
|
||||
#define FT_USE_PSAUX
|
||||
#define FT_USE_PSHINT
|
||||
#define FT_USE_PSNAMES
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_PSAUX
|
||||
#define FT_USE_PSNAMES
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_SFNT
|
||||
#define FT_USE_PSNAMES
|
||||
#endif
|
||||
|
||||
/* Now include the modules */
|
||||
|
||||
#ifdef FT_USE_AUTOFIT
|
||||
FT_USE_MODULE( FT_Module_Class, autofit_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_TT
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_T1
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_CFF
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_T1CID
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_PFR
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_T42
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_WINFNT
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_PCF
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_PSAUX
|
||||
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_PSNAMES
|
||||
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_PSHINT
|
||||
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_RASTER
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_SFNT
|
||||
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_SMOOTH
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_OTV
|
||||
FT_USE_MODULE( FT_Module_Class, otv_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_BDF
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_GXV
|
||||
FT_USE_MODULE( FT_Module_Class, gxv_module_class )
|
||||
#endif
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
coding: latin-1
|
||||
End:
|
||||
*/
|
||||
@@ -0,0 +1,299 @@
|
||||
#
|
||||
# Makefile for FreeType2 link library using ppc-morphos-gcc-2.95.3-bin.tgz
|
||||
# (gcc 2.95.3 hosted on 68k-Amiga producing MorphOS-PPC-binaries from
|
||||
# http://www.morphos.de)
|
||||
#
|
||||
|
||||
|
||||
# Copyright 2005-2007, 2009, 2013 by
|
||||
# Werner Lemberg and Detlef Würkner.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
#
|
||||
# to build from the builds/amiga directory call
|
||||
#
|
||||
# make assign
|
||||
# make
|
||||
#
|
||||
# Your programs source code should start with this
|
||||
# (uncomment the parts you do not need to keep the program small):
|
||||
# ---8<---
|
||||
#define FT_USE_AUTOFIT // autofitter
|
||||
#define FT_USE_RASTER // monochrome rasterizer
|
||||
#define FT_USE_SMOOTH // anti-aliasing rasterizer
|
||||
#define FT_USE_TT // truetype font driver
|
||||
#define FT_USE_T1 // type1 font driver
|
||||
#define FT_USE_T42 // type42 font driver
|
||||
#define FT_USE_T1CID // cid-keyed type1 font driver
|
||||
#define FT_USE_CFF // opentype font driver
|
||||
#define FT_USE_BDF // bdf bitmap font driver
|
||||
#define FT_USE_PCF // pcf bitmap font driver
|
||||
#define FT_USE_PFR // pfr font driver
|
||||
#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver
|
||||
#define FT_USE_OTV // opentype validator
|
||||
#define FT_USE_GXV // truetype gx validator
|
||||
#include "FT:src/base/ftinit.c"
|
||||
# ---8<---
|
||||
#
|
||||
# link your programs with libft2_ppc.a and either ftsystem.ppc.o or ftsystempure.ppc.o
|
||||
# (and either ftdebug.ppc.o or ftdebugpure.ppc.o if you enabled FT_DEBUG_LEVEL_ERROR or
|
||||
# FT_DEBUG_LEVEL_TRACE in include/config/ftoption.h).
|
||||
|
||||
all: libft2_ppc.a ftsystem.ppc.o ftsystempure.ppc.o
|
||||
|
||||
assign:
|
||||
assign FT: //
|
||||
|
||||
FTSRC = /FT/src
|
||||
|
||||
CC = ppc-morphos-gcc
|
||||
AR = ppc-morphos-ar rc
|
||||
RANLIB = ppc-morphos-ranlib
|
||||
LD = ppc-morphos-ld
|
||||
CFLAGS = -DFT2_BUILD_LIBRARY -O2 -I/emu/emulinclude/includegcc -I/emu/include -Iinclude -I$(FTSRC) -I/FT/include
|
||||
|
||||
#
|
||||
# FreeType2 library base
|
||||
#
|
||||
ftbase.ppc.o: $(FTSRC)/base/ftbase.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftinit.ppc.o: $(FTSRC)/base/ftinit.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftsystem.ppc.o: $(FTSRC)/base/ftsystem.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
# pure version for use in run-time library etc
|
||||
ftsystempure.ppc.o: src/base/ftsystem.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftdebug.ppc.o: $(FTSRC)/base/ftdebug.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
# pure version for use in run-time library etc
|
||||
ftdebugpure.ppc.o: src/base/ftdebug.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library base extensions
|
||||
#
|
||||
ftbbox.ppc.o: $(FTSRC)/base/ftbbox.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftbdf.ppc.o: $(FTSRC)/base/ftbdf.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftbitmap.ppc.o: $(FTSRC)/base/ftbitmap.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftcid.ppc.o: $(FTSRC)/base/ftcid.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftfstype.ppc.o: $(FTSRC)/base/ftfstype.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftgasp.ppc.o: $(FTSRC)/base/ftgasp.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftglyph.ppc.o: $(FTSRC)/base/ftglyph.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftgxval.ppc.o: $(FTSRC)/base/ftgxval.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftlcdfil.ppc.o: $(FTSRC)/base/ftlcdfil.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftmm.ppc.o: $(FTSRC)/base/ftmm.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftotval.ppc.o: $(FTSRC)/base/ftotval.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftpatent.ppc.o: $(FTSRC)/base/ftpatent.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftpfr.ppc.o: $(FTSRC)/base/ftpfr.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftstroke.ppc.o: $(FTSRC)/base/ftstroke.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftsynth.ppc.o: $(FTSRC)/base/ftsynth.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
fttype1.ppc.o: $(FTSRC)/base/fttype1.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftwinfnt.ppc.o: $(FTSRC)/base/ftwinfnt.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ftxf86.ppc.o: $(FTSRC)/base/ftxf86.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library autofitting module
|
||||
#
|
||||
autofit.ppc.o: $(FTSRC)/autofit/autofit.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library postscript hinting module
|
||||
#
|
||||
pshinter.ppc.o: $(FTSRC)/pshinter/pshinter.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library PS support module
|
||||
#
|
||||
psaux.ppc.o: $(FTSRC)/psaux/psaux.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library PS glyph names module
|
||||
#
|
||||
psnames.ppc.o: $(FTSRC)/psnames/psnames.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library monochrome raster module
|
||||
#
|
||||
raster.ppc.o: $(FTSRC)/raster/raster.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library anti-aliasing raster module
|
||||
#
|
||||
smooth.ppc.o: $(FTSRC)/smooth/smooth.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library 'sfnt' module
|
||||
#
|
||||
sfnt.ppc.o: $(FTSRC)/sfnt/sfnt.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library glyph and image caching system
|
||||
#
|
||||
ftcache.ppc.o: $(FTSRC)/cache/ftcache.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library OpenType font driver
|
||||
#
|
||||
cff.ppc.o: $(FTSRC)/cff/cff.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library TrueType font driver
|
||||
#
|
||||
truetype.ppc.o: $(FTSRC)/truetype/truetype.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library Type1 font driver
|
||||
#
|
||||
type1.ppc.o: $(FTSRC)/type1/type1.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library Type42 font driver
|
||||
#
|
||||
type42.ppc.o: $(FTSRC)/type42/type42.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library CID-keyed Type1 font driver
|
||||
#
|
||||
type1cid.ppc.o: $(FTSRC)/cid/type1cid.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library BDF bitmap font driver
|
||||
#
|
||||
bdf.ppc.o: $(FTSRC)/bdf/bdf.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library PCF bitmap font driver
|
||||
#
|
||||
pcf.ppc.o: $(FTSRC)/pcf/pcf.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library gzip support for compressed PCF bitmap fonts
|
||||
#
|
||||
gzip.ppc.o: $(FTSRC)/gzip/ftgzip.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
# FreeType2 library bzip2 support for compressed PCF bitmap fonts
|
||||
#
|
||||
bzip2.ppc.o: $(FTSRC)/bzip2/ftbzip2.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library compress support for compressed PCF bitmap fonts
|
||||
#
|
||||
lzw.ppc.o: $(FTSRC)/lzw/ftlzw.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library PFR font driver
|
||||
#
|
||||
pfr.ppc.o: $(FTSRC)/pfr/pfr.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library Windows FNT/FON bitmap font driver
|
||||
#
|
||||
winfnt.ppc.o: $(FTSRC)/winfonts/winfnt.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library TrueTypeGX Validator
|
||||
#
|
||||
gxvalid.ppc.o: $(FTSRC)/gxvalid/gxvalid.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library OpenType validator
|
||||
#
|
||||
otvalid.ppc.o: $(FTSRC)/otvalid/otvalid.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
BASEPPC = ftbase.ppc.o ftbbox.ppc.o ftbdf.ppc.o ftbitmap.ppc.o ftcid.ppc.o \
|
||||
ftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o ftgxval.ppc.o \
|
||||
ftlcdfil.ppc.o ftmm.ppc.o ftotval.ppc.o ftpatent.ppc.o ftpfr.ppc.o \
|
||||
ftstroke.ppc.o ftsynth.ppc.o fttype1.ppc.o ftwinfnt.ppc.o \
|
||||
ftxf86.ppc.o
|
||||
|
||||
DEBUGPPC = ftdebug.ppc.o ftdebugpure.ppc.o
|
||||
|
||||
AFITPPC = autofit.ppc.o
|
||||
|
||||
GXVPPC = gxvalid.ppc.o
|
||||
|
||||
OTVPPC = otvalid.ppc.o
|
||||
|
||||
PSPPC = psaux.ppc.o psnames.ppc.o pshinter.ppc.o
|
||||
|
||||
RASTERPPC = raster.ppc.o smooth.ppc.o
|
||||
|
||||
FONTDPPC = cff.ppc.o type1.ppc.o type42.ppc.o type1cid.ppc.o truetype.ppc.o\
|
||||
bdf.ppc.o pcf.ppc.o pfr.ppc.o winfnt.ppc.o
|
||||
|
||||
libft2_ppc.a: $(BASEPPC) $(AFITPPC) $(GXVPPC) $(OTVPPC) $(PSPPC) $(RASTERPPC) sfnt.ppc.o ftcache.ppc.o $(FONTDPPC) gzip.ppc.o bzip2.ppc.o lzw.ppc.o
|
||||
$(AR) $@ $(BASEPPC) $(AFITPPC) $(GXVPPC) $(OTVPPC) $(PSPPC) $(RASTERPPC) sfnt.ppc.o ftcache.ppc.o $(FONTDPPC) gzip.ppc.o bzip2.ppc.o lzw.ppc.o
|
||||
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
|
||||
|
||||
#Local Variables:
|
||||
#coding: latin-1
|
||||
#End:
|
||||
@@ -0,0 +1,303 @@
|
||||
#
|
||||
# Makefile for FreeType2 link library using gcc 4.0.3 from the
|
||||
# AmigaOS4 SDK
|
||||
#
|
||||
|
||||
|
||||
# Copyright 2005-2007, 2009, 2013 by
|
||||
# Werner Lemberg and Detlef Würkner.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# to build from the builds/amiga directory call
|
||||
#
|
||||
# make -f makefile.os4
|
||||
#
|
||||
# Your programs source code should start with this
|
||||
# (uncomment the parts you do not need to keep the program small):
|
||||
# ---8<---
|
||||
#define FT_USE_AUTOFIT // autofitter
|
||||
#define FT_USE_RASTER // monochrome rasterizer
|
||||
#define FT_USE_SMOOTH // anti-aliasing rasterizer
|
||||
#define FT_USE_TT // truetype font driver
|
||||
#define FT_USE_T1 // type1 font driver
|
||||
#define FT_USE_T42 // type42 font driver
|
||||
#define FT_USE_T1CID // cid-keyed type1 font driver
|
||||
#define FT_USE_CFF // opentype font driver
|
||||
#define FT_USE_BDF // bdf bitmap font driver
|
||||
#define FT_USE_PCF // pcf bitmap font driver
|
||||
#define FT_USE_PFR // pfr font driver
|
||||
#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver
|
||||
#define FT_USE_OTV // opentype validator
|
||||
#define FT_USE_GXV // truetype gx validator
|
||||
#include "FT:src/base/ftinit.c"
|
||||
# ---8<---
|
||||
#
|
||||
# link your programs with libft2_ppc.a and either ftsystem.ppc.o or ftsystempure.ppc.o
|
||||
# (and either ftdebug.ppc.o or ftdebugpure.ppc.o if you enabled FT_DEBUG_LEVEL_ERROR or
|
||||
# FT_DEBUG_LEVEL_TRACE in include/config/ftoption.h).
|
||||
|
||||
all: assign libft2_ppc.a ftsystem.ppc.o ftsystempure.ppc.o
|
||||
|
||||
assign:
|
||||
assign FT: //
|
||||
|
||||
CC = ppc-amigaos-gcc
|
||||
AR = ppc-amigaos-ar
|
||||
RANLIB = ppc-amigaos-ranlib
|
||||
|
||||
DIRFLAGS = -Iinclude -I/FT/src -I/FT/include -I/SDK/include
|
||||
|
||||
WARNINGS = -Wall -W -Wundef -Wpointer-arith -Wbad-function-cast \
|
||||
-Waggregate-return -Wwrite-strings -Wshadow
|
||||
|
||||
OPTIONS = -DFT2_BUILD_LIBRARY -DNDEBUG -fno-builtin
|
||||
OPTIMIZE = -O2 -fomit-frame-pointer -fstrength-reduce -finline-functions
|
||||
|
||||
CFLAGS = -mcrt=clib2 $(DIRFLAGS) $(WARNINGS) $(FT2FLAGS) $(OPTIONS) $(OPTIMIZE)
|
||||
|
||||
#
|
||||
# FreeType2 library base
|
||||
#
|
||||
ftbase.ppc.o: FT:src/base/ftbase.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftbase.c
|
||||
|
||||
ftinit.ppc.o: FT:src/base/ftinit.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftinit.c
|
||||
|
||||
ftsystem.ppc.o: FT:src/base/ftsystem.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftsystem.c
|
||||
|
||||
# pure version for use in run-time library etc
|
||||
ftsystempure.ppc.o: src/base/ftsystem.c
|
||||
$(CC) -c $(CFLAGS) -o $@ src/base/ftsystem.c
|
||||
|
||||
#
|
||||
# FreeType2 library base extensions
|
||||
#
|
||||
ftbbox.ppc.o: FT:src/base/ftbbox.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftbbox.c
|
||||
|
||||
ftbdf.ppc.o: FT:src/base/ftbdf.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftbdf.c
|
||||
|
||||
ftbitmap.ppc.o: FT:src/base/ftbitmap.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftbitmap.c
|
||||
|
||||
ftcid.ppc.o: FT:src/base/ftcid.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftcid.c
|
||||
|
||||
ftdebug.ppc.o: FT:src/base/ftdebug.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftdebug.c
|
||||
|
||||
# pure version for use in run-time library etc
|
||||
ftdebugpure.ppc.o: src/base/ftdebug.c
|
||||
$(CC) -c $(CFLAGS) -o $@ src/base/ftdebug.c
|
||||
|
||||
ftfstype.ppc.o: FT:src/base/ftfstype.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftfstype.c
|
||||
|
||||
ftgasp.ppc.o: FT:src/base/ftgasp.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftgasp.c
|
||||
|
||||
ftglyph.ppc.o: FT:src/base/ftglyph.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftglyph.c
|
||||
|
||||
ftgxval.ppc.o: FT:src/base/ftgxval.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftgxval.c
|
||||
|
||||
ftlcdfil.ppc.o: FT:src/base/ftlcdfil.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftlcdfil.c
|
||||
|
||||
ftmm.ppc.o: FT:src/base/ftmm.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftmm.c
|
||||
|
||||
ftotval.ppc.o: FT:src/base/ftotval.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftotval.c
|
||||
|
||||
ftpatent.ppc.o: FT:src/base/ftpatent.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftpatent.c
|
||||
|
||||
ftpfr.ppc.o: FT:src/base/ftpfr.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftpfr.c
|
||||
|
||||
ftstroke.ppc.o: FT:src/base/ftstroke.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftstroke.c
|
||||
|
||||
ftsynth.ppc.o: FT:src/base/ftsynth.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftsynth.c
|
||||
|
||||
fttype1.ppc.o: FT:src/base/fttype1.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/fttype1.c
|
||||
|
||||
ftwinfnt.ppc.o: FT:src/base/ftwinfnt.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftwinfnt.c
|
||||
|
||||
ftxf86.ppc.o: FT:src/base/ftxf86.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftxf86.c
|
||||
|
||||
#
|
||||
# FreeType2 library autofitting module
|
||||
#
|
||||
autofit.ppc.o: FT:src/autofit/autofit.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/autofit/autofit.c
|
||||
|
||||
#
|
||||
# FreeType2 library postscript hinting module
|
||||
#
|
||||
pshinter.ppc.o: FT:src/pshinter/pshinter.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/pshinter/pshinter.c
|
||||
|
||||
#
|
||||
# FreeType2 library PS support module
|
||||
#
|
||||
psaux.ppc.o: FT:src/psaux/psaux.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/psaux/psaux.c
|
||||
|
||||
#
|
||||
# FreeType2 library PS glyph names module
|
||||
#
|
||||
psnames.ppc.o: FT:src/psnames/psnames.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/psnames/psnames.c
|
||||
|
||||
#
|
||||
# FreeType2 library monochrome raster module
|
||||
#
|
||||
raster.ppc.o: FT:src/raster/raster.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/raster/raster.c
|
||||
|
||||
#
|
||||
# FreeType2 library anti-aliasing raster module
|
||||
#
|
||||
smooth.ppc.o: FT:src/smooth/smooth.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/smooth/smooth.c
|
||||
|
||||
#
|
||||
# FreeType2 library 'sfnt' module
|
||||
#
|
||||
sfnt.ppc.o: FT:src/sfnt/sfnt.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/sfnt/sfnt.c
|
||||
|
||||
#
|
||||
# FreeType2 library glyph and image caching system
|
||||
#
|
||||
ftcache.ppc.o: FT:src/cache/ftcache.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/cache/ftcache.c
|
||||
|
||||
#
|
||||
# FreeType2 library OpenType font driver
|
||||
#
|
||||
cff.ppc.o: FT:src/cff/cff.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/cff/cff.c
|
||||
|
||||
#
|
||||
# FreeType2 library TrueType font driver
|
||||
#
|
||||
truetype.ppc.o: FT:src/truetype/truetype.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/truetype/truetype.c
|
||||
|
||||
#
|
||||
# FreeType2 library Type1 font driver
|
||||
#
|
||||
type1.ppc.o: FT:src/type1/type1.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/type1/type1.c
|
||||
|
||||
#
|
||||
# FreeType2 library Type42 font driver
|
||||
#
|
||||
type42.ppc.o: FT:src/type42/type42.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/type42/type42.c
|
||||
|
||||
#
|
||||
# FreeType2 library CID-keyed Type1 font driver
|
||||
#
|
||||
type1cid.ppc.o: FT:src/cid/type1cid.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/cid/type1cid.c
|
||||
|
||||
#
|
||||
# FreeType2 library BDF bitmap font driver
|
||||
#
|
||||
bdf.ppc.o: FT:src/bdf/bdf.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/bdf/bdf.c
|
||||
|
||||
#
|
||||
# FreeType2 library PCF bitmap font driver
|
||||
#
|
||||
pcf.ppc.o: FT:src/pcf/pcf.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/pcf/pcf.c
|
||||
|
||||
#
|
||||
# FreeType2 library gzip support for compressed PCF bitmap fonts
|
||||
#
|
||||
gzip.ppc.o: FT:src/gzip/ftgzip.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/gzip/ftgzip.c
|
||||
|
||||
#
|
||||
# FreeType2 library bzip2 support for compressed PCF bitmap fonts
|
||||
#
|
||||
bzip2.ppc.o: FT:src/bzip2/ftbzip2.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/bzip2/ftbzip2.c
|
||||
|
||||
#
|
||||
# FreeType2 library compress support for compressed PCF bitmap fonts
|
||||
#
|
||||
lzw.ppc.o: FT:src/lzw/ftlzw.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/lzw/ftlzw.c
|
||||
|
||||
#
|
||||
# FreeType2 library PFR font driver
|
||||
#
|
||||
pfr.ppc.o: FT:src/pfr/pfr.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/pfr/pfr.c
|
||||
|
||||
#
|
||||
# FreeType2 library Windows FNT/FON bitmap font driver
|
||||
#
|
||||
winfnt.ppc.o: FT:src/winfonts/winfnt.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/winfonts/winfnt.c
|
||||
|
||||
#
|
||||
# FreeType2 library TrueTypeGX Validator
|
||||
#
|
||||
gxvalid.ppc.o: FT:src/gxvalid/gxvalid.c
|
||||
$(CC) -c $(CFLAGS) -Wno-aggregate-return -o $@ /FT/src/gxvalid/gxvalid.c
|
||||
|
||||
#
|
||||
# FreeType2 library OpenType validator
|
||||
#
|
||||
otvalid.ppc.o: FT:src/otvalid/otvalid.c
|
||||
$(CC) -c $(CFLAGS) -o $@ /FT/src/otvalid/otvalid.c
|
||||
|
||||
BASE = ftbase.ppc.o ftbbox.ppc.o ftbdf.ppc.o ftbitmap.ppc.o ftcid.ppc.o \
|
||||
ftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o ftgxval.ppc.o \
|
||||
ftlcdfil.ppc.o ftmm.ppc.o ftotval.ppc.o ftpatent.ppc.o ftpfr.ppc.o \
|
||||
ftstroke.ppc.o ftsynth.ppc.o fttype1.ppc.o ftwinfnt.ppc.o \
|
||||
ftxf86.ppc.o
|
||||
|
||||
DEBUG = ftdebug.ppc.o ftdebugpure.ppc.o
|
||||
|
||||
AFIT = autofit.ppc.o
|
||||
|
||||
GXV = gxvalid.ppc.o
|
||||
|
||||
OTV = otvalid.ppc.o
|
||||
|
||||
PS = psaux.ppc.o psnames.ppc.o pshinter.ppc.o
|
||||
|
||||
RASTER = raster.ppc.o smooth.ppc.o
|
||||
|
||||
FONTD = cff.ppc.o type1.ppc.o type42.ppc.o type1cid.ppc.o truetype.ppc.o\
|
||||
bdf.ppc.o pcf.ppc.o pfr.ppc.o winfnt.ppc.o
|
||||
|
||||
libft2_ppc.a: $(BASE) $(AFIT) $(GXV) $(OTV) $(PS) $(RASTER) sfnt.ppc.o ftcache.ppc.o $(FONTD) gzip.ppc.o lzw.ppc.o
|
||||
$(AR) r $@ $(BASE) $(AFIT) $(GXV) $(OTV) $(PS) $(RASTER) sfnt.ppc.o ftcache.ppc.o $(FONTD) gzip.ppc.o lzw.ppc.o
|
||||
$(RANLIB) $@
|
||||
|
||||
#Local Variables:
|
||||
#coding: latin-1
|
||||
#End:
|
||||
@@ -0,0 +1,303 @@
|
||||
#
|
||||
# Makefile for FreeType2 link library using Amiga SAS/C 6.58
|
||||
#
|
||||
|
||||
|
||||
# Copyright 2005-2007, 2009, 2013 by
|
||||
# Werner Lemberg and Detlef Würkner.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# to build from the builds/amiga directory call
|
||||
#
|
||||
# smake assign
|
||||
# smake
|
||||
#
|
||||
# Your programs source code should start with this
|
||||
# (uncomment the parts you do not need to keep the program small):
|
||||
# ---8<---
|
||||
#define FT_USE_AUTOFIT // autofitter
|
||||
#define FT_USE_RASTER // monochrome rasterizer
|
||||
#define FT_USE_SMOOTH // anti-aliasing rasterizer
|
||||
#define FT_USE_TT // truetype font driver
|
||||
#define FT_USE_T1 // type1 font driver
|
||||
#define FT_USE_T42 // type42 font driver
|
||||
#define FT_USE_T1CID // cid-keyed type1 font driver
|
||||
#define FT_USE_CFF // opentype font driver
|
||||
#define FT_USE_BDF // bdf bitmap font driver
|
||||
#define FT_USE_PCF // pcf bitmap font driver
|
||||
#define FT_USE_PFR // pfr font driver
|
||||
#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver
|
||||
#define FT_USE_OTV // opentype validator
|
||||
#define FT_USE_GXV // truetype gx validator
|
||||
#include "FT:src/base/ftinit.c"
|
||||
# ---8<---
|
||||
#
|
||||
# link your programs with ft2_680x0.lib and either ftsystem.o or ftsystempure.o
|
||||
# (and either ftdebug.o or ftdebugpure.o if you enabled FT_DEBUG_LEVEL_ERROR or
|
||||
# FT_DEBUG_LEVEL_TRACE in include/config/ftoption.h).
|
||||
|
||||
OBJBASE = ftbase.o ftbbox.o ftbdf.o ftbitmap.o ftcid.o ftfstype.o ftgasp.o \
|
||||
ftglyph.o ftgxval.o ftlcdfil.o ftmm.o ftotval.o ftpatent.o ftpfr.o \
|
||||
ftstroke.o ftsynth.o fttype1.o ftwinfnt.o ftxf86.o
|
||||
|
||||
OBJSYSTEM = ftsystem.o ftsystempure.o
|
||||
|
||||
OBJDEBUG = ftdebug.o ftdebugpure.o
|
||||
|
||||
OBJAFIT = autofit.o
|
||||
|
||||
OBJGXV = gxvalid.o
|
||||
|
||||
OBJOTV = otvalid.o
|
||||
|
||||
OBJPS = psaux.o psnames.o pshinter.o
|
||||
|
||||
OBJRASTER = raster.o smooth.o
|
||||
|
||||
OBJSFNT = sfnt.o
|
||||
|
||||
OBJCACHE = ftcache.o
|
||||
|
||||
OBJFONTD = cff.o type1.o type42.o type1cid.o\
|
||||
truetype.o winfnt.o bdf.o pcf.o pfr.o
|
||||
|
||||
CORE = FT:src/
|
||||
|
||||
CPU = 68000
|
||||
#CPU = 68020
|
||||
#CPU = 68030
|
||||
#CPU = 68040
|
||||
#CPU = 68060
|
||||
|
||||
OPTIMIZER = optinlocal
|
||||
|
||||
SCFLAGS = optimize opttime optsched strmerge data=faronly idlen=50 cpu=$(CPU)\
|
||||
idir=include/ idir=$(CORE) idir=FT:include/ nostackcheck nochkabort\
|
||||
noicons ignore=79,85,110,306 parameters=both define=FT2_BUILD_LIBRARY
|
||||
|
||||
LIB = ft2_$(CPU).lib
|
||||
|
||||
# sample linker options
|
||||
OPTS = link lib=$(LIB),lib:sc.lib,lib:amiga.lib,lib:debug.lib\
|
||||
smallcode smalldata noicons utillib
|
||||
|
||||
# sample program entry
|
||||
#myprog: myprog.c ftsystem.o $(LIB)
|
||||
# sc $< programname=$@ ftsystem.o $(SCFLAGS) $(OPTS)
|
||||
|
||||
all: $(LIB) $(OBJSYSTEM) $(OBJDEBUG)
|
||||
|
||||
assign:
|
||||
assign FT: //
|
||||
|
||||
# uses separate object modules in lib to make for easier debugging
|
||||
# also, can make smaller programs if entire engine is not used
|
||||
ft2_$(CPU).lib: $(OBJBASE) $(OBJAFIT) $(OBJOTV) $(OBJPS) $(OBJRASTER) $(OBJSFNT) $(OBJCACHE) $(OBJFONTD) lzw.o gzip.o bzip2.o
|
||||
oml $@ r $(OBJBASE) $(OBJAFIT) $(OBJOTV) $(OBJPS) $(OBJRASTER) $(OBJSFNT) $(OBJCACHE) $(OBJFONTD) lzw.o gzip.o bzip2.o
|
||||
|
||||
clean:
|
||||
-delete \#?.o
|
||||
|
||||
realclean: clean
|
||||
-delete ft2$(CPU).lib
|
||||
|
||||
#
|
||||
# freetype library base
|
||||
#
|
||||
ftbase.o: $(CORE)base/ftbase.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftinit.o: $(CORE)base/ftinit.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftsystem.o: $(CORE)base/ftsystem.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftsystempure.o: src/base/ftsystem.c ## pure version for use in run-time library etc
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftdebug.o: $(CORE)base/ftdebug.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftdebugpure.o: src/base/ftdebug.c ## pure version for use in run-time library etc
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
#
|
||||
# freetype library base extensions
|
||||
#
|
||||
ftbbox.o: $(CORE)base/ftbbox.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftbdf.o: $(CORE)base/ftbdf.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftbitmap.o: $(CORE)base/ftbitmap.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftcid.o: $(CORE)base/ftcid.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftfstype.o: $(CORE)base/ftfstype.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftgasp.o: $(CORE)base/ftgasp.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftglyph.o: $(CORE)base/ftglyph.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftgxval.o: $(CORE)base/ftgxval.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftlcdfil.o: $(CORE)base/ftlcdfil.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftmm.o: $(CORE)base/ftmm.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftotval.o: $(CORE)base/ftotval.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftpatent.o: $(CORE)base/ftpatent.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftpfr.o: $(CORE)base/ftpfr.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftstroke.o: $(CORE)base/ftstroke.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftsynth.o: $(CORE)base/ftsynth.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
fttype1.o: $(CORE)base/fttype1.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftwinfnt.o: $(CORE)base/ftwinfnt.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
ftxf86.o: $(CORE)base/ftxf86.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library autofitter module
|
||||
#
|
||||
autofit.o: $(CORE)autofit/autofit.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library PS hinting module
|
||||
#
|
||||
pshinter.o: $(CORE)pshinter/pshinter.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
#
|
||||
# freetype library PS support module
|
||||
#
|
||||
psaux.o: $(CORE)psaux/psaux.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library PS glyph names module
|
||||
#
|
||||
psnames.o: $(CORE)psnames/psnames.c
|
||||
sc $(SCFLAGS) code=far objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library monochrome raster module
|
||||
#
|
||||
raster.o: $(CORE)raster/raster.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library anti-aliasing raster module
|
||||
#
|
||||
smooth.o: $(CORE)smooth/smooth.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library 'sfnt' module
|
||||
#
|
||||
sfnt.o: $(CORE)sfnt/sfnt.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library glyph and image caching system (still experimental)
|
||||
#
|
||||
ftcache.o: $(CORE)cache/ftcache.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library OpenType font driver
|
||||
#
|
||||
cff.o: $(CORE)cff/cff.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library TrueType font driver
|
||||
#
|
||||
truetype.o: $(CORE)truetype/truetype.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library Type1 font driver
|
||||
#
|
||||
type1.o: $(CORE)type1/type1.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# FreeType2 library Type42 font driver
|
||||
#
|
||||
type42.o: $(CORE)type42/type42.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library CID-keyed Type1 font driver
|
||||
#
|
||||
type1cid.o: $(CORE)cid/type1cid.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
#
|
||||
# freetype library CID-keyed Type1 font driver extensions
|
||||
#
|
||||
#cidafm.o: $(CORE)cid/cidafm.c
|
||||
# sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library BDF bitmap font driver
|
||||
#
|
||||
bdf.o: $(CORE)bdf/bdf.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library PCF bitmap font driver
|
||||
#
|
||||
pcf.o: $(CORE)pcf/pcf.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library gzip support for compressed PCF bitmap fonts
|
||||
#
|
||||
gzip.o: $(CORE)gzip/ftgzip.c
|
||||
sc $(SCFLAGS) define FAR objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library bzip2 support for compressed PCF bitmap fonts
|
||||
#
|
||||
bzip2.o: $(CORE)bzip2/ftbzip2.c
|
||||
sc $(SCFLAGS) define FAR objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library compress support for compressed PCF bitmap fonts
|
||||
#
|
||||
lzw.o: $(CORE)lzw/ftlzw.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library PFR font driver
|
||||
#
|
||||
pfr.o: $(CORE)pfr/pfr.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library Windows FNT/FON bitmap font driver
|
||||
#
|
||||
winfnt.o: $(CORE)winfonts/winfnt.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library TrueTypeGX validator
|
||||
#
|
||||
gxvalid.o: $(CORE)gxvalid/gxvalid.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#
|
||||
# freetype library OpenType validator
|
||||
#
|
||||
otvalid.o: $(CORE)otvalid/otvalid.c
|
||||
sc $(SCFLAGS) objname=$@ $<
|
||||
|
||||
#Local Variables:
|
||||
#coding: latin-1
|
||||
#End:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user