Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

151 Neutral

About piecuch.p

  • Rank

Personal Information


  • Github

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. piecuch.p

    QLMesh with support for LDraw models

    I am preparing a new version of QLMesh with LDraw models support. Except the size of the models library I had to embed into the executable, the conversion process is quite fast event for large models, as you see on attached pictures. Nice thing is, that I was able to integrate it nicely with Open Asset Library, so the final result is quite consistent.
  2. piecuch.p

    Compressing LDraw database

    One of the main goal for QLMesh was to add some new formats I have been working with quite often, like Photoshop files of bdf fonts. For 3D it is LDraw formats and DAZ Studio models. LDraw is one of my favourite. I am currently working on extending Assimp to support .ldr and .mpd files. One of the major challenge is actually not drawing but embedding library definitions into the plugin. Original library it is about 250MB (compressed to ~40MB). That's quite large for Quicklook plugin. I started to work on some heavy compression/optimalization and current result is: -rw-r--r-- 1 piecuchp staff 40M May 12 17:18 parts.db -rw-r--r-- 1 piecuchp staff 2.2M May 12 17:18 parts.db.gz That's much better. 2MB can be easily embedded into plugin, eg. using assembler module like this: bits 64 section .rodata global _ldrawlib global _ldrawlib_end global _ldrawlib_size _ldrawlib: incbin "parts.db.gz" _ldrawlib_end: _ldrawlib_size: dd $-_ldrawlib and later build with e.g. nasm: /opt/local/bin/nasm -fmacho64 ldraw_lib.asm -o ldraw_lib.o PS1 Sometimes less is more. Working on reading gzip stream, I had to remove one of the compression optimisation. The uncompressed file is slightly bigger, but compressed one much smaller: -rw-r--r-- 1 piecuchp staff 41M Jun 17 12:03 parts.db -rw-r--r-- 1 piecuchp staff 1.5M Jun 17 12:03 parts.db.gz PS2 Sadly, this is not the end of the story I had to increase the precision of the float numbers in the database (it is now 17 bits - sign:8bit:8bit) - it increased the size but also significantly affected the compression ratio: -rw-r--r-- 1 piecuchp staff 67M Jul 11 08:55 parts.db -rw-r--r-- 1 piecuchp staff 41M Jul 11 08:55 parts.db.gz Seems like I am gonna have to live with such database for a while.
  3. piecuch.p

    QLMesh 2.0

    QLMesh is small but useful QuickLook plugin showing a preview of various well-known 3D model formats. All formats provided by the Open Asset Import Library (http://http://assimp.sourceforge.net) are supported: 3d, 3ds, ac, ac3d, acc, ase, ask, assbin, b3d, blend, bvh, cob, csm, dae, dxf, enff, fbx, gltf, gltf2, hmp, ifc, ifczip, irr, irrmesh, lwo, lws, lxo, md2, md3, md5anim, md5camera, md5mesh, mdc, mdl, mesh, mesh.xml, mot, ms3d, ndo, nff, obj, off, ogex, pk3, ply, prj, q3o, q3s, raw, scn, smd, stl, ter, uc, vta, x, xgl, xml, zgl. I use this tool in my daily work, so I have added also support for some frequent file formats I work with: compressed textures (dds, etc/pkm and pvr (including multi-image support for mipmaps), Adobe Photoshop brushes (abr) and bitmapped font (BDF files). Current version (1.1) is using Mesa for offline rendering, but somehow I not happy with this solution. The new build (2.0) is using OSX built-in support for COLLADA/ASE format - this much more convenience in daily use. See my blog at http://pawelp.ath.cx/
  4. piecuch.p

    Ultimate Bitmap Font Generator 2

    Album for Ultimate Bitmap Font Generator 2
  5. piecuch.p


    Bitmap font generator inspired by UBFG and BMfont applications with multiply features: multiply fonts in one atlas plenty customisations options font preview (w. OpenGL) font styling with externals editors (Photoshop/Gimp) multi-texture fonts full debug of glyphs borders and padding; glyphs rotation external font files (ttf/otf) glyph outlines signed distance field fonts, including multi-channel generator multisampling multi-channel export template-based exporter (w. Google CTemplate) Work in progress with a lot of details still to be implemented, but usable at the moment. Fonts can be generated, tested and exported.
  6. piecuch.p

    QLMesh 2.1 released

    I have prepared another update to QLMesh: ver. 2.1 add performance improvements (plugin is better handling big bitmaps), major update of Open Asset Library and support for new format: Photoshop Patterns (PAT) files - both RGB and CMYK formats are supported. New version is also build against OSX SDK 10.13, since I have finally updated my MacBook to Sierra. (http://pawelp.ath.cx/)(http://komsoft.ath.cx/)(https://itunes.apple.com/us/app/qlmesh/id1037909675)
  7. piecuch.p

    QLMesh 2.0 and Asset Import Library

    For QLMesh (and some other projects), I am running my own fork of Asset Import Library. The difference: it is amalgamated build - all sources are merged into one file (including dependencies). Since Assimp recently switched to miniz, I have replaced remaining references to zlib with miniz - so zlib is not required too. drwxr-xr-x 85 piecuchp staff 2890 Jan 17 23:34 assimp -rw-r--r-- 1 piecuchp staff 4921627 Jan 17 23:34 assimp.cpp -rw-r--r-- 1 piecuchp staff 2893785 Jan 17 23:34 private\assimp.h Everything you need to buid the assimp is: g++ -c -std=c++11 code-portable/assimp.cpp or just add assimp.cpp to your project/IDE (you can find code-portable directory in my repo. One disclaimer: I have only tested this amalgamation under OSX with QLMesh). Main reason for this amalgamation is that it makes compilation/recompilation on different platforms with different configurations rather easier. Side-effect is that single-file assimp.cpp compiles really fast (like 10x faster on my MacBook than original project files). (http://pawelp.ath.cx/)(http://komsoft.ath.cx/)(https://itunes.apple.com/us/app/qlmesh/id1037909675)
  8. piecuch.p

    QLMesh 2.0 release

    I am quite happy I finally had time to release a new version of QLMesh. With multitude of 3d files on my disk, having such a quick tool is always nice welcome. But also relaying on built-in OSX 3d generator (for .obj and .collada) made the whole code simpler and cleaner - previous version had a lot of code that suppose to work only in non-sandboxed environment (like texture support in 3d view). But after AppStore release most of this code was not in use. Now what would be good to have is finally support for Daz3D models and formats and my long-lasting missing feature: LDraw format support. (http://pawelp.ath.cx/)(http://komsoft.ath.cx/)
  9. piecuch.p

    QLMesh 2.0

    Album for QLMesh 2.0
  10. Apple has just accepted my application on AppStore: QLMesh. It is a QuickLook plugin for displaying a preview of many 3d formats, base on Open Assets Import Library. All 3d formats are supported plus some 2d compressed textures. [attachment=31149:qlmesh1.png]   Mipmaps are displayed with multi-page view - quite handy and useful feature - also because you can browse within mipmaps directly in finder. [attachment=31150:mipmaps.png] CGContextRef kcontext = QLPreviewRequestCreatePDFContext(preview, NULL, NULL, properties); ... CGImageRef cimage = ...; // Fill 3/4 of the rect const float enlarge = 1.0 + 0.48*i*i; CGRect canvasRect = CGRectMake((image[0].width - w*enlarge)/2, (image[0].height - h*enlarge)/2, w*enlarge, h*enlarge); CGContextBeginPage(kcontext, &pageRect); CGContextDrawImage(kcontext, canvasRect, cimage); CGContextEndPage(kcontext); Part of the QLMesh is control application for quicklook plugin. [attachment=31151:qlmesh5.png] Usually that would not be anything special, however for MacStore applications this is a very different story. MacStore applications are all sanboxed. There are ways to communicate and share data between such applications, eg. using App groups, but quicklook plugins do not support that feature. After struggling for some time with this problem I came out with this simple solution:  1. register additional file type/extension managed by your plugin - dedicated for passing settings to the plugin 2. when you want to pass some settings to the plugin - save settings in a file with  a special extension and request  a quicklook thumbnail for that file 3. you plugin will be executed with settings file - you can now configure your plugin   That's easy. Now hardest part: how to send some data (eg. current configuration) from plugin to Control application. Solution: encode data in thumbnail image and send it back from plugin.   Some coding - function for decoding CGDictionary to CGImage: CGImageRef _decodeDictToCGImage(CFDictionaryRef dictref, const int thsize) { NSDictionary *dict = (__bridge NSDictionary *)dictref; // Get a color space CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); NSData *decodedData = [NSKeyedArchiver archivedDataWithRootObject:dict]; const long decodedDataSize = decodedData.length; NSMutableData *paddedData = [NSMutableData dataWithBytes:&decodedDataSize length:sizeof(long)]; [paddedData appendData:decodedData]; int sz = thsize; // min. thumbnail size if (decodedData.length < sz*sz*3) [paddedData increaseLengthBy:sz*sz*3-decodedData.length]; else { sz = ceil(sqrtf(decodedData.length/3)); [paddedData increaseLengthBy:sz*sz*3-decodedData.length]; } const char* rgb = [paddedData bytes]; char* rgba = (char*)malloc(sz*sz*4); for(int i=0; i < sz*sz; ++i) { rgba[4*i] = rgb[3*i]; rgba[4*i+1] = rgb[3*i+1]; rgba[4*i+2] = rgb[3*i+2]; rgba[4*i+3] = 0xff; } // Assuming the decoded data is only pixel data CGDataProviderRef dataProvider = CGDataProviderCreateWithData(NULL, rgba, sz*sz*4, NULL); // Given size_t width, height which you should already have somehow CGImageRef image = CGImageCreate( sz, sz, /* bpc */ 8, /* bpp */ 32, /* pitch */ sz*4, colorSpace, kCGBitmapByteOrderDefault|kCGImageAlphaNone, dataProvider, /* decode array */ NULL, /* interpolate? */ FALSE, kCGRenderingIntentDefault /* adjust intent according to use */ ); if (image == nil) NSLog(@"Failed to create image from %@.", decodedData); #if 0 NSData *data = (id)CFBridgingRelease(CGDataProviderCopyData(CGImageGetDataProvider(image))); NSLog(@"output image: %zux%zu %zu, %zu, %@ %lu", CGImageGetWidth(image), CGImageGetHeight(image), CGImageGetBitsPerPixel(image), CGImageGetBitsPerComponent(image), data, [(id)data length]); #endif // Release things the image took ownership of. CGDataProviderRelease(dataProvider); CGColorSpaceRelease(colorSpace); if (rgba) free(rgba); return image; } What's next:   1. Rendering is done using off-screen Mesa extension (this is static build). Currently it is software rasterizer (swsoft) but next version should use llvmpipe engine.   2. I am working on may optimisations - mostly related to speeding-up file loading. Current Xcode QL generator for OBJ models seems to be much faster in many cases.   3. Texture access in sandboxed environment - tricky but some workarounds could be found.     Best regards  
  11. piecuch.p

    Ultimate Bitmap Font Generator 2

    Album for Ultimate Bitmap Font Generator 2
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!