newWave.h 3.12 KB
Newer Older
tigital's avatar
tigital committed
1
2
3
4
5
6
7
/*
 *  GEM - Graphics Environment for Multimedia
 *
 *  newWave.h
 *  gem_darwin
 *
 *  Created by Jamie Tittle on Thu Oct 10 2002.
tigital's avatar
tigital committed
8
 *  Copyright (c) 2002 tigital. All rights reserved.
tigital's avatar
tigital committed
9
10
11
12
13
14
 *    For information on usage and redistribution, and for a DISCLAIMER OF ALL
 *    WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
 *
 */
#ifndef INCLUDE_NEWWAVE_H_
#define INCLUDE_NEWWAVE_H_
dheck's avatar
dheck committed
15
16
17
18
19

// I hate Microsoft...I shouldn't have to do this!
#ifdef _WINDOWS
#include <windows.h>
#endif
tigital's avatar
tigital committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

#ifdef MACOSX
#include <OpenGL/glu.h>
#else
#include <GL/glu.h>
#endif MACOSX

#include "Base/GemShape.h"
#define MAXGRID 63

/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
    newWave
    
    based on the SGI demo New Wave

KEYWORDS
    geo
    
DESCRIPTION

-----------------------------------------------------------------*/
class GEM_EXTERN newWave : public GemShape
{
  CPPEXTERN_HEADER(newWave, GemShape)

    public:

  //////////
  // Constructor
  newWave( t_floatarg width, t_floatarg height);
    	
 protected:
    	
  //////////
  // Destructor
  virtual ~newWave();

  //////////
  // The height of the object
61
  short		size, mode, speed;
tigital's avatar
tigital committed
62
  void	    	heightMess(float size);
63
64
65
  void		modeMess(float mode);
  void		speedMess(float speed);
  //void		otherMess(float other);        
tigital's avatar
tigital committed
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  //////////
  // Do the rendering
  virtual void 	render(GemState *state);
  
    	//////////
    	// How the object should be drawn
    	virtual void	typeMess(t_symbol *type);
		
    	//////////
    	// The height of the object
        GLfloat	    	m_height;

        //////////
        // The height inlet
        t_inlet         *m_inletH;
81
82
83
        t_inlet		*inletM;
        t_inlet		*inletSp;
        //t_inlet		*inletOt;
tigital's avatar
tigital committed
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
  
  //////////
  // getStuff
  void		getforce(void);
  void 		getvelocity(void);
  void 		getposition(void);
  void		getTexCoords(void);
  void		setSize( int value );
  void		setSpeed( int value );

  void copy( float vec0[3], float vec1[3]);
  void sub(float vec0[3], float vec1[3], float vec2[3]);
  void add(float vec0[3], float vec1[3], float vec2[3]);
  void scalDiv(float vec[3], float c);
  void cross(float vec0[3], float vec1[3], float vec2[3]);
  void norm(float vec[3]);
  void set(float vec[3], float x, float y, float z);
  void reset( int value );
  void setOther( int value );
  
  void getFaceNorms( void );
  void getVertNorms( void );
  void getFaceNormSegs( void );
  
  int 		m_size;
  int		m_speed;
tigital's avatar
tigital committed
110
  int		m_blend;
111
  float		xsize, ysize;
tigital's avatar
tigital committed
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
  
  float force[MAXGRID][MAXGRID],
      veloc[MAXGRID][MAXGRID],
      posit[MAXGRID][MAXGRID],
      vertNorms[MAXGRID][MAXGRID][3],
      faceNorms[2][MAXGRID][MAXGRID][3],
      faceNormSegs[2][2][MAXGRID][MAXGRID][3];
  int alreadyInit;
  float texCoords[MAXGRID][MAXGRID][2];

 private:

  //////////
  // static member functions
  static void 	heightMessCallback(void *data, t_floatarg size);
127
128
  static void 	modeMessCallback(void *data, t_floatarg mode);
  static void 	speedMessCallback(void *data, t_floatarg speed);
tigital's avatar
tigital committed
129
  static void 	blendMessCallback(void *data, t_floatarg size);
tigital's avatar
tigital committed
130
131
132
};

#endif	// for header file