Changeset 755
- Timestamp:
- Apr 4, 2011, 2:05:59 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/deushax/gtk/glmapview.cpp
r686 r755 127 127 { 128 128 Ticker::Setup(FPS); 129 Video::Setup(glarea->allocation.width, glarea->allocation.height); 129 Video::Setup(vec2i(glarea->allocation.width, 130 glarea->allocation.height)); 130 131 } 131 132 -
trunk/src/debugrecord.cpp
r735 r755 35 35 private: 36 36 char const *path; 37 int width, height, fps; 37 vec2i size; 38 int fps; 38 39 #if defined USE_PIPI 39 40 pipi_sequence_t *sequence; … … 51 52 52 53 data->path = strdup(path); 53 data->width = 0; 54 data->height = 0; 54 data->size = 0; 55 55 data->fps = (int)(fps + 0.5f); 56 56 #if defined USE_PIPI … … 70 70 Entity::TickDraw(deltams); 71 71 72 int width = Video::GetWidth(); 73 int height = Video::GetHeight(); 72 vec2i size = Video::GetSize(); 74 73 75 if (data-> width != width || data->height != height)74 if (data->size != size) 76 75 { 77 data->width = width; 78 data->height = height; 76 data->size = size; 79 77 80 78 #if defined USE_PIPI … … 82 80 pipi_close_sequence(data->sequence); 83 81 84 data->sequence = pipi_open_sequence(data->path, width, height,82 data->sequence = pipi_open_sequence(data->path, size.x, size.y, 85 83 1 /* RGB */, data->fps, 86 84 1, 1, 60 * 1024 * 1024); … … 91 89 if (data->sequence) 92 90 { 93 uint32_t *buffer = new uint32_t[ width * height];91 uint32_t *buffer = new uint32_t[size.x * size.y]; 94 92 Video::Capture(buffer); 95 pipi_feed_sequence(data->sequence, (uint8_t *)buffer, width, height);93 pipi_feed_sequence(data->sequence, (uint8_t *)buffer, size.x, size.y); 96 94 delete[] buffer; 97 95 } -
trunk/src/eglapp.cpp
r745 r755 150 150 /* Initialise everything */ 151 151 Ticker::Setup(fps); 152 Video::Setup( gwa.width, gwa.height);152 Video::Setup(vec2i(gwa.width, gwa.height)); 153 153 Audio::Setup(2); 154 154 #endif -
trunk/src/sdlapp.cpp
r734 r755 65 65 /* Initialise everything */ 66 66 Ticker::Setup(fps); 67 Video::Setup(v ideo->w, video->h);67 Video::Setup(vec2i(video->w, video->h)); 68 68 Audio::Setup(2); 69 69 #endif -
trunk/src/sdlinput.cpp
r686 r755 56 56 { 57 57 SDL_GetMouseState(&mouse.x, &mouse.y); 58 mouse.y = Video::Get Height()- 1 - mouse.y;58 mouse.y = Video::GetSize().y - 1 - mouse.y; 59 59 } 60 60 else -
trunk/src/video.cpp
r753 r755 97 97 " float t3 = mod(3.0 * dx3 + 2.0 * dy3, 4.0);\n" 98 98 " float t1 = (1.0 + 16.0 * t1 + 4.0 * t2 + t3) / 65.0;\n" 99 " float t2 = t1; 100 " float t3 = t1; 99 " float t2 = t1;\n" 100 " float t3 = t1;\n" 101 101 #else 102 102 " float rand = sin(gl_FragCoord.x * 1.23456) * 123.456\n" … … 123 123 */ 124 124 125 void Video::Setup( int width, int height)125 void Video::Setup(vec2i size) 126 126 { 127 127 /* Initialise OpenGL */ 128 glViewport(0, 0, width, height);129 130 #if defined ANDROID_NDK 131 saved_viewport = vec2i( width, height);128 glViewport(0, 0, size.x, size.y); 129 130 #if defined ANDROID_NDK 131 saved_viewport = vec2i(size.x, size.y); 132 132 #endif 133 133 … … 149 149 mat4 proj; 150 150 151 float width = GetWidth(); 152 float height = GetHeight(); 153 float near = -width - height; 154 float far = width + height; 155 156 #if defined ANDROID_NDK 157 width = 640.0f; 158 height = 480.0f; 151 vec2 size = GetSize(); 152 float near = -size.x - size.y; 153 float far = size.x + size.y; 154 155 #if defined ANDROID_NDK 156 size = vec(640.0f, 480.0f); 159 157 #endif 160 158 … … 163 161 { 164 162 /* The easy way: purely orthogonal projection. */ 165 proj_matrix = mat4::ortho(0, width, 0, height, near, far);163 proj_matrix = mat4::ortho(0, size.x, 0, size.y, near, far); 166 164 } 167 165 else … … 171 169 * the screen. */ 172 170 float t1 = tanf(theta / 2); 173 float t2 = t1 * height / width;174 float dist = (float)width/ (2.0f * t1);171 float t2 = t1 * size.y / size.y; 172 float dist = size.x / (2.0f * t1); 175 173 176 174 near += dist; … … 185 183 proj_matrix = mat4::frustum(-near * t1, near * t1, 186 184 -near * t2, near * t2, near, far) 187 * mat4::translate(-0.5f * width, -0.5f * height, -dist);185 * mat4::translate(-0.5f * size.x, -0.5f * size.y, -dist); 188 186 } 189 187 … … 208 206 void Video::Clear() 209 207 { 210 glViewport(0, 0, GetWidth(), GetHeight()); 208 vec2i size = GetSize(); 209 glViewport(0, 0, size.x, size.y); 211 210 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 212 211 … … 256 255 } 257 256 258 int Video::GetWidth()259 {260 return GetSize().x;261 }262 263 int Video::GetHeight()264 {265 return GetSize().y;266 }267 268 257 } /* namespace lol */ 269 258 -
trunk/src/video.h
r753 r755 26 26 { 27 27 public: 28 static void Setup( int width, int height);28 static void Setup(vec2i size); 29 29 static void Destroy(); 30 30 static void SetFov(float theta); … … 33 33 static void Capture(uint32_t *buffer); 34 34 static vec2i GetSize(); 35 static int GetWidth();36 static int GetHeight();37 35 }; 38 36
Note: See TracChangeset
for help on using the changeset viewer.