Comments (8)
Oh. Yeah that condition should be the opposite. Looks like I never used this function either xD Thanks for pointing these mistakes!
from godot_voxel.
There is a similar problem (I think so) on other VoxelBuffer::copy_from
. Given:
Lines 213 to 260 in 7ced53b
This line:
Line 229 in 7ced53b
Should be if (other._size == _size) {
because we can only the other VoxelBuffer::copy_from
only if the other and current one size's are equals. Even if the area_size
is equals to the destiny of the copy, we won't provide any offset, so it'll always fail.
Should I open another issue or since their are related, we can keep both here?
from godot_voxel.
Actually copy_from
without arguments can only be used if other._size == _size
AND if the area specified covers the whole block anyways.
from godot_voxel.
But what if I want to copy an area that is the same size of target buffer? It will evaluate to true
and will crash on another copy_from
, since there is the following check: ERR_FAIL_COND(other._size == _size);
Let me give an use case. Let's say I have a padded voxel buffer of size (18, 18, 18). What if I want to copy only the "original-nonpadded-area" of the buffer into another buffer of size(16, 16, 16)?
I can just call the function copy_from
as follows:
shoter_buffer->copy_from(**padded_buffer, Vector3i(buffer_padding), padded_buffer->get_size() - buffer_padding, Vector3i(), channel);
But it'll crash, because since the area_size == _size
it'll try to make a direct copy using the other copy_from
. But if we change the check to other._size == _size
it'll still do the area copy and will work fine.
from godot_voxel.
Correcting your example, should be 2*padding:
padded_buffer->get_size() - 2 * buffer_padding
Otherwise yeah sorry, what I meant is that if the two buffers have the same size AND the desired area is also that same size, then the copy_from
without area could be used. In any other case, it should continue with the area method.
from godot_voxel.
So the correct way should be:
if (area_size == _size && _other.size == _size) {
Is that so?
Also, thanks for pointing me out that error, you fixed a future bug on my voxel lighting code 😄
from godot_voxel.
Yes that check would be correct.
Good to hear :D
from godot_voxel.
Fixed in 3074f82
from godot_voxel.
Related Issues (20)
- If you set the "voxel blocky type" name to "fence" the project freezes. HOT 4
- Expose SpotNoise HOT 4
- Is it possible to have a camera only view terrain and not generate? HOT 3
- Consider using nightly.link for easier artifact downloading HOT 1
- Generate terrain from image HOT 8
- How to attach custom vertex information in smooth terrain? HOT 3
- Getting Data on Modified Voxels HOT 1
- GDExtension dumps empty type for VoxelInstanceLibraryMultiMeshItem.hide_beyond_max_lod property HOT 2
- how to get past versions? HOT 4
- Can't find file editor/editor_scale.h. HOT 2
- `VoxelStreamRegionFiles` does not load the saved data HOT 2
- `VoxelStreamSQLite` is missing chunks when loads HOT 1
- Is there a way to add compound block? HOT 1
- Godot crashes when importing .vox file HOT 8
- Can this work for Godot 4+ multiplayer open-world chunk system? HOT 12
- SDF terrain artifacts near chunk edges HOT 3
- Unexpected errors with Generator Scripts, SDF, and set_voxel_f HOT 1
- C++ Extension Generator Inheriting from VoxelGeneratorScript crashes when "reloadable = true" in .gdextension HOT 16
- Issues to compile due the change of paths of some godot files. HOT 2
- Adding non-flowing water (or other liquids) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot_voxel.