Commits

Cliff Biffle committed abc6bdc

Renamed and recommented the data structure holding the renderer's two-dimensional point field, which used to have something to do with raycasting, but totally doesn't now.

  • Participants
  • Parent commits fbf5afc
  • Branches shaders

Comments (0)

Files changed (2)

File KVRenderer.h

 // scratch at each frame and describing only the nearest visible
 // surfaces.
 @interface KVRenderer : NSObject {
-  // The actual scene model.  Alarmingly, gcc generates suboptimal
-  // code if we use [480][640].
-  vec2f_t rays[480 * 640];
+  // A static field of points representing the imaging sensor's
+  // pixel grid.  We transform these in a vertex shader to recreate
+  // the environment.
+  vec2f_t points[480][640];
   
   // The raw RGB samples of the last color image.  These do not
   // map one-to-one onto rays because the cameras are offset.

File KVRenderer.m

 #import "utility.h"
 
 @interface KVRenderer ()
-- (void) fillStaticComponents;
+- (void) buildPointField;
 
 @property(assign, nonatomic) double rayCastingTotal;
 @property(assign, nonatomic) NSUInteger rayCastingCount;
 
 - init {
   if ((self = [super init])) {
-    [self fillStaticComponents];
+    [self buildPointField];
   }
   return self;
 }
 - (void) renderAsPointsWithOptions: (NSDictionary *) options {
   glColor3f(1, 1, 1);
   glEnableClientState(GL_VERTEX_ARRAY);
-  glVertexPointer(2, GL_FLOAT, 0, &rays);
+  glVertexPointer(2, GL_FLOAT, 0, &points);
 
   glDrawArrays(GL_POINTS, 0, 640 * 480);
   
 // corner of the image.  These values never make it to the rasterizer:
 // they are merely input to the vertex shader that performs perspective
 // correction.
-- (void) fillStaticComponents {
-  int vidx = 0;
+- (void) buildPointField {
   for (int y = 0; y < 480; y++) {
-    for (int x = 0; x < 640; x++, vidx++) {
-      rays[vidx].x = (x / 640.f);
-      rays[vidx].y = (y / 480.f);
+    for (int x = 0; x < 640; x++) {
+      points[y][x].x = (x / 640.f);
+      points[y][x].y = (y / 480.f);
     }
   }
 }