2012-01-23 23:45:33 +00:00
|
|
|
#include "renderer.h"
|
|
|
|
#include "shared/constants.h"
|
2012-01-24 13:16:20 +00:00
|
|
|
#include "lighting.h"
|
2012-01-23 23:45:33 +00:00
|
|
|
|
2012-01-24 13:16:20 +00:00
|
|
|
RayCastingResult _RAYCASTING_NULL = {0};
|
2012-01-29 17:53:12 +00:00
|
|
|
HeightInfo _WATER_HEIGHT_INFO = {-1000000.0, -1000000.0, -1000000.0};
|
2012-01-24 13:16:20 +00:00
|
|
|
|
|
|
|
static Color _filterLight(Renderer* renderer, Color light_color, Vector3 at_location, Vector3 light_location, Vector3 direction_to_light)
|
2012-01-23 23:45:33 +00:00
|
|
|
{
|
|
|
|
return light_color;
|
|
|
|
}
|
|
|
|
|
2012-01-25 17:31:36 +00:00
|
|
|
static Color _maskLight(Renderer* renderer, Color light_color, Vector3 at_location, Vector3 light_location, Vector3 direction_to_light)
|
|
|
|
{
|
|
|
|
return light_color;
|
|
|
|
}
|
|
|
|
|
2012-01-24 13:16:20 +00:00
|
|
|
static Color _applyLightingToSurface(Renderer* renderer, Vector3 location, Vector3 normal, SurfaceMaterial material)
|
|
|
|
{
|
|
|
|
return material.base;
|
|
|
|
}
|
|
|
|
|
|
|
|
static RayCastingResult _rayWalking(Renderer* renderer, Vector3 location, Vector3 direction, int terrain, int water, int sky, int clouds)
|
|
|
|
{
|
|
|
|
return _RAYCASTING_NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static double _getTerrainHeight(Renderer* renderer, double x, double z)
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2012-01-29 17:53:12 +00:00
|
|
|
static HeightInfo _getWaterHeightInfo(Renderer* renderer)
|
|
|
|
{
|
|
|
|
return _WATER_HEIGHT_INFO;
|
|
|
|
}
|
|
|
|
|
2012-01-24 13:16:20 +00:00
|
|
|
static Color _applyTextures(Renderer* renderer, Vector3 location, double precision)
|
|
|
|
{
|
|
|
|
return COLOR_TRANSPARENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Color _applyAtmosphere(Renderer* renderer, Vector3 location, Color base)
|
|
|
|
{
|
|
|
|
return base;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Color _applyClouds(Renderer* renderer, Color base, Vector3 start, Vector3 end)
|
|
|
|
{
|
|
|
|
return base;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Vector3 _projectPoint(Renderer* renderer, Vector3 point)
|
|
|
|
{
|
|
|
|
return point;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Vector3 _unprojectPoint(Renderer* renderer, Vector3 point)
|
|
|
|
{
|
|
|
|
return point;
|
|
|
|
}
|
|
|
|
|
|
|
|
static double _getPrecision(Renderer* renderer, Vector3 location)
|
|
|
|
{
|
|
|
|
return 0.001;
|
|
|
|
}
|
|
|
|
|
2012-01-23 23:45:33 +00:00
|
|
|
Renderer rendererGetFake()
|
|
|
|
{
|
|
|
|
Renderer result;
|
|
|
|
|
|
|
|
result.render_quality = 5;
|
|
|
|
result.camera_location = VECTOR_ZERO;
|
|
|
|
|
2012-01-24 13:16:20 +00:00
|
|
|
result.filterLight = _filterLight;
|
2012-01-25 17:31:36 +00:00
|
|
|
result.maskLight = _maskLight;
|
2012-01-24 13:16:20 +00:00
|
|
|
result.applyLightingToSurface = _applyLightingToSurface;
|
|
|
|
result.rayWalking = _rayWalking;
|
|
|
|
result.getTerrainHeight = _getTerrainHeight;
|
2012-01-29 17:53:12 +00:00
|
|
|
result.getWaterHeightInfo = _getWaterHeightInfo;
|
2012-01-24 13:16:20 +00:00
|
|
|
result.applyTextures = _applyTextures;
|
|
|
|
result.applyAtmosphere = _applyAtmosphere;
|
|
|
|
result.applyClouds = _applyClouds;
|
|
|
|
result.projectPoint = _projectPoint;
|
|
|
|
result.unprojectPoint = _unprojectPoint;
|
|
|
|
result.getPrecision = _getPrecision;
|
2012-01-23 23:45:33 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|