Fixed mac compatability
This commit is contained in:
12
src/Map.cpp
12
src/Map.cpp
@@ -86,13 +86,13 @@ uint64_t Map::generate_children(sf::Vector3i pos, int dim) {
|
||||
// The 8 subvoxel coords starting from the 1th direction, the direction of the origin of the 3d grid
|
||||
// XY, Z++, XY
|
||||
std::vector<sf::Vector3i> v = {
|
||||
sf::Vector3i(pos.x, pos.y, pos.z),
|
||||
sf::Vector3i(pos.x + dim, pos.y, pos.z),
|
||||
sf::Vector3i(pos.x, pos.y + dim, pos.z),
|
||||
sf::Vector3i(pos.x , pos.y , pos.z),
|
||||
sf::Vector3i(pos.x + dim, pos.y , pos.z),
|
||||
sf::Vector3i(pos.x , pos.y + dim, pos.z),
|
||||
sf::Vector3i(pos.x + dim, pos.y + dim, pos.z),
|
||||
sf::Vector3i(pos.x, pos.y, pos.z + dim),
|
||||
sf::Vector3i(pos.x + dim, pos.y, pos.z + dim),
|
||||
sf::Vector3i(pos.x, pos.y + dim, pos.z + dim),
|
||||
sf::Vector3i(pos.x , pos.y , pos.z + dim),
|
||||
sf::Vector3i(pos.x + dim, pos.y , pos.z + dim),
|
||||
sf::Vector3i(pos.x , pos.y + dim, pos.z + dim),
|
||||
sf::Vector3i(pos.x + dim, pos.y + dim, pos.z + dim)
|
||||
};
|
||||
|
||||
|
||||
@@ -68,7 +68,11 @@ sf::Texture window_texture;
|
||||
// Y: 1.57 is straight down
|
||||
|
||||
|
||||
|
||||
// TODO:
|
||||
// - Texture axis sign flipping issue
|
||||
// - Diffuse fog hard cut off
|
||||
// - Infinite light distance, no inverse square
|
||||
// - Inconsistent lighting constants. GUI manipulation
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
@@ -99,10 +99,9 @@ void Hardware_Caster::validate()
|
||||
|
||||
void Hardware_Caster::create_texture_atlas(sf::Texture *t, sf::Vector2i tile_dim) {
|
||||
|
||||
create_image_buffer("texture_atlas", t->getSize().y * t->getSize().x * 4 * sizeof(float), t);
|
||||
create_image_buffer("texture_atlas", t->getSize().x * t->getSize().x * 4 * sizeof(float), t, CL_MEM_READ_ONLY);
|
||||
|
||||
// create_buffer observes arg 3's
|
||||
|
||||
sf::Vector2u v = t->getSize();
|
||||
create_buffer("atlas_dim", sizeof(sf::Vector2u) , &v);
|
||||
|
||||
@@ -191,7 +190,7 @@ void Hardware_Caster::create_viewport(int width, int height, float v_fov, float
|
||||
viewport_sprite.setTexture(viewport_texture);
|
||||
|
||||
// Pass the buffer to opencl
|
||||
create_image_buffer("image", sizeof(sf::Uint8) * width * height * 4, &viewport_texture);
|
||||
create_image_buffer("image", sizeof(sf::Uint8) * width * height * 4, &viewport_texture, CL_MEM_WRITE_ONLY);
|
||||
|
||||
}
|
||||
|
||||
@@ -533,7 +532,7 @@ int Hardware_Caster::set_kernel_arg(
|
||||
|
||||
}
|
||||
|
||||
int Hardware_Caster::create_image_buffer(std::string buffer_name, cl_uint size, sf::Texture* texture) {
|
||||
int Hardware_Caster::create_image_buffer(std::string buffer_name, cl_uint size, sf::Texture* texture, cl_int access_type) {
|
||||
|
||||
// I can imagine overwriting buffers will be common, so I think
|
||||
// this is safe to overwrite / release old buffers quietly
|
||||
@@ -543,7 +542,7 @@ int Hardware_Caster::create_image_buffer(std::string buffer_name, cl_uint size,
|
||||
|
||||
int error;
|
||||
cl_mem buff = clCreateFromGLTexture(
|
||||
getContext(), CL_MEM_WRITE_ONLY, GL_TEXTURE_2D,
|
||||
getContext(), access_type, GL_TEXTURE_2D,
|
||||
0, texture->getNativeHandle(), &error);
|
||||
|
||||
if (assert(error, "clCreateFromGLTexture"))
|
||||
|
||||
Reference in New Issue
Block a user