voxelman/library/voxel_surface.h

81 lines
1.4 KiB
C
Raw Normal View History

#ifndef VOXEL_SURFACE_DEFINITION_H
#define VOXEL_SURFACE_DEFINITION_H
#include "core/color.h"
#include "core/resource.h"
#include "core/vector.h"
#include "scene/resources/material.h"
#include "voxelman_library.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,
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(int value);
2019-08-11 22:28:26 +02:00
int get_atlas_x(const int side) const;
void set_atlas_x(const int side, int value);
2019-08-11 22:28:26 +02:00
int get_atlas_y(const int side) const;
void set_atlas_y(const int side, int value);
2019-06-01 00:11:59 +02:00
bool is_transparent() const;
void set_transparent(bool transparent);
String get_voxel_name() const;
void set_voxel_name(String name);
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 int side, const Vector2 uv) const;
2019-06-01 00:11:59 +02:00
VoxelSurface();
VoxelSurface(int id);
~VoxelSurface();
protected:
static void _bind_methods();
private:
2019-06-01 00:11:59 +02:00
Ref<VoxelmanLibrary> _library;
int _id;
String _name;
2019-08-11 22:28:26 +02:00
int _atlas_positions[VOXEL_SIDES_ARRAY_SIZE];
bool _is_transparent;
};
2019-06-09 20:59:54 +02:00
VARIANT_ENUM_CAST(VoxelSurface::VoxelSurfaceSides);
#endif