1 /***********************************************************************/ 2 /* Open Visualization Data Explorer */ 3 /* (C) Copyright IBM Corp. 1989,1999 */ 4 /* ALL RIGHTS RESERVED */ 5 /* This code licensed under the */ 6 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */ 7 /***********************************************************************/ 8 9 #include <dxconfig.h> 10 11 12 #ifndef tdmPortLayer_h 13 #define tdmPortLayer_h 14 /*---------------------------------------------------------------------------*\ 15 $Source: /src/master/dx/src/exec/hwrender/hwPortLayer.h,v $ 16 Author: Mark Hood 17 18 This file contains ANSI prototypes for the tdm porting layer routines. 19 20 \*---------------------------------------------------------------------------*/ 21 22 #define LOCAL_DXD_SYMBOL_INTERFACE_VERSION 0 23 24 /* 25 * graphics hardware types. 26 */ 27 28 #define GTO 1 29 #define GTOZMIN 0x00000000 30 #define GTOZMAX 0x001FFFFF 31 32 #define HP3D 2 33 #define HP3DZMIN 0xFF800000 34 #define HP3DZMAX 0x007FFFFF 35 36 #define SGP 3 37 #define Gt4 4 38 #define Gt4x 5 39 40 41 #ifdef STANDALONE 42 /* 43 * This section is used by programs testing the porting layer. 44 * Corresponding DX-specific code is in hwWindow.h and Light.H. 45 */ 46 typedef struct { 47 #if defined(DX_NATIVE_WINDOWS) 48 HWND wigWindow; 49 HWND xid, parentWindow; 50 #else 51 Display *dpy ; 52 Window xid, parentWindow ; 53 Window lxid, rxid; 54 #endif 55 Colormap colorMap ; 56 tdmInteractorWin interactorData ; 57 int pixw, pixh ; 58 int hwNumImagePlanes, hwZbufferMinValue, hwZbufferMaxValue ; 59 int hwNumZbufferBits, hwType, bufferMode, visibility ; 60 int saveBufValid, saveBufSize ; 61 void *imageCtx, *stack, *saveBuf, *swBuf ; 62 /* #X */ int uitype; 63 } tdmRenderInstance ; 64 65 #define DEFGLOBALDATA(G) \ 66 register tdmRenderInstance *instance = (tdmRenderInstance *) G 67 68 #define DEFWINDATA(W) DEFGLOBALDATA(W) 69 #define DPY (instance->dpy) 70 #define XWINID (instance->xid) 71 #define LWINID (instance->lxid) 72 #define RWINID (instance->rxid) 73 #define PARENT_WINDOW (instance->parentWindow) 74 #define PIXW (instance->pixw) 75 #define PIXH (instance->pixh) 76 #define BUFFER_MODE (instance->bufferMode) 77 #define VISIBILITY (instance->visibility) 78 #define CLRMAP (instance->colorMap) 79 #define IMAGE_CTX (instance->imageCtx) 80 #define STACK (instance->stack) 81 #define MATRIX_STACK (instance->stack) 82 #define INTERACTOR_DATA (instance->interactorData) 83 #define SW_BUF (instance->swBuf) 84 #define SAVE_BUF (instance->saveBuf) 85 #define SAVE_BUF_SIZE (instance->saveBufSize) 86 #define SAVE_BUF_VALID (instance->saveBufValid) 87 88 /* #X follows */ 89 #define UI_TYPE (instance->uitype) 90 #define DXD_DXUI 1 91 #define DXD_EXTERNALUI 2 92 #define DXD_NOUI 3 93 #define DXUI (UI_TYPE == DXD_DXUI) 94 #define EXTERNALUI (UI_TYPE == DXD_EXTERNALUI) 95 #define NOUI (UI_TYPE == DXD_NOUI) 96 /* #X end */ 97 98 typedef int Error ; 99 #define DXResetError() 100 #define DXWarning(string) 101 #define DXSetError(code, string) 102 #define DXErrorGoto(code, string) goto error 103 #define DXErrorReturn(code, string) return FALSE 104 #define _dxfChangeBufferMode(win, mode) 105 #define _dxfLoadRenderOptionsFile(globals) (TRUE) 106 #define tdmAllocate malloc 107 #define tdmReAllocate realloc 108 #ifndef tdmFree 109 #define tdmFree free 110 #endif 111 #ifndef tdmAllocateLocal 112 #define tdmAllocateLocal malloc 113 #endif 114 115 #define XmVersion 1001 116 117 typedef struct { float x, y, z ; } Point, Vector ; 118 typedef struct { float r, g, b ; } RGBColor ; 119 typedef struct { 120 enum { invalid, point, distant, ambient } kind ; 121 enum { camera, world } relative ; 122 Point position ; 123 Vector direction ; 124 RGBColor color ; 125 } tdmLight, *Light ; 126 127 #define DXQueryCameraDistantLight(l, d, c) \ 128 (l->kind!=distant || l->relative!=camera? 0: (*d=l->direction, *c=l->color, l)) 129 #define DXQueryDistantLight(l, d, c) \ 130 (l->kind!=distant || l->relative!=world? 0: (*d=l->direction, *c=l->color, l)) 131 #define DXQueryAmbientLight(l, c) \ 132 (l->kind != ambient? 0: (*c=l->color, l)) 133 #else /* STANDALONE */ 134 135 #define SingleBufferMode (1) 136 #define DoubleBufferMode (2) 137 #define ZBufferEnabled (1) 138 #define ZBufferDisabled (0) 139 140 #endif /* STANDALONE */ 141 142 143 typedef struct tdmParsedFormatS { 144 char* type; 145 char* where; 146 char* fullHost; 147 char* localHost; 148 char* Xserver; 149 char* name; 150 char* cacheId; 151 int link; 152 char* originalWhere; 153 154 } tdmParsedFormatT; 155 156 /* 157 * !! IMPORTANT !! 158 * 159 * To maintain backward compatibility is is important that existing interfaces 160 * are not changed or deleted, and that new functions are added at the end 161 * of the table. 162 * 163 * When new functions are added at the end of the 'tdmDrawPort' 164 * or 'tdmInteractorEcho' structures, the DXD_HWDD_INTERFACE_VERSION #define 165 * in libdx/dx/version.h must be incremented and entry point macros in this 166 * file must check the version before attempting the call. 167 * (see _dxf_ADD_CLIP_PLANES). 168 * 169 * This is because checking for NULL won't work if the structure was 170 * smaller in a previous version. 171 */ 172 173 typedef struct tdmDrawPortS { 174 void* (*AllocatePixelArray) (void *ctx, int w, int h); 175 Error (*AddClipPlanes)(void* win, Point *pt, Vector *normal, int count); 176 void (*ClearArea) (void *ctx, int left, int right, int bottom, int top); 177 translationO (*CreateHwTranslation)(void *win); 178 void* (*CreateWindow) (void *globals, char *winName, int w, int h); 179 int (*DefineLight) (void *win, int n, Light light); 180 void (*DestroyWindow) (void *win); 181 Error (*DrawClipping)(tdmPortHandleP portHandle, xfieldP xfield, 182 int buttonDown); 183 Error (*DrawImage)(void* win, dxObject image, 184 translationO translation); 185 Error (*DrawOpaque)(tdmPortHandleP portHandle, xfieldP xfield, 186 RGBColor ambientColor, int buttonDown); 187 Error (*RemoveClipPlanes)(void* win, int count); 188 void (*FreePixelArray) (void *ctx, void *pixels); 189 Error (*InitRenderModule) (void *globals); 190 void (*InitRenderPass) (void *win, int bufferMode, int zBufferMode); 191 void (*LoadMatrix) (void *ctx, float M[4][4]); 192 void (*MakeProjectionMatrix) (int projection, float width, float aspect, 193 float Near, float Far, float M[4][4]); 194 void (*PopMatrix) (void *ctx); 195 void (*PushMultiplyMatrix) (void *ctx, float M[4][4]); 196 void (*PushReplaceMatrix) (void *ctx, float M[4][4]); 197 int (*ReadApproxBackstore) (void *win, int camw, int camh); 198 void (*ReplaceViewMatrix) (void *ctx, float M[4][4]); 199 int (*SetBackgroundColor) (void *ctx, RGBColor color); 200 void (*SetDoubleBufferMode) (void *ctx); 201 void (*SetGlobalLightAttributes) (void *ctx, int on); 202 void (*SetMaterialSpecular) (void *ctx, float r, float g, float b, 203 float pow); 204 void (*SetOrthoProjection) (void *ctx, float width, float aspect, 205 float Near, float Far); 206 #if defined(DX_NATIVE_WINDOWS) 207 void (*SetOutputWindow) (void *win, HRGN); 208 #else 209 void (*SetOutputWindow) (void *win, Window); 210 #endif 211 void (*SetPerspectiveProjection) (void *ctx, float xfov, float aspect, 212 float Near, float Far); 213 void (*SetSingleBufferMode) (void *ctx); 214 void (*SetViewport) (void *ctx, int left, int right, int bottom, int top); 215 void (*SetWindowSize) (void *win,int w,int h); 216 #if defined(DX_NATIVE_WINDOWS) 217 void (*SwapBuffers) (void *ctx); 218 #else 219 void (*SwapBuffers) (void *ctx, Window); 220 #endif 221 void (*WriteApproxBackstore) (void *win, int camw, int camh); 222 void (*WritePixelRect) (void* win, unsigned char *buf, 223 int x, int y,int w, int h); 224 225 /* End of functions available in 2.0 and 2.0.1 */ 226 227 /* End of 3.0 */ 228 229 Error (*DrawTransparent)(void *globals, 230 RGBColor * ambientColor, int buttonUp); 231 void (*GetMatrix)(void *ctx, float M[4][4]); 232 void (*GetProjection)(void * ctx, float M[4][4]); 233 int (*GetVersion)(char **); 234 Error (*ReadImage) (void *win, void *buf); 235 Error (*StartFrame) (void *win); 236 Error (*EndFrame) (void *win); 237 Error (*ClearBuffer) (void *win); 238 239 } tdmDrawPortT; 240 241 /* 242 * Port Layer light definitions 243 */ 244 245 typedef struct tdmSimpleLightS { 246 Vector direction; 247 RGBColor color; 248 int isAmbient; 249 } tdmSimpleLightT; 250 251 252 253 /* 254 * Port Layer handle 255 */ 256 typedef struct tdmPortHandleS { 257 void* dpy; 258 tdmDrawPortP portFuncs; 259 tdmInteractorEchoP echoFuncs; 260 void (*uninitP)(); 261 void* private; 262 } tdmPortHandleT; 263 264 #ifndef PRIVATE_TYPE 265 #define PRIVATE_TYPE void * 266 #endif 267 268 #define DEFPORT(portHandle) \ 269 register PRIVATE_TYPE _portContext = \ 270 (PRIVATE_TYPE) ((tdmPortHandleP)portHandle)->private; \ 271 register tdmInteractorEchoP _eFuncs = \ 272 (tdmInteractorEchoP) ((tdmPortHandleP)portHandle)->echoFuncs; \ 273 register tdmDrawPortP _pFuncs = \ 274 (tdmDrawPortP) ((tdmPortHandleP)portHandle)->portFuncs 275 276 #define PORT_CTX _portContext 277 #define EFUNCS(foo) (_eFuncs->foo) 278 279 /* 280 * The rest of the porting layer is callable by either a test program or 281 * the DX hardware renderer implementation. 282 */ 283 284 285 #ifndef STRUCTURES_ONLY 286 #ifndef OLD_PORT_LAYER_CALLS 287 288 extern int _dxd_lmHwddVersion; 289 290 #define _dxf_DRAW_IMAGE( win, image, translation) \ 291 ((! _pFuncs->DrawImage)? OK : \ 292 (*_pFuncs->DrawImage)(win, image, translation)) 293 294 #define _dxf_DRAW_OPAQUE( portHandle, xf, ambientColor, buttonUP) \ 295 (*_pFuncs->DrawOpaque)(portHandle,xf,ambientColor,buttonUp) 296 297 #define _dxf_CREATE_WINDOW( globals, winName, w, h) \ 298 (*_pFuncs->CreateWindow)(globals, winName, w, h) 299 300 #define _dxf_CREATE_HW_TRANSLATION(win) \ 301 ((! _pFuncs->CreateHwTranslation)? OK : \ 302 (*_pFuncs->CreateHwTranslation)(win)) 303 304 #define _dxf_DRAW_TRANSPARENT(globals, ambientColor, buttonUP) \ 305 ((! _pFuncs->DrawTransparent)? OK : \ 306 (*_pFuncs->DrawTransparent)(globals, ambientColor, buttonUP)) 307 308 /* Rasterize the sorted list of primitves, if the port requires a sorted 309 * list for transparent primitives, then this should be defined and 310 * be able to traverse the sortIndex list and dereference to the 311 * require connection in the associated xfield. 312 */ 313 314 #define _dxf_DRAW_CLIP(portHandle, xfield, buttonDown) \ 315 ((! _pFuncs->DrawClipping)? OK : \ 316 (*_pFuncs->DrawClipping) (portHandle, xfield, buttonDown)) 317 /* 318 */ 319 320 #define _dxf_ADD_CLIP_PLANES(win, pt, normal, count) \ 321 ((_dxd_lmHwddVersion < 1 ) || (!_pFuncs->AddClipPlanes) ? OK : \ 322 (*_pFuncs->AddClipPlanes)(win, pt, normal, count)) 323 /* 324 * Define and enable multiple clip planes. Plane 'n' passes through point 325 * pt[n] and is perpendicular to normal[n]. Primitives in the half space 326 * into which the 'normal' points are kept, all other primitives are clipped. 327 * 328 * 'pt' and 'normal' are given in modeling space. 329 * 330 * If passed NULL, should disable clipping. 331 */ 332 333 #define _dxf_REMOVE_CLIP_PLANES(win, count) \ 334 ((_dxd_lmHwddVersion < 1 ) || (!_pFuncs->RemoveClipPlanes) ? OK : \ 335 (*_pFuncs->RemoveClipPlanes)(win, count)) 336 /* 337 * Should set up the hardware to clip to the given object. If passed 338 * NULL, should disable clipping. 339 */ 340 341 #define _dxf_DESTROY_WINDOW(win) (*_pFuncs->DestroyWindow)(win) 342 /* 343 * Destroy specified window. 344 */ 345 346 #if defined(DX_NATIVE_WINDOWS) 347 #define _dxf_SET_OUTPUT_WINDOW(win, rgn) (*_pFuncs->SetOutputWindow)(win, rgn) 348 #else 349 #define _dxf_SET_OUTPUT_WINDOW(win, wid) (*_pFuncs->SetOutputWindow)(win, wid) 350 #endif 351 /* 352 * Direct all graphics to specified window 353 */ 354 355 #define _dxf_SET_WINDOW_SIZE(win, w, h) (*_pFuncs->SetWindowSize)(win,w,h) 356 /* 357 * Set graphics window to the specified size 358 */ 359 360 #define _dxf_INIT_RENDER_MODULE(globals) (*_pFuncs->InitRenderModule)(globals) 361 /* 362 * This routine is called once, after the graphics window has been 363 * created. It's function is loosely defined to encompass all the 364 * `first time' initialization of the target graphics API. 365 */ 366 #if defined(DX_NATIVE_WINDOWS) 367 #define _dxf_SWAP_BUFFERS(ctx) (*_pFuncs->SwapBuffers)(ctx) 368 #else 369 #define _dxf_SWAP_BUFFERS(ctx, wid) (*_pFuncs->SwapBuffers)(ctx, wid) 370 #endif 371 /* 372 * Switch front and back buffers. 373 */ 374 375 #define _dxf_SINGLE_BUFFER_MODE(ctx) (*_pFuncs->SetSingleBufferMode)(ctx) 376 /* 377 * Go into single buffer mode 378 */ 379 380 #define _dxf_DOUBLE_BUFFER_MODE(ctx) (*_pFuncs->SetDoubleBufferMode)(ctx) 381 /* 382 * Go into double buffer mode. 383 */ 384 385 #define _dxf_CLEAR_AREA(ctx, left, right, bottom, top) \ 386 (*_pFuncs->ClearArea)(ctx, left, right, bottom, top) 387 /* 388 * Clear image and zbuffer planes in specified pixel bounds. 389 */ 390 391 #define _dxf_WRITE_PIXEL_RECT(win, buf, x, y, w, h) \ 392 ((! _pFuncs->WritePixelRect)? OK : \ 393 (*_pFuncs->WritePixelRect)(win, buf, x, y, w, h)) 394 /* 395 * DXWrite pixels from software rendering buffer (SW_BUF) into the main 396 * graphics window. camw and camh are the DX camera resolutions in width 397 * and height; these may differ from the graphics window dimensions. 398 */ 399 400 #define _dxf_READ_IMAGE(win, buf) (*_pFuncs->ReadImage)(win, buf) 401 402 #define _dxf_STARTFRAME(win) (*_pFuncs->StartFrame)(win) 403 #define _dxf_ENDFRAME(win) (*_pFuncs->EndFrame)(win) 404 405 406 #define _dxf_READ_APPROX_BACKSTORE(win, camw, camh) \ 407 (*_pFuncs->ReadApproxBackstore)(win, camw, camh) 408 /* 409 * DXRead pixels from the main graphics window into the hardware saveunder 410 * buffer (SAVE_BUF). camw and camh are the DX camera resolutions in width 411 * and height; these may differ from the graphics window dimensions. 412 */ 413 414 #define _dxf_WRITE_APPROX_BACKSTORE(win, camw, camh) \ 415 (*_pFuncs->WriteApproxBackstore)(win, camw, camh) 416 /* 417 * DXWrite pixels from hardware saveunder buffer (SAVE_BUF) into the main 418 * graphics window. camw and camh are the DX camera resolutions in width 419 * and height; these may differ from the graphics window dimensions. 420 */ 421 422 #define _dxf_INIT_RENDER_PASS(win, bufferMode, zBufferMode) \ 423 (*_pFuncs->InitRenderPass)(win, bufferMode, zBufferMode) 424 /*#if defined(DX_NATIVE_WINDOWS) */ 425 #define _dxf_END_RENDER_PASS(win) (*_pFuncs->EndRenderPass)(win) 426 /* #endif */ 427 /* 428 * Clear the screen and prepare for writing a rendered image. 429 */ 430 431 #define _dxf_MAKE_PROJECTION_MATRIX(projection, width, aspect, Near, Far, M)\ 432 (*_pFuncs->MakeProjectionMatrix)(projection, width, aspect, Near, Far, M) 433 434 /* 435 * Return a projection matrix for a simple orthographic or perspective 436 * camera model (no oblique projections). This matrix projects view 437 * coordinates into a normalized projection coordinate system spanning 438 * -1..1 in X and Y. 439 * 440 * The projection parameter is 1 for perspecitve views and 0 for 441 * orthogonal views. Width is in world units for orthogonal views. 442 * For perspective views, the width parameter is the field of view 443 * expressed as the ratio of field width to eye distance, or twice the 444 * tangent of half the angle of view. Aspect is the height of the 445 * window expressed as a fraction of the window width. 446 * 447 * The near and far parameters are distances from the view coordinate 448 * origin along the line of sight. The Z clipping planes are at -near 449 * and -far since we are using a right-handed coordinate system. For 450 * perspective, near and far must be positive in order to avoid drawing 451 * objects at or behind the eyepoint depth. 452 * 453 * The near and far parameters should be mapped to whatever normalized 454 * depths are required by the target API and hardware. For example, GL 455 * programs on IBM and SGI hardware need a normalized range of -1..1 in 456 * Z, while Starbase on the HP CRX cards need a normalized range of 457 * 1..0. Perspective depth can be handled as described in 458 * Newman/Sproull Chapter 23, Equation 23-2. 459 * 460 * DX requires projection matrices with enough precision to accurately 461 * render view angles of 1/1000 of a degree. 462 * 463 * The GL and Starbase instances of this function compute the 464 * projection matrix in software, since the GL ortho() and 465 * perspective() functions are limited in precision, and there is no 466 * way to retrieve the projection matrix in Starbase. Other 467 * implementations may use whatever API calls are available subject to 468 * these requirements. 469 */ 470 471 #define _dxf_SET_ORTHO_PROJECTION(ctx, width, aspect, Near, Far) \ 472 (*_pFuncs->SetOrthoProjection)(ctx, width, aspect, Near, Far) 473 /* 474 * Set up an orthographic view projection and load it into the hardware. 475 */ 476 477 #define _dxf_SET_PERSPECTIVE_PROJECTION(ctx, xfov, aspect, Near, Far) \ 478 (*_pFuncs->SetPerspectiveProjection)(ctx, xfov, aspect, Near, Far) 479 /* 480 * Set up a perspective projection and load it into the hardware. 481 */ 482 483 #define _dxf_GET_PROJECTION(ctx, M) \ 484 ((!_pFuncs->GetProjection) ? OK : \ 485 (_pfuncs->GetProjection)(ctx, M)) 486 487 #define _dxf_SET_VIEWPORT(ctx, left, right, bottom, top) \ 488 (*_pFuncs->SetViewport)(ctx, left, right, bottom, top) 489 /* 490 * Set up viewport in pixels. 491 */ 492 493 #define _dxf_GET_MATRIX(ctx, M) \ 494 ((! _pFuncs->GetMatrix)? OK : \ 495 (*_pFuncs->GetMatrix)(ctx, M)) 496 497 #define _dxf_GET_VERSION(str) \ 498 ((!_pFuncs->GetVersion) ? 0x0 : \ 499 (*_pFuncs->GetVersion)(str)) 500 501 #define _dxf_LOAD_MATRIX(ctx, M) (*_pFuncs->LoadMatrix)(ctx,M) 502 /* 503 * Load (replace) M onto the hardware matrix stack. 504 */ 505 506 #define _dxf_PUSH_MULTIPLY_MATRIX(ctx, M) (*_pFuncs->PushMultiplyMatrix)(ctx, M) 507 /* 508 * Pushing and multiplying are combined here since some API's (such as 509 * Starbase) don't provide a separate push. 510 */ 511 512 #define _dxf_PUSH_REPLACE_MATRIX(ctx, M) (*_pFuncs->PushReplaceMatrix)(ctx,M) 513 /* 514 * Pushing and loading are combined here since some API's (such as 515 * Starbase) don't provide a separate push. 516 */ 517 518 #define _dxf_REPLACE_VIEW_MATRIX(ctx, M) \ 519 (*_pFuncs->ReplaceViewMatrix)(ctx,M) 520 /* 521 * Pushing and loading are combined here since some API's (such as 522 * Starbase) don't provide a separate push. 523 */ 524 525 #define _dxf_POP_MATRIX(ctx) (*_pFuncs->PopMatrix)(ctx) 526 /* 527 * Pop the top of the hardware matrix stack. 528 */ 529 530 #define _dxf_SET_MATERIAL_SPECULAR(ctx, r, g, b, pow) \ 531 (*_pFuncs->SetMaterialSpecular)(ctx, r, g, b, pow) 532 /* 533 * Set specular reflection coefficients for red, green, and blue; set 534 * specular exponent (shininess) from pow. 535 */ 536 537 #define _dxf_SET_GLOBAL_LIGHT_ATTRIBUTES(ctx, on) \ 538 (*_pFuncs->SetGlobalLightAttributes)(ctx, on) 539 /* 540 * Set global lighting attributes. Some API's, like IBM GL, can only 541 * set certain lighting attributes such as attenuation globally across 542 * all defined lights; these API's should do the appropriate 543 * initialization through this call. If `on' is FALSE, turn lighting 544 * completely off. 545 */ 546 547 #define _dxf_ALLOCATE_PIXEL_ARRAY(ctx, w, h) \ 548 (*_pFuncs->AllocatePixelArray)(ctx, w, h) 549 /* 550 * Allocate storage for a pixel array. 551 */ 552 553 #define _dxf_FREE_PIXEL_ARRAY(ctx, pixels) \ 554 (*_pFuncs->FreePixelArray)(ctx, pixels) 555 /* 556 * Free pixel array storage. 557 */ 558 559 #define _dxf_DEFINE_LIGHT(win, n, light) (*_pFuncs->DefineLight)(win, n, light) 560 /* 561 * Define and switch on light `id' using the attributes specified by 562 * the `light' parameter. If `light' is NULL, turn off light `id'. 563 * If more lights are defined than supported by the API, the extra 564 * lights are ignored. 565 */ 566 567 #define _dxf_SET_BACKGROUND_COLOR(ctx, color) \ 568 (*_pFuncs->SetBackgroundColor)(ctx, color) 569 /* 570 * Set the background color for the image window. 571 */ 572 573 #define _dxf_CLEARBUFFER(win) (*_pFuncs->ClearBuffer)(win) 574 575 576 #else /* OLD_PORT_LAYER_CALLS */ 577 578 int 579 _dxfBoundingBoxDraw (tdmPortHandleP portHandle, Field f, int clip_status) ; 580 581 void 582 _dxfImageDraw (tdmPortHandleP portHandle, Field f, Array p) ; 583 584 void 585 _dxfUnconnectedPointDraw (tdmPortHandleP portHandle, Field f, 586 int npoints, Point *points, 587 RGBColor *colors, RGBColor *color_map) ; 588 589 #ifndef STANDALONE 590 #ifdef PROTO_USED 591 /* 592 * can't use these prototypes until all DX primitives use 593 * ANSI style function declarations. 594 */ 595 596 int 597 _dxfCubeDraw (tdmPortHandleP portHandle, Field f, int npoints, Point *points, 598 int nshapes, int *connections, 599 int colorDepPos, RGBColor *colors, RGBColor *color_map, 600 int normalDepPos, Vector *normals, 601 int opacityDepPos, float *opacities, float *opacity_map, 602 float k_ambi, float k_diff, float k_spec) ; 603 int 604 _dxfLineDraw (tdmPortHandleP portHandle, Field f, int npoints, Point *points, 605 int nshapes, int *connections, 606 int colorDepPos, RGBColor *colors, RGBColor *color_map, 607 int normalDepPos, Vector *normals, 608 int opacityDepPos, float *opacities, float *opacity_map, 609 float k_ambi, float k_diff, float k_spec) ; 610 int 611 _dxfQmeshDraw (tdmPortHandleP portHandle, Field f, int npoints, Point *points, 612 int nshapes, int *connections, 613 int colorDepPos, RGBColor *colors, RGBColor *color_map, 614 int normalDepPos, Vector *normals, 615 int opacityDepPos, float *opacities, float *opacity_map, 616 float k_ambi, float k_diff, float k_spec) ; 617 int 618 _dxfQuadDraw (tdmPortHandleP portHandle, Field f, int npoints, Point *points, 619 int nshapes, int *connections, 620 int colorDepPos, RGBColor *colors, RGBColor *color_map, 621 int normalDepPos, Vector *normals, 622 int opacityDepPos, float *opacities, float *opacity_map, 623 float k_ambi, float k_diff, float k_spec) ; 624 int 625 _dxfTetraDraw (tdmPortHandleP portHandle, Field f, int npoints, Point *points, 626 int nshapes, int *connections, 627 int colorDepPos, RGBColor *colors, RGBColor *color_map, 628 int normalDepPos, Vector *normals, 629 int opacityDepPos, float *opacities, float *opacity_map, 630 float k_ambi, float k_diff, float k_spec) ; 631 int 632 _dxfTmeshDraw (tdmPortHandleP portHandle, Field f, int npoints, Point *points, 633 int nshapes, int *connections, 634 int colorDepend, RGBColor *colors, RGBColor *color_map, 635 int normalDepend, Vector *normals, 636 int opacityDepend, float *opacities, float *opacity_map, 637 float k_ambi, float k_diff, float k_spec) ; 638 int 639 _dxfTriDraw (tdmPortHandleP portHandle, Field f, int npoints, Point *points, 640 int nshapes, int *connections, 641 int colorDepPos, RGBColor *colors, RGBColor *color_map, 642 int normalDepPos, Vector *normals, 643 int opacityDepPos, float *opacities, float *opacity_map, 644 float k_ambi, float k_diff, float k_spec) ; 645 646 #endif /* PROTO_USED */ 647 #endif /* STANDALONE */ 648 649 Error 650 _dxf_DRAW_IMAGE(void* win, dxObject image, 651 translationO translation); 652 Error 653 _dxf_DRAW_OPAQUE(tdmPortHandleP portHandle, xfieldP xf, 654 RGBColor ambientColor, int buttonUP); 655 Error 656 _dxf_DRAW_TRANSPARENT(void * globals, RGBColor * ambientColor, int buttonUP); 657 Error 658 _dxf_DRAW_CLIP(tdmPortHandleP portHandle, xfieldP xfield, int buttonDown) ; 659 Error 660 _dxf_ADD_CLIP_PLANES(void* win, Point *pt, Vector *normal, int count); 661 Error 662 _dxf_REMOVE_CLIP_PLANES(void* win, int count); 663 int 664 _dxf_GRAPHICS_NOT_AVAILABLE (char *hostnameP) ; 665 void* 666 _dxf_CREATE_WINDOW (void *globals, char *winName, int w, int h) ; 667 translationO 668 _dxf_CREATE_HW_TRANSLATION (void *win) ; 669 void 670 _dxf_DESTROY_WINDOW (void *win) ; 671 void 672 _dxf_SET_OUTPUT_WINDOW (void *win) ; 673 void 674 _dxf_SET_WINDOW_SIZE (void *win, int w, int h) ; 675 Error 676 _dxf_INIT_RENDER_MODULE (void *globals) ; 677 void 678 _dxf_SWAP_BUFFERS (void *ctx) ; 679 void 680 _dxf_SINGLE_BUFFER_MODE (void *ctx) ; 681 void 682 _dxf_DOUBLE_BUFFER_MODE (void *ctx) ; 683 void 684 _dxf_CLEAR_AREA (void *ctx, int left, int right, int bottom, int top) ; 685 void 686 _dxf_WRITE_PIXEL_RECT (void *win, unsigned char *buf, 687 int x, int y, int w, int h) ; 688 int 689 _dxf_READ_APPROX_BACKSTORE (void *win, int camw, int camh) ; 690 void 691 _dxf_WRITE_APPROX_BACKSTORE (void *win, int camw, int camh) ; 692 void 693 _dxf_INIT_RENDER_PASS (void *win, int bufferMode, int zBufferMode) ; 694 void 695 _dxf_MAKE_PROJECTION_MATRIX (int projection, float width, float aspect, 696 float Near, float Far, register float M[4][4]) ; 697 void 698 _dxf_SET_ORTHO_PROJECTION 699 (void *ctx, float width, float aspect, float Near, float Far) ; 700 void 701 _dxf_SET_PERSPECTIVE_PROJECTION 702 (void *ctx, float xfov, float aspect, float Near, float Far) ; 703 void 704 _dxf_SET_VIEWPORT (void *ctx, int left, int right, int bottom, int top) ; 705 void 706 _dxf_LOAD_MATRIX (void *ctx, float M[4][4]) ; 707 void 708 _dxf_PUSH_MULTIPLY_MATRIX (void *ctx, float M[4][4]) ; 709 void 710 _dxf_PUSH_REPLACE_MATRIX (void *ctx, float M[4][4]) ; 711 void 712 _dxf_REPLACE_VIEW_MATRIX (void *ctx, float M[4][4]) ; 713 void 714 _dxf_POP_MATRIX (void *ctx) ; 715 void 716 _dxf_SET_MATERIAL_SPECULAR (void *ctx, float r, float g, float b, float pow) ; 717 void 718 _dxf_SET_GLOBAL_LIGHT_ATTRIBUTES (void *ctx, int on) ; 719 void * 720 _dxf_ALLOCATE_PIXEL_ARRAY (void *ctx, int width, int height) ; 721 void 722 _dxf_FREE_PIXEL_ARRAY (void *ctx, void *pixels) ; 723 int 724 _dxf_DEFINE_LIGHT (void *win, int n, Light light) ; 725 int 726 _dxf_SET_BACKGROUND_COLOR (void *ctx, RGBColor color); 727 728 #endif /* OLD_PORT_LAYER_CALLS */ 729 #endif /* STRUCTURES_ONLY */ 730 731 #endif /* tdmPortLayer_h */ 732