Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package goxel for openSUSE:Factory checked in at 2021-12-16 21:19:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/goxel (Old) and /work/SRC/openSUSE:Factory/.goxel.new.2520 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "goxel" Thu Dec 16 21:19:34 2021 rev:4 rq:940798 version:0.10.8 Changes: -------- --- /work/SRC/openSUSE:Factory/goxel/goxel.changes 2021-02-21 22:14:59.054141926 +0100 +++ /work/SRC/openSUSE:Factory/.goxel.new.2520/goxel.changes 2021-12-16 21:20:29.526548176 +0100 @@ -1,0 +2,6 @@ +Mon Dec 13 15:00:29 UTC 2021 - Tuukka Pasanen <tuukka.pasa...@ilmi.fi> + +- Update to 0.10.8 + * Only minor changes and bug fix. + +------------------------------------------------------------------- Old: ---- goxel-0.10.7.tar.gz New: ---- goxel-0.10.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ goxel.spec ++++++ --- /var/tmp/diff_new_pack.qXu9bP/_old 2021-12-16 21:20:29.950548337 +0100 +++ /var/tmp/diff_new_pack.qXu9bP/_new 2021-12-16 21:20:29.954548338 +0100 @@ -17,7 +17,7 @@ Name: goxel -Version: 0.10.7 +Version: 0.10.8 Release: 0 Summary: Voxel graphics editor License: GPL-3.0-only ++++++ goxel-0.10.7.tar.gz -> goxel-0.10.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/Makefile new/goxel-0.10.8/Makefile --- old/goxel-0.10.7/Makefile 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/Makefile 2021-08-09 08:47:27.000000000 +0200 @@ -37,7 +37,7 @@ .PHONY: install install: - install -Dm744 goxel $(DESTDIR)$(PREFIX)/bin/goxel + install -Dm755 goxel $(DESTDIR)$(PREFIX)/bin/goxel for size in 16 24 32 48 64 128 256; do install -Dm644 data/icons/icon$${size}.png \ $$(printf '%s%s' $(DESTDIR)$(PREFIX)/share/icons/hicolor/ \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/README.md new/goxel-0.10.8/README.md --- old/goxel-0.10.7/README.md 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/README.md 2021-08-09 08:47:27.000000000 +0200 @@ -2,7 +2,7 @@ Goxel ===== -Version 0.10.6 +Version 0.10.7 By Guillaume Chereau <guilla...@noctua-software.com> @@ -73,8 +73,10 @@ -------- The building system uses scons. You can compile in debug with 'scons', and in -release with 'scons mode=release'. On Windows, I only tried to build with -msys2. The code is in C99, using some gnu extensions, so it does not compile +release with 'scons mode=release'. On Windows, currently possible to build +with [msys2](https://www.msys2.org/) or try prebuilt +[goxel](https://packages.msys2.org/base/mingw-w64-goxel) package directly. +The code is in C99, using some gnu extensions, so it does not compile with msvc. # Linux/BSD diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/doc/cla/individual/black-cat.md new/goxel-0.10.8/doc/cla/individual/black-cat.md --- old/goxel-0.10.7/doc/cla/individual/black-cat.md 1970-01-01 01:00:00.000000000 +0100 +++ new/goxel-0.10.8/doc/cla/individual/black-cat.md 2021-08-09 08:47:27.000000000 +0200 @@ -0,0 +1,11 @@ +Russia, 2020-01-24 + +I hereby agree to the terms of the Goxel Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Artem Buryachenko iblackc...@gmail.com https://github.com/Black-Cat diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/doc/cla/individual/mailaender.md new/goxel-0.10.8/doc/cla/individual/mailaender.md --- old/goxel-0.10.7/doc/cla/individual/mailaender.md 1970-01-01 01:00:00.000000000 +0100 +++ new/goxel-0.10.8/doc/cla/individual/mailaender.md 2021-08-09 08:47:27.000000000 +0200 @@ -0,0 +1,11 @@ +Germany, 2021-02-21 + +I hereby agree to the terms of the Goxel Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Matthias Mail??nder matth...@mailaender.name https://github.com/Mailaender diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/doc/cla/individual/podsvirov.md new/goxel-0.10.8/doc/cla/individual/podsvirov.md --- old/goxel-0.10.7/doc/cla/individual/podsvirov.md 1970-01-01 01:00:00.000000000 +0100 +++ new/goxel-0.10.8/doc/cla/individual/podsvirov.md 2021-08-09 08:47:27.000000000 +0200 @@ -0,0 +1,11 @@ +Russia, 2021-04-26 + +I hereby agree to the terms of the Goxel Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Konstantin Podsvirov konstan...@podsvirov.pro https://github.com/podsvirov diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/doc/cla/individual/ravencgg.md new/goxel-0.10.8/doc/cla/individual/ravencgg.md --- old/goxel-0.10.7/doc/cla/individual/ravencgg.md 1970-01-01 01:00:00.000000000 +0100 +++ new/goxel-0.10.8/doc/cla/individual/ravencgg.md 2021-08-09 08:47:27.000000000 +0200 @@ -0,0 +1,11 @@ +United States, 2021-06-04 + +I hereby agree to the terms of the Goxel Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Chris Genova raven....@gmail.com https://github.com/ravencgg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/ext_src/noc/noc_file_dialog.h new/goxel-0.10.8/ext_src/noc/noc_file_dialog.h --- old/goxel-0.10.7/ext_src/noc/noc_file_dialog.h 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/ext_src/noc/noc_file_dialog.h 2021-08-09 08:47:27.000000000 +0200 @@ -101,6 +101,7 @@ if (flags & NOC_FILE_DIALOG_DIR) action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; + gtk_disable_setlocale(); gtk_init_check(NULL, NULL); dialog = gtk_file_chooser_dialog_new( flags & NOC_FILE_DIALOG_SAVE ? "Save File" : "Open File", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/ext_src/yocto/ext/tinyexr.h new/goxel-0.10.8/ext_src/yocto/ext/tinyexr.h --- old/goxel-0.10.7/ext_src/yocto/ext/tinyexr.h 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/ext_src/yocto/ext/tinyexr.h 2021-08-09 08:47:27.000000000 +0200 @@ -7150,7 +7150,7 @@ unsigned char pad[3]; } ChannelInfo; -typedef struct { +typedef struct HeaderInfo_t { std::vector<tinyexr::ChannelInfo> channels; std::vector<EXRAttribute> attributes; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/osx/goxel/goxel/AppDelegate.swift new/goxel-0.10.8/osx/goxel/goxel/AppDelegate.swift --- old/goxel-0.10.7/osx/goxel/goxel/AppDelegate.swift 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/osx/goxel/goxel/AppDelegate.swift 2021-08-09 08:47:27.000000000 +0200 @@ -26,7 +26,7 @@ } } -class GoxNSOpenGLView: NSOpenGLView { +class GoxNSOpenGLView: NSOpenGLView, NSWindowDelegate { override func awakeFromNib() { let attr = [ @@ -47,6 +47,7 @@ self.openGLContext = context self.openGLContext?.makeCurrentContext() self.window?.acceptsMouseMovedEvents = true + self.window?.delegate = self } func appDelegate () -> AppDelegate @@ -184,6 +185,11 @@ appDelegate().inputs.keys.340 = event.modifierFlags.contains(.shift) appDelegate().inputs.keys.341 = event.modifierFlags.contains(.command) } + + func windowShouldClose(_ sender: NSWindow) -> Bool { + gui_query_quit() + return false + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/osx/goxel/goxel.xcodeproj/project.pbxproj new/goxel-0.10.8/osx/goxel/goxel.xcodeproj/project.pbxproj --- old/goxel-0.10.7/osx/goxel/goxel.xcodeproj/project.pbxproj 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/osx/goxel/goxel.xcodeproj/project.pbxproj 2021-08-09 08:47:27.000000000 +0200 @@ -43,6 +43,7 @@ F037D5D61EA6069A00C96D10 /* shape.c in Sources */ = {isa = PBXBuildFile; fileRef = F037D5CE1EA6069A00C96D10 /* shape.c */; }; F03B4387224CCDDF00798CAB /* pathtracer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F03B4385224CCDDF00798CAB /* pathtracer.cpp */; }; F03B4388224CCDDF00798CAB /* yocto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F03B4386224CCDDF00798CAB /* yocto.cpp */; }; + F05E2DD9268F451D00E47D33 /* quit.c in Sources */ = {isa = PBXBuildFile; fileRef = F05E2DD8268F451D00E47D33 /* quit.c */; }; F06C683C1D2EAECC00887FCE /* camera.c in Sources */ = {isa = PBXBuildFile; fileRef = F06C68391D2EAECC00887FCE /* camera.c */; }; F06C683D1D2EAECC00887FCE /* quantization.c in Sources */ = {isa = PBXBuildFile; fileRef = F06C683A1D2EAECC00887FCE /* quantization.c */; }; F076EA362284162400B74F0C /* light_panel.c in Sources */ = {isa = PBXBuildFile; fileRef = F076EA352284162400B74F0C /* light_panel.c */; }; @@ -145,6 +146,7 @@ F037D5CE1EA6069A00C96D10 /* shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = shape.c; sourceTree = "<group>"; }; F03B4385224CCDDF00798CAB /* pathtracer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pathtracer.cpp; sourceTree = "<group>"; }; F03B4386224CCDDF00798CAB /* yocto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = yocto.cpp; sourceTree = "<group>"; }; + F05E2DD8268F451D00E47D33 /* quit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = quit.c; path = gui/quit.c; sourceTree = "<group>"; }; F06C68391D2EAECC00887FCE /* camera.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = camera.c; sourceTree = "<group>"; }; F06C683A1D2EAECC00887FCE /* quantization.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = quantization.c; sourceTree = "<group>"; }; F076EA352284162400B74F0C /* light_panel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = light_panel.c; sourceTree = "<group>"; }; @@ -341,6 +343,7 @@ F07DE9E31BD0F31500BAA1AD /* src */ = { isa = PBXGroup; children = ( + F05E2DD8268F451D00E47D33 /* quit.c */, F0E5DB2624FBB0D600010FDD /* file_format.c */, F0E5DB2724FBB0D600010FDD /* file_format.h */, F0C37C8B2317CBDE000EF45F /* xxhash.c */, @@ -540,6 +543,7 @@ F0C37C8C2317CBDE000EF45F /* xxhash.c in Sources */, F00FC332226B2FCF0002F251 /* about.c in Sources */, F0ACA2A42271ACEA00376C82 /* json.c in Sources */, + F05E2DD9268F451D00E47D33 /* quit.c in Sources */, F0A160031E962F1300C6EF33 /* voxlap.c in Sources */, F07DEA101BD0F31500BAA1AD /* system.c in Sources */, F09482FE22994752005DE2C5 /* layer.c in Sources */, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/snap/gui/goxel.desktop new/goxel-0.10.8/snap/gui/goxel.desktop --- old/goxel-0.10.7/snap/gui/goxel.desktop 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/snap/gui/goxel.desktop 2021-08-09 08:47:27.000000000 +0200 @@ -2,8 +2,9 @@ Version=1.0 Encoding=UTF-8 Name=goxel +GenericName=Voxel graphics editor Comment=3D Voxel Editor Exec=goxel Icon=${SNAP}/icon.png Type=Application -Categories=Graphics; +Categories=Graphics;3DGraphics; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/snap/gui/io.github.guillaumechereau.Goxel.appdata.xml new/goxel-0.10.8/snap/gui/io.github.guillaumechereau.Goxel.appdata.xml --- old/goxel-0.10.7/snap/gui/io.github.guillaumechereau.Goxel.appdata.xml 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/snap/gui/io.github.guillaumechereau.Goxel.appdata.xml 2021-08-09 08:47:27.000000000 +0200 @@ -3,7 +3,7 @@ <id>io.github.guillaumechereau.Goxel.desktop</id> <name>Goxel</name> <project_license>GPL-3.0-only</project_license> - <metadata_license>GPL-3.0-only</metadata_license> + <metadata_license>CC0-1.0</metadata_license> <summary>Open Source 3D voxel editor</summary> <developer_name>Guillaume Chereau</developer_name> <description> @@ -15,41 +15,17 @@ <li>Unlimited scene size: You can create voxel images as big as you want.</li> <li>Layers support: Decompose your image into several layers for easy editing.</li> <li>Many export formats: Goxel can export to obj, pyl, magica voxel, png, qubicle, povray, and more.</li> - ???</ul> + </ul> </description> <screenshots> - <screenshot> - <caption>Marching Cube Rendering: Support for smooth rendering of voxels using the marching cube algorithm.</caption> - <image type="source">https://guillaumechereau.github.io/goxel/images/screenshots/marching-cube.png</image> - </screenshot> - <screenshot> - <caption>Procedural rendering tool: It is possible to programatically generate shapes using goxel procedural language, inspired by ContextFree. </caption> - <image type="source">https://guillaumechereau.github.io/goxel/images/screenshots/procedural.png</image> - </screenshot> - <screenshot> - <caption>Laser tool: Carve in real time into the volume.</caption> - <image type="source">https://guillaumechereau.github.io/goxel/images/screenshots/laser.png</image> - </screenshot> - <screenshot> - <caption>Layers panel: You can stack as many layers as you want. Layers can be edited independently, so that you can use one per part of your image.</caption> - <image type="source">https://guillaumechereau.github.io/goxel/images/screenshots/layers.png</image> - </screenshot> - <screenshot> - <caption>Plane: You can import a 2D image into Goxel, to use as a reference for your model.</caption> - <image type="source">https://guillaumechereau.github.io/goxel/images/screenshots/image-plane.png</image> - </screenshot> - <screenshot> - <caption>Palettes panel: Goxel comes with a set of predefined color palettes.</caption> - <image type="source">https://guillaumechereau.github.io/goxel/images/screenshots/palettes.png</image> - </screenshot> <screenshot type="default"> - <caption>Selection tool: Allow to operate on a portion of the image.</caption> - <image type="source">https://guillaumechereau.github.io/goxel/images/screenshots/selection.png</image> + <image type="source">https://github.com/guillaumechereau/goxel/raw/b06a56c3c10fa54d5616367195251d84ff95124f/screenshots/screenshot-plane.png</image> </screenshot> </screenshots> <releases> - <release version="v0.7.3" date="2018-03-01"/> + <release version="v0.10.6" date="2020-06-09"/> </releases> - <url type="homepage">https://guillaumechereau.github.io/goxel/</url> + <url type="homepage">https://goxel.xyz/</url> <url type="bugtracker">https://github.com/guillaumechereau/goxel/issues</url> + <content_rating type="oars-1.1" /> </component> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/actions.h new/goxel-0.10.8/src/actions.h --- old/goxel-0.10.7/src/actions.h 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/actions.h 2021-08-09 08:47:27.000000000 +0200 @@ -80,6 +80,8 @@ X(tool_set_line), X(tool_set_move), + X(export_to_photos), + ACTION_COUNT }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/formats/gltf.c new/goxel-0.10.8/src/formats/gltf.c --- old/goxel-0.10.7/src/formats/gltf.c 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/formats/gltf.c 2021-08-09 08:47:27.000000000 +0200 @@ -441,7 +441,7 @@ } } - s = max(next_pow2(ceil(log2(g->palette.size))), 16); + s = max(next_pow2(ceil(sqrt(g->palette.size))), 16); data = calloc(s * s, sizeof(*data)); for (i = 0; i < g->palette.size; i++) memcpy(data[i], g->palette.entries[i].color, 3); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/formats/gox.c new/goxel-0.10.8/src/formats/gox.c --- old/goxel-0.10.7/src/formats/gox.c 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/formats/gox.c 2021-08-09 08:47:27.000000000 +0200 @@ -726,9 +726,9 @@ if (path != goxel.image->path) { free(goxel.image->path); goxel.image->path = strdup(path); - goxel.image->saved_key = image_get_key(goxel.image); } save_to_file(goxel.image, goxel.image->path); + goxel.image->saved_key = image_get_key(goxel.image); sys_on_saved(path); } @@ -745,9 +745,9 @@ if (path != goxel.image->path) { free(goxel.image->path); goxel.image->path = strdup(path); - goxel.image->saved_key = image_get_key(goxel.image); } save_to_file(goxel.image, goxel.image->path); + goxel.image->saved_key = image_get_key(goxel.image); sys_on_saved(path); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/formats/vox.c new/goxel-0.10.8/src/formats/vox.c --- old/goxel-0.10.7/src/formats/vox.c 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/formats/vox.c 2021-08-09 08:47:27.000000000 +0200 @@ -163,9 +163,9 @@ x = (v >> 0) & 3; y = (v >> 2) & 3; z = 3 - x - y; - node->ntrn.rot[0][x] = ((v >> 4) & 1) ? -1 : +1; - node->ntrn.rot[1][y] = ((v >> 5) & 1) ? -1 : +1; - node->ntrn.rot[2][z] = ((v >> 6) & 1) ? -1 : +1; + node->ntrn.rot[x][0] = ((v >> 4) & 1) ? -1 : +1; + node->ntrn.rot[y][1] = ((v >> 5) & 1) ? -1 : +1; + node->ntrn.rot[z][2] = ((v >> 6) & 1) ? -1 : +1; } if (strcmp(key, "_t") == 0) { node->ntrn.has_trans = true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/formats/vxl.c new/goxel-0.10.8/src/formats/vxl.c --- old/goxel-0.10.7/src/formats/vxl.c 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/formats/vxl.c 2021-08-09 08:47:27.000000000 +0200 @@ -132,6 +132,9 @@ static int is_surface(int x, int y, int z, uint8_t map[512][512][64]) { if (map[x][y][z]==0) return 0; + if (x == 0 || x == 511) return 1; + if (y == 0 || y == 511) return 1; + if (z == 0 || z == 63) return 1; if (x > 0 && map[x-1][y][z]==0) return 1; if (x+1 < 512 && map[x+1][y][z]==0) return 1; if (y > 0 && map[x][y-1][z]==0) return 1; @@ -267,7 +270,7 @@ FILE_FORMAT_REGISTER(vxl, .name = "vxl", - .ext = "vxk\0*.vxl\0", + .ext = "vxl\0*.vxl\0", .import_func = vxl_import, .export_func = export_as_vxl, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/gesture.c new/goxel-0.10.8/src/gesture.c --- old/goxel-0.10.7/src/gesture.c 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/gesture.c 2021-08-09 08:47:27.000000000 +0200 @@ -23,6 +23,16 @@ // XXX: this value should be set depending on the screen resolution. static float g_start_dist = 8; +static bool test_button(const inputs_t *inputs, const touch_t *touch, int mask) +{ + if (mask & GESTURE_SHIFT && !inputs->keys[KEY_LEFT_SHIFT]) return false; + if (mask & GESTURE_CTRL && !inputs->keys[KEY_CONTROL]) return false; + if ((mask & GESTURE_LMB) && !touch->down[0]) return false; + if ((mask & GESTURE_MMB) && !touch->down[1]) return false; + if ((mask & GESTURE_RMB) && !touch->down[2]) return false; + return true; +} + static bool rect_contains(const float rect[4], const float pos[2]) { return pos[0] >= rect[0] && pos[0] < rect[0] + rect[2] && @@ -60,9 +70,10 @@ if (gest->type == GESTURE_DRAG) { switch (gest->state) { case GESTURE_POSSIBLE: - if (nb_ts == 1 && ts[0].down[gest->button]) { + if (nb_ts == 1 && test_button(inputs, &ts[0], gest->button)) { vec2_copy(ts[0].pos, gest->start_pos[0]); vec2_copy(gest->start_pos[0], gest->pos); + vec2_copy(gest->start_pos[0], gest->last_pos); if (!rect_contains(gest->viewport, gest->pos)) { gest->state = GESTURE_FAILED; break; @@ -84,7 +95,7 @@ case GESTURE_UPDATE: vec2_copy(ts[0].pos, gest->pos); gest->state = GESTURE_UPDATE; - if (!ts[0].down[gest->button]) + if (!test_button(inputs, &ts[0], gest->button)) gest->state = GESTURE_END; break; } @@ -94,13 +105,13 @@ vec2_copy(ts[0].pos, gest->pos); switch (gest->state) { case GESTURE_POSSIBLE: - if (ts[0].down[gest->button]) { + if (test_button(inputs, &ts[0], gest->button)) { vec2_copy(ts[0].pos, gest->start_pos[0]); gest->state = GESTURE_RECOGNISED; } break; case GESTURE_RECOGNISED: - if (!ts[0].down[gest->button]) + if (!test_button(inputs, &ts[0], gest->button)) gest->state = GESTURE_TRIGGERED; break; } @@ -194,6 +205,7 @@ gest->state == GESTURE_TRIGGERED) { gest->callback(gest, user); + vec2_copy(gest->pos, gest->last_pos); triggered = gest; break; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/gesture.h new/goxel-0.10.8/src/gesture.h --- old/goxel-0.10.7/src/gesture.h 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/gesture.h 2021-08-09 08:47:27.000000000 +0200 @@ -68,6 +68,14 @@ GESTURE_FAILED, }; +enum { + GESTURE_LMB = 1 << 0, + GESTURE_MMB = 1 << 1, + GESTURE_RMB = 1 << 2, + GESTURE_SHIFT = 1 << 3, + GESTURE_CTRL = 1 << 4, +}; + /* * Type: gesture_t * Structure used to handle a given gesture. @@ -81,6 +89,7 @@ float viewport[4]; float pos[2]; float start_pos[2][2]; + float last_pos[2]; float pinch; float rotation; int (*callback)(const gesture_t *gest, void *user); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/goxel.c new/goxel-0.10.8/src/goxel.c --- old/goxel-0.10.7/src/goxel.c 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/goxel.c 2021-08-09 08:47:27.000000000 +0200 @@ -282,6 +282,7 @@ static int on_drag(const gesture_t *gest, void *user); static int on_pan(const gesture_t *gest, void *user); +static int on_zoom(const gesture_t *gest, void *user); static int on_rotate(const gesture_t *gest, void *user); static int on_hover(const gesture_t *gest, void *user); @@ -294,6 +295,18 @@ #endif } +void goxel_add_gesture(int type, int button, + int (*fn)(const gesture_t *gest, void *user)) +{ + goxel.gestures[goxel.gestures_count] = calloc(1, sizeof(gesture_t)); + *goxel.gestures[goxel.gestures_count] = (gesture_t) { + .type = type, + .button = button, + .callback = fn, + }; + goxel.gestures_count++; +} + KEEPALIVE void goxel_init(void) { @@ -308,25 +321,12 @@ } goxel.palette = goxel.palette ?: goxel.palettes; - goxel.gestures.drag = (gesture_t) { - .type = GESTURE_DRAG, - .button = 0, - .callback = on_drag, - }; - goxel.gestures.pan = (gesture_t) { - .type = GESTURE_DRAG, - .button = 2, - .callback = on_pan, - }; - goxel.gestures.rotate = (gesture_t) { - .type = GESTURE_DRAG, - .button = 1, - .callback = on_rotate, - }; - goxel.gestures.hover = (gesture_t) { - .type = GESTURE_HOVER, - .callback = on_hover, - }; + goxel_add_gesture(GESTURE_DRAG, GESTURE_LMB, on_drag); + goxel_add_gesture(GESTURE_DRAG, GESTURE_RMB, on_pan); + goxel_add_gesture(GESTURE_DRAG, GESTURE_MMB | GESTURE_SHIFT, on_pan); + goxel_add_gesture(GESTURE_DRAG, GESTURE_MMB | GESTURE_CTRL, on_zoom); + goxel_add_gesture(GESTURE_DRAG, GESTURE_MMB, on_rotate); + goxel_add_gesture(GESTURE_HOVER, 0, on_hover); goxel_reset(); } @@ -441,7 +441,8 @@ if (!goxel.graphics_initialized) goxel_create_graphics(); - goxel.fps = mix(goxel.fps, 1.0 / (time - goxel.frame_time), 0.1); + goxel.delta_time = time - goxel.frame_time; + goxel.fps = mix(goxel.fps, 1.0 / goxel.delta_time, 0.1); goxel.frame_time = time; goxel_set_help_text(NULL); goxel_set_hint_text(NULL); @@ -583,6 +584,24 @@ return 0; } +static int on_zoom(const gesture_t *gest, void *user) +{ + float p[3], n[3]; + double zoom; + camera_t *camera = get_camera(); + + zoom = (gest->pos[1] - gest->last_pos[1]) / 10.0; + mat4_itranslate(camera->mat, 0, 0, + -camera->dist * (1 - pow(1.1, -zoom))); + camera->dist *= pow(1.1, -zoom); + // Auto adjust the camera rotation position. + if (goxel_unproject_on_mesh(gest->viewport, gest->pos, + goxel_get_layers_mesh(goxel.image), p, n)) { + camera_set_target(camera, p); + } + return 0; +} + static int on_hover(const gesture_t *gest, void *user) { cursor_t *c = &goxel.cursor; @@ -607,13 +626,8 @@ camera_t *camera = get_camera(); painter_t painter = goxel.painter; - gesture_t *gests[] = {&goxel.gestures.drag, - &goxel.gestures.pan, - &goxel.gestures.rotate, - &goxel.gestures.pinch, - &goxel.gestures.hover}; - - gesture_update(ARRAY_SIZE(gests), gests, inputs, viewport, NULL); + gesture_update(goxel.gestures_count, goxel.gestures, + inputs, viewport, NULL); set_flag(&goxel.cursor.flags, CURSOR_SHIFT, inputs->keys[KEY_LEFT_SHIFT]); set_flag(&goxel.cursor.flags, CURSOR_CTRL, inputs->keys[KEY_CONTROL]); @@ -764,7 +778,7 @@ vec3_add(a, b, b); render_line(&goxel.rend, a, b, color, EFFECT_PROJ_SCREEN); - vec3_mul(AXIS[i], size * 0.5, l); + vec3_mul(AXIS[i], size * 0.4, l); mat4_mul_vec3(rot, l, l); vec3_add(b, l, l); @@ -772,12 +786,12 @@ if (i == 0) { float t1[3], t2[3]; - vec3_set(t1, l[0] - 5, l[1] + 10, l[2]); - vec3_set(t2, l[0] + 5, l[1] - 10, l[2]); + vec3_set(t1, l[0] - 3, l[1] + 7, l[2]); + vec3_set(t2, l[0] + 3, l[1] - 7, l[2]); render_line(&goxel.rend, t1, t2, color, EFFECT_PROJ_SCREEN); - vec3_set(t1, l[0] + 5, l[1] + 10, l[2]); - vec3_set(t2, l[0] - 5, l[1] - 10, l[2]); + vec3_set(t1, l[0] + 3, l[1] + 7, l[2]); + vec3_set(t2, l[0] - 3, l[1] - 7, l[2]); render_line(&goxel.rend, t1, t2, color, EFFECT_PROJ_SCREEN); } @@ -785,15 +799,15 @@ if (i == 1) { float t1[3], t2[3]; - vec3_set(t1, l[0] - 5, l[1] + 10, l[2]); + vec3_set(t1, l[0] - 3, l[1] + 7, l[2]); vec3_set(t2, l[0], l[1], l[2]); render_line(&goxel.rend, t1, t2, color, EFFECT_PROJ_SCREEN); - vec3_set(t1, l[0] + 5, l[1] + 10, l[2]); + vec3_set(t1, l[0] + 3, l[1] + 7, l[2]); vec3_set(t2, l[0], l[1], l[2]); render_line(&goxel.rend, t1, t2, color, EFFECT_PROJ_SCREEN); - vec3_set(t1, l[0], l[1] - 10, l[2]); + vec3_set(t1, l[0], l[1] - 7, l[2]); vec3_set(t2, l[0], l[1], l[2]); render_line(&goxel.rend, t1, t2, color, EFFECT_PROJ_SCREEN); } @@ -802,16 +816,16 @@ if (i == 2) { float t1[3], t2[3]; - vec3_set(t1, l[0] - 5, l[1] + 10, l[2]); - vec3_set(t2, l[0] + 5, l[1] + 10, l[2]); + vec3_set(t1, l[0] - 3, l[1] + 7, l[2]); + vec3_set(t2, l[0] + 3, l[1] + 7, l[2]); render_line(&goxel.rend, t1, t2, color, EFFECT_PROJ_SCREEN); - vec3_set(t1, l[0] + 5, l[1] + 10, l[2]); - vec3_set(t2, l[0] - 5, l[1] - 10, l[2]); + vec3_set(t1, l[0] + 3, l[1] + 7, l[2]); + vec3_set(t2, l[0] - 3, l[1] - 7, l[2]); render_line(&goxel.rend, t1, t2, color, EFFECT_PROJ_SCREEN); - vec3_set(t1, l[0] - 5, l[1] - 10, l[2]); - vec3_set(t2, l[0] + 5, l[1] - 10, l[2]); + vec3_set(t1, l[0] - 3, l[1] - 7, l[2]); + vec3_set(t2, l[0] + 3, l[1] - 7, l[2]); render_line(&goxel.rend, t1, t2, color, EFFECT_PROJ_SCREEN); } } @@ -1310,7 +1324,7 @@ static void quit(void) { - goxel.quit = true; + gui_query_quit(); } ACTION_REGISTER(quit, .help = "Quit the application", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/goxel.h new/goxel-0.10.8/src/goxel.h --- old/goxel-0.10.7/src/goxel.h 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/goxel.h 2021-08-09 08:47:27.000000000 +0200 @@ -72,7 +72,7 @@ #include <stdlib.h> #include <string.h> -#define GOXEL_VERSION_STR "0.10.7" +#define GOXEL_VERSION_STR "0.10.8" #ifndef GOXEL_DEFAULT_THEME # define GOXEL_DEFAULT_THEME "original" #endif @@ -518,6 +518,7 @@ char *help_text; // Seen in the bottom of the screen. char *hint_text; // Seen in the bottom of the screen. + double delta_time; // Elapsed time since last frame (sec) int frame_count; // Global frames counter. double frame_time; // Clock time at beginning of the frame (sec) double fps; // Average fps. @@ -525,13 +526,9 @@ int view_effects; // EFFECT_WIREFRAME | EFFECT_GRID | EFFECT_EDGES - struct { - gesture_t drag; - gesture_t pan; - gesture_t rotate; - gesture_t hover; - gesture_t pinch; - } gestures; + // All the gestures we listen to. Up to 16. + gesture_t *gestures[16]; + int gestures_count; pathtracer_t pathtracer; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/gui/quit.c new/goxel-0.10.8/src/gui/quit.c --- old/goxel-0.10.7/src/gui/quit.c 1970-01-01 01:00:00.000000000 +0100 +++ new/goxel-0.10.8/src/gui/quit.c 2021-08-09 08:47:27.000000000 +0200 @@ -0,0 +1,41 @@ +/* Goxel 3D voxels editor + * + * copyright (c) 2021 Guillaume Chereau <guilla...@noctua-software.com> + * + * Goxel is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + + * Goxel is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + + * You should have received a copy of the GNU General Public License along with + * goxel. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "goxel.h" + +static int gui_quit_popup(void *data) +{ + gui_text("Quit without saving your changes?"); + if (gui_button("Quit", 0, 0)) { + goxel.quit = true; + return 1; + } + gui_same_line(); + if (gui_button("Cancel", 0, 0)) + return 2; + return 0; +} + +void gui_query_quit(void) +{ + if (image_get_key(goxel.image) == goxel.image->saved_key) { + goxel.quit = true; + return; + } + gui_open_popup("Unsaved changes", GUI_POPUP_RESIZE, NULL, gui_quit_popup); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/gui.cpp new/goxel-0.10.8/src/gui.cpp --- old/goxel-0.10.7/src/gui.cpp 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/gui.cpp 2021-08-09 08:47:27.000000000 +0200 @@ -526,6 +526,7 @@ gui = (gui_t*)calloc(1, sizeof(*gui)); init_ImGui(); gui->gestures.drag.type = GESTURE_DRAG; + gui->gestures.drag.button = GESTURE_LMB; gui->gestures.drag.callback = on_gesture; gui->gestures.hover.type = GESTURE_HOVER; gui->gestures.hover.callback = on_gesture; @@ -584,6 +585,8 @@ if (!str_startswith(s, "Ctrl")) return 0; s += strlen("Ctrl "); check_char = false; + } else { + if (str_startswith(s, "Ctrl")) return 0; } if (io.KeyShift) { check_key = false; @@ -667,7 +670,7 @@ io.DisplayFramebufferScale = ImVec2(goxel.screen_scale, goxel.screen_scale); - io.DeltaTime = 1.0 / 60; + io.DeltaTime = goxel.delta_time; gui->inputs = inputs; if (inputs) { @@ -1616,7 +1619,9 @@ bool gui_menu_begin(const char *label) { - return ImGui::BeginMenu(label); + bool ret = ImGui::BeginMenu(label); + if (ret) gui->capture_mouse = true; + return ret; } void gui_menu_end(void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/gui.h new/goxel-0.10.8/src/gui.h --- old/goxel-0.10.7/src/gui.h 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/gui.h 2021-08-09 08:47:27.000000000 +0200 @@ -125,6 +125,7 @@ bool gui_need_full_version(void); +void gui_query_quit(void); enum { GUI_POPUP_FULL = 1 << 0, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/image.c new/goxel-0.10.8/src/image.c --- old/goxel-0.10.7/src/image.c 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/image.c 2021-08-09 08:47:27.000000000 +0200 @@ -679,7 +679,7 @@ static void image_image_layer_to_mesh(image_t *img, layer_t *layer) { uint8_t *data; - int i, j, w, h, bpp = 0, pos[3]; + int x, y, w, h, bpp = 0, pos[3]; uint8_t c[4]; float p[3]; assert(img); @@ -689,16 +689,16 @@ image_history_push(img); data = img_read(layer->image->path, &w, &h, &bpp); acc = mesh_get_accessor(layer->mesh); - for (j = 0; j < w; j++) - for (i = 0; i < h; i++) { - vec3_set(p, i / (float)h - 0.5, 0.5 - j / (float)w, 0); + for (y = 0; y < h; y++) + for (x = 0; x < w; x++) { + vec3_set(p, (x / (float)w) - 0.5, - ((y + 1) / (float)h) + 0.5, 0); mat4_mul_vec3(layer->mat, p, p); pos[0] = round(p[0]); pos[1] = round(p[1]); pos[2] = round(p[2]); memset(c, 0, 4); c[3] = 255; - memcpy(c, data + (j * w + i) * bpp, bpp); + memcpy(c, data + (y * w + x) * bpp, bpp); mesh_set_at(layer->mesh, &acc, pos, c); } texture_delete(layer->image); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/main.c new/goxel-0.10.8/src/main.c --- old/goxel-0.10.7/src/main.c 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/main.c 2021-08-09 08:47:27.000000000 +0200 @@ -51,6 +51,12 @@ goxel_import_file(paths[i], NULL); } +void on_close(GLFWwindow *win) +{ + glfwSetWindowShouldClose(win, GLFW_FALSE); + gui_query_quit(); +} + typedef struct { char *input; @@ -150,14 +156,7 @@ int fb_size[2], win_size[2]; int i; double xpos, ypos; - float xscale, yscale; float scale; - GLFWmonitor *monitor; - - (void)monitor; - (void)fb_size; - (void)xscale; - (void)yscale; if ( !glfwGetWindowAttrib(g_window, GLFW_VISIBLE) || glfwGetWindowAttrib(g_window, GLFW_ICONIFIED)) { @@ -169,17 +168,8 @@ // size. glfwGetWindowSize(g_window, &win_size[0], &win_size[1]); - scale = g_scale; - // Note: when all platforms get updated to glfw 3.3+, we should remove - // this test. - #if GLFW_VERSION_MAJOR >= 3 && GLFW_VERSION_MINOR >= 3 - monitor = glfwGetPrimaryMonitor(); - glfwGetMonitorContentScale(monitor, &xscale, &yscale); - scale *= xscale; - #else - glfwGetFramebufferSize(g_window, &fb_size[0], &fb_size[1]); - scale *= (float)fb_size[0] / win_size[0]; - #endif + glfwGetFramebufferSize(g_window, &fb_size[0], &fb_size[1]); + scale = g_scale * (float)fb_size[0] / win_size[0]; g_inputs->window_size[0] = win_size[0]; g_inputs->window_size[1] = win_size[1]; @@ -298,6 +288,7 @@ glfwSetScrollCallback(window, on_scroll); glfwSetDropCallback(window, on_drop); glfwSetCharCallback(window, on_char); + glfwSetWindowCloseCallback(window, on_close); glfwSetInputMode(window, GLFW_STICKY_MOUSE_BUTTONS, false); set_window_icon(window); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/system.c new/goxel-0.10.8/src/system.c --- old/goxel-0.10.7/src/system.c 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/system.c 2021-08-09 08:47:27.000000000 +0200 @@ -295,3 +295,17 @@ LOG_I("Saved %s", path); } #endif + +#ifdef ANDROID + +const char *sys_get_save_path(const char *filters, const char *default_name) +{ + return NULL; +} + +void sys_on_saved(const char *path) +{ + LOG_I("Saved %s", path); +} + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/tools/brush.c new/goxel-0.10.8/src/tools/brush.c --- old/goxel-0.10.7/src/tools/brush.c 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/tools/brush.c 2021-08-09 08:47:27.000000000 +0200 @@ -180,7 +180,7 @@ float box[4][4]; bool shift = curs->flags & CURSOR_SHIFT; - if (gest->state == GESTURE_END) { + if (gest->state == GESTURE_END || !curs->snaped) { mesh_delete(goxel.tool_mesh); goxel.tool_mesh = NULL; return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/goxel-0.10.7/src/yocto.cpp new/goxel-0.10.8/src/yocto.cpp --- old/goxel-0.10.7/src/yocto.cpp 2020-12-04 08:55:07.000000000 +0100 +++ new/goxel-0.10.8/src/yocto.cpp 2021-08-09 08:47:27.000000000 +0200 @@ -47,6 +47,12 @@ #define STB_IMAGE_STATIC #define STB_IMAGE_WRITE_STATIC +// Fix compilation on Windows. +#ifdef NOMINMAX +#undef NOMINMAX +#endif + + #include "../ext_src/yocto/yocto_bvh.cpp" #include "../ext_src/yocto/yocto_image.cpp" #include "../ext_src/yocto/yocto_scene.cpp"