Skip to content

Commit

Permalink
Updates for Max 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy Place committed Dec 11, 2018
1 parent 39c4943 commit db981c5
Show file tree
Hide file tree
Showing 42 changed files with 2,841 additions and 530 deletions.
28 changes: 0 additions & 28 deletions source/c74support/jit-includes/jit.agl.h

This file was deleted.

37 changes: 0 additions & 37 deletions source/c74support/jit-includes/jit.altivec.h

This file was deleted.

6 changes: 5 additions & 1 deletion source/c74support/jit-includes/jit.common.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ t_jit_err jit_attr_user_touch(void *x, t_symbol *s);
t_jit_err jit_attr_user_touch_parse(void *x, char *attrnames);
t_jit_err jit_object_addattr(void *x, t_object *attr);
t_jit_err jit_object_deleteattr(void *x, t_symbol *attrname);


void jit_attr_cleanall(t_object *x);
void jit_attr_clean(t_object *x, t_symbol *name);

//more util functions
void jit_rand_setseed(long n);
Expand All @@ -279,6 +281,8 @@ void jit_error_code(void *x,t_jit_err v); //interrupt safe
void jit_error_sym(void *x,t_symbol *s); //interrupt safe
void jit_post_sym(void *x,t_symbol *s); //interrupt safe

t_jit_err jit_err_from_max_err(t_max_err err);

//load test

#ifdef __APPLE_CC__
Expand Down
4 changes: 3 additions & 1 deletion source/c74support/jit-includes/jit.gl.cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#ifndef JIT_GL_MESH_CACHE_H
#define JIT_GL_MESH_CACHE_H

#include "jit.gl.h"

/*************************************************************************/

