home dev games gallery work
Lewpen.com»Research & Development»3D Graphics»OpenGL»Reflective Sphere

Reflective Sphere

Analytical reflections in OpenGL

/ Source / common / 001 / radialobject.h

/*

  RADIALOBJECT

  A radial object is a 3d object with a defined distance from the origin for any directional vector
  They are also animated, with a time parameter


  The function to define a radial object returns a distance given a directional vector and the time


  The surface is rendered by dividing the surfaces of a cube into a grid of res x res squares
  and moving the points radially to the surface of the object



  Tetra and TetraStar are currently rubbish, maybe aligning them differently with the axes will help

*/










#ifndef __RADIALOBJECT_H__
#define __RADIALOBJECT_H__





//---- GET_RADIALOBJECT_DISTANCE

//  Generic function to define a radial object

typedef double (*GET_RADIALOBJECT_DISTANCE)( double, double, double, double );





//---- RADIALOBJECT FUNCTIONS

double getRadialObjectDistanceCube  ( double x, double y, double z, double time );
double getRadialObjectDistanceSphere( double x, double y, double z, double time );
double getRadialObjectDistanceBlob  ( double x, double y, double z, double time );

double getRadialObjectDistanceZNPill( double x, double y, double z, double time );

double getRadialObjectDistanceTetra ( double x, double y, double z, double time );
double getRadialObjectDistanceTetraStar( double x, double y, double z, double time );






//  Alternates through the radial objects above

double getRadialObjectDistanceAlternating( double x, double y, double z, double time );





//---- RENDERING FUNCTIONS

#define RADIALOBJECT_MAXRES 64

extern int radialObject_res;  //  Each face of the cubic surface is divided into res x res squares

void drawRadialObject( double time, GET_RADIALOBJECT_DISTANCE thing_fn );








#endif
Related Articles

Procedural city block layout

Animated 4-dimensional objects mapped down to 3D

Simulating a cloth falling and slipping over objects

Windows C++ OpenGL example

Games

The Dodge Game
Flatspace

2-Player Games:

Quake 2D
Meteora

Puzzle Games:

Mini Tetris
Sudoku Solver

Development

3D Graphics:

3D Graphics Articles
WebGL Examples
OpenGL Examples
Flash 3D Engine
Java 3D Engine

Development:

Programming Articles
Game Development Examples

Work

Portfolio
Clients
Startups & Projects
Expertise

Links

CubeLogix Studios
PHP Charts & Graphs
Local Legends Football