voxelman/library/voxel_surface.h

82 lines
1.5 KiB
C
Raw Normal View History

#ifndef VOXEL_SURFACE_H
#define VOXEL_SURFACE_H
#include "core/resource.h"
#include "core/color.h"
#include "core/math/rect2.h"
#include "core/vector.h"
#include "scene/resources/material.h"
#include "voxelman_library.h"
2019-11-10 02:42:31 +01:00
#include "../clutter/ground_clutter.h"
class VoxelmanLibrary;
class VoxelSurface : public Resource {
GDCLASS(VoxelSurface, Resource)
public:
2019-06-09 20:59:54 +02:00
/*
_____
/_____/I
I I I <- BACK
I F I I
I_____I/
I y
I I
O----- x I B
/ I F I /
/ z+ I ---I/
*/
enum VoxelSurfaceSides {
2019-08-11 22:28:26 +02:00
VOXEL_SIDE_TOP = 0,
VOXEL_SIDE_BOTTOM = 1,
VOXEL_SIDE_SIDE = 2,
};
2019-08-11 22:28:26 +02:00
enum {
2019-08-11 22:28:26 +02:00
VOXEL_SIDES_COUNT = 3,
VOXEL_SIDES_ARRAY_SIZE = VOXEL_SIDES_COUNT * 2,
2019-06-09 20:59:54 +02:00
};
2019-06-01 00:11:59 +02:00
int get_id() const;
void set_id(const int value);
2019-06-01 00:11:59 +02:00
bool is_transparent() const;
void set_transparent(const bool transparent);
2019-06-01 00:11:59 +02:00
Rect2 get_rect(const VoxelSurfaceSides side) const;
void set_rect(const VoxelSurfaceSides side, const Rect2 rect);
2019-11-10 02:42:31 +01:00
Ref<GroundClutter> get_clutter();
void set_clutter(Ref<GroundClutter> clutter);
2019-06-01 00:11:59 +02:00
Ref<VoxelmanLibrary> get_library() const;
void set_library(Ref<VoxelmanLibrary> library);
2019-08-11 22:28:26 +02:00
Vector2 transform_uv(const VoxelSurfaceSides side, const Vector2 uv) const;
virtual void refresh_rects();
2019-06-01 00:11:59 +02:00
VoxelSurface();
~VoxelSurface();
protected:
static void _bind_methods();
2019-08-14 00:29:28 +02:00
VoxelmanLibrary *_library;
int _id;
bool _is_transparent;
Rect2 _rects[VOXEL_SIDES_COUNT];
2019-11-10 02:42:31 +01:00
Ref<GroundClutter> _clutter;
};
2019-06-09 20:59:54 +02:00
VARIANT_ENUM_CAST(VoxelSurface::VoxelSurfaceSides);
#endif