Michaël Lemaire
6521d44916
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@528 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
49 lines
1.2 KiB
C
49 lines
1.2 KiB
C
#include "preview.h"
|
|
#include "renderer.h"
|
|
|
|
#include <stdlib.h>
|
|
#include "../renderer.h"
|
|
#include "../camera.h"
|
|
|
|
struct PreviewRenderer
|
|
{
|
|
Renderer* renderer;
|
|
};
|
|
|
|
static PreviewRenderer* _createRenderer()
|
|
{
|
|
PreviewRenderer* renderer;
|
|
|
|
renderer = (PreviewRenderer*)malloc(sizeof(PreviewRenderer));
|
|
renderer->renderer = rendererCreate();
|
|
|
|
return renderer;
|
|
}
|
|
|
|
static void _deleteRenderer(PreviewRenderer* renderer)
|
|
{
|
|
rendererDelete(renderer->renderer);
|
|
free(renderer);
|
|
}
|
|
|
|
static void _setCamera(PreviewRenderer* renderer, Vector3 location, Vector3 target)
|
|
{
|
|
cameraSetLocation(renderer->renderer->render_camera, location);
|
|
cameraSetTarget(renderer->renderer->render_camera, target);
|
|
}
|
|
|
|
PreviewClass previewCreateClass(FuncPreviewCustomizeRenderer customizeRenderer, FuncPreviewBindDefinition bindDefinition, FuncPreviewGetPixelColor getPixelColor)
|
|
{
|
|
PreviewClass result;
|
|
|
|
result.createRenderer = _createRenderer;
|
|
result.deleteRenderer = _deleteRenderer;
|
|
|
|
result.setCamera = _setCamera;
|
|
|
|
result.customizeRenderer = customizeRenderer;
|
|
result.bindDefinition = bindDefinition;
|
|
result.getPixelColor = getPixelColor;
|
|
|
|
return result;
|
|
}
|