#ifdef __cplusplus
Expand Down Expand Up @@ -54,7 +56,7 @@ typedef struct _jit_gl_cache {
long stride; // stride length between elements
long start; // start index
long end; // end index
long mode; // cache mode (STATIC/DYNAMIC)
//long mode; // cache mode (STATIC/DYNAMIC)
long used; // used flag
long update; // update flag
long capacity; // allocated element count
Expand Down
198 changes: 198 additions & 0 deletions source/c74support/jit-includes/jit.gl.common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
#ifndef _JIT_GL_COMMON_H_
#define _JIT_GL_COMMON_H_

#include "jit.common.h"

#ifdef __cplusplus
extern "C" {
#endif

#if C74_PRAGMA_STRUCT_PACKPUSH
#pragma pack(push, 2)
#elif C74_PRAGMA_STRUCT_PACK
#pragma pack(2)
#endif



// constants
#define JIT_GL_RENDER_REG_STR "jit_r3nd3r_"
#define JIT_CLASS3D_FINDER "this_is_the_jit_class3d"

#define JIT_GL_MAX_TEXTUREUNITS 32

#ifndef PI
#define PI 3.141592653589793
#endif

// layer defines
#define JIT_GL_LAYER_FIRST -1000
#define JIT_GL_LAYER_DEFAULT 0
#define JIT_GL_LAYER_LAST 1000

// animator update priority flags
#define JIT_ANIMATOR_PRIORITY_FIRST -1000
#define JIT_ANIMATOR_PRIORITY_DEF 0
#define JIT_ANIMATOR_PRIORITY_PASS2 1000 // updated *after* nodes are updated

// default animator mouse-ui priority
#define JIT_ANIM_UIP_FIRST -1000
#define JIT_ANIM_UIP_CORNERPIN -900 // gl.cornerpin
#define JIT_ANIM_UIP_PHYS -800 // phys.picker
#define JIT_ANIM_UIP_HANDLE -700 // gl.handle
#define JIT_ANIM_UIP_DEFAULT 0
#define JIT_ANIM_UIP_ADRIVE 900 // anim.drive
#define JIT_ANIM_UIP_LAST 1000

#define JIT_GL_MAX_PICK_FILTERS 10



// ob3d stuff
// flags -- default: all flags off.

#define JIT_OB3D_NO_ROTATION_SCALE 1 << 0 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_NO_POLY_VARS 1 << 1 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_NO_BLEND 1 << 2 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_NO_TEXTURE 1 << 3 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_NO_MATRIXOUTPUT 1 << 4 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_AUTO_ONLY 1 << 5 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_DOES_UI 1 << 6 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_NO_DEPTH 1 << 7 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_NO_ANTIALIAS 1 << 8 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_NO_FOG 1 << 9 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_NO_LIGHTING_MATERIAL 1 << 10 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_HAS_LIGHTS 1 << 11 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_HAS_CAMERA 1 << 12 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_IS_RENDERER 1 << 13 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_NO_COLOR 1 << 14 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_IS_SLAB 1 << 15 ///< ob3d flag @ingroup jitter
#define JIT_OB3D_NO_SHADER 1 << 16
#define JIT_OB3D_IS_NODE 1 << 17
#define JIT_OB3D_IS_CAMERA 1 << 18
#define JIT_OB3D_NO_BOUNDS 1 << 19
#define JIT_OB3D_NO_POSITION 1 << 20



typedef long t_jit_gl_context_modifier;
#define JIT_GL_VIEW_COMMAND_KEY (1<<0)
#define JIT_GL_VIEW_SHIFT_KEY (1<<1)
#define JIT_GL_VIEW_CAPS_LOCK (1<<2)
#define JIT_GL_VIEW_ALT_KEY (1<<3)
#define JIT_GL_VIEW_CONTROL_KEY (1<<4)



extern t_symbol *_jit_glengine;



void max_ob3d_setup(void); // legacy api
void max_jit_class_ob3d_wrap(t_class *c); // newer api

// attach jit object bearing an ob3d to a max object and its outlet.
void max_jit_ob3d_attach(void *x, t_jit_object *jit_ob, void *outlet);
void max_jit_ob3d_detach(void *x);
t_jit_err max_jit_ob3d_assist(void *x, void *b, long m, long a, char *s);
t_atom_long max_jit_ob3d_acceptsdrag(void *x, t_object *drag, t_object *view);
void max_jit_ob3d_seterrorob(void *x);
void* max_jit_ob3d_geterrorob();


/**
* t_wind_mouse_info_struct provided by jit.window and jit.pwindow mouse events
*
*/
typedef struct {
t_atom mouseatoms[8]; ///< h, v, (up/down), cmdKey, shiftKey, alphaLock, option, control.
int argc; ///< argument count
t_symbol *mousesymbol; ///< mouse event type
} t_wind_mouse_info;

typedef struct {
t_atom mouseatoms[16]; ///< h, v, (up/down), cmdKey, shiftKey, alphaLock, option, control, dx, dy + RFU
int argc; ///< argument count
t_symbol *mousesymbol; ///< mouse event type
} t_wind_mousewheel_info;

typedef struct {
t_atom keyatoms[8]; ///< keycode, textcharacter, (up/down), cmdKey, shiftKey, alphaLock, option, control.
int argc; ///< argument count
t_symbol *keysymbol; ///< key event type
} t_wind_key_info;



// --------------------------------------------------------------------------------
// geometry stuff

/** 2D point (GLfloat) */
typedef float t_point_2d[2];
/** 3D point (GLfloat) */
typedef float t_point_3d[3];
/** 3D vector (GLfloat) */
typedef float t_vec_3d[3];
/** 4D quaternion (GLfloat). Used for rotation */
typedef float t_quaternion[4];
/** 4D angle/axis rotation vector (GLfloat) */
typedef float t_rotation[4];
/** RGBA color vector (GLfloat) */
typedef float t_color[4];

/** Line or line segment in 3D space (GLfloat) */
typedef struct {
float u[3]; ///< starting point
float v[3]; ///< ending point
} t_line_3d; // line or line segment

typedef struct {
t_symbol *colormode; ///< texture colormode
t_symbol *type; ///< texture data type (char, float32, ...)
int dim[3]; ///< texture dimensions
int dimcount; ///< number of texture dimensions
} t_jit_gl_texture_info;



typedef struct _jit_pt {
long x;
long y;
} t_jit_pt;

typedef struct _jit_rect {
long x;
long y;
long width;
long height;
} t_jit_rect;



#ifdef MAC_VERSION

typedef void* t_jit_gl_native_window; // NWWindow *
typedef CGDirectDisplayID t_jit_gl_native_device; // Defines a reference to a list of graphics devices.
typedef void* t_jit_gl_native_drawable; // NSView *
typedef void* t_jit_gl_native_context; // NSOpenGLContext *
typedef void* t_jit_gl_native_pixelformat; // NSOpenGLPixelFormat *

#else



#endif

extern t_symbol *ps_draw, *ps_get_state, *ps_matrixoutput, *ps_get_geometry, *ps_boundcalc, *ps_calcbounds;

#if C74_PRAGMA_STRUCT_PACKPUSH
#pragma pack(pop)
#elif C74_PRAGMA_STRUCT_PACK
#pragma pack()
#endif

#ifdef __cplusplus
}
#endif

#endif
52 changes: 12 additions & 40 deletions source/c74support/jit-includes/jit.gl.context.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
/****************************************************************************/

#include "jit.gl.h"
#include "jit.gl.procs.h"
#if defined(WIN_VERSION) || !defined(GL3_VERSION)
#define JIT_GL_USE_PROCS 1
#endif
#ifdef JIT_GL_USE_PROCS
#include "jit.gl.procs.h"
#endif
#include "jit.gl.support.h"
#include "jit.gl.pixelformat.h"

Expand All @@ -20,60 +25,26 @@ extern "C" {
#pragma pack(2)
#endif

/****************************************************************************/

#ifdef MAC_VERSION
#ifdef JIT_GL_AGL
typedef WindowRef t_jit_gl_native_window;
typedef AGLDevice t_jit_gl_native_device; // Defines a reference to a list of graphics devices.
typedef AGLDrawable t_jit_gl_native_drawable; // Defines an opaque data type that represents a Carbon window.
typedef AGLContext t_jit_gl_native_context; // Represents a pointer to an opaque AGL context object
typedef AGLPixelFormat t_jit_gl_native_pixelformat; // Represents a pointer to an opaque pixel format object.
#endif
#ifdef JIT_GL_NSGL
typedef void* t_jit_gl_native_window; // NWWindow *
typedef CGDirectDisplayID t_jit_gl_native_device; // Defines a reference to a list of graphics devices.
typedef void* t_jit_gl_native_drawable; // NSView *
typedef void* t_jit_gl_native_context; // NSOpenGLContext *
typedef void* t_jit_gl_native_pixelformat; // NSOpenGLPixelFormat *
#endif
#endif

#ifdef WIN_VERSION
/*
Key object types:
HDC - a handle to a device independent graphics context (screen, printer, memory, etc.). HDC
conflates the AGLDevice and AGLDrawable concepts.
HGLRC - a handle to an opengl rendering context. Equivalent to an AGLContext.
*/
typedef HWND t_jit_gl_native_window;
typedef HDC t_jit_gl_native_device;
typedef HDC t_jit_gl_native_drawable;
typedef HGLRC t_jit_gl_native_context;
typedef GLint* t_jit_gl_native_pixelformat;

typedef struct _jit_gl_platform_data {
PROC set_swap_interval;
} t_jit_gl_platform_data;
#endif

/****************************************************************************/

typedef struct _jit_gl_context_struct
{
t_jit_gl_native_context context;
t_jit_gl_native_device device;
t_jit_gl_native_pixelformat pixelformat;
t_jit_gl_native_pixelformat pixelformat;
#ifdef JIT_GL_USE_PROCS
t_jit_gl_extprocs *procs; // proc table for opengl extensions
#endif
t_jit_gl_support *support; // opengl feature support
const char *extensions; // opengl extensions string
void *target;
long targettype; // window/pwindow/matrix/other
long renderer_id; // mac only
long flags;
void *auxdata;
void *offscreentex;
void *offscreenfbo;
#ifdef WIN_VERSION
t_jit_gl_platform_data platform_data;
#endif
Expand All @@ -86,6 +57,7 @@ typedef struct _jit_gl_context_info
long renderer_id; //mac only
t_jit_gl_context share;
t_jit_gl_pixelformat *pixelformat;
void *nativewin;
} t_jit_gl_context_info;


Expand Down
Loading

0 comments on commit db981c5

Please sign in to comment.