WebP port to Unity WebGL

238 views
Skip to first unread message

Suntabu

unread,
Nov 4, 2020, 10:59:24 PM11/4/20
to WebP Discussion
Hello,

My unity webgl game wanna use WebP as raw texture format, but I could not 
set-up the compile file properly, here is the file locat at "Asset/WebP/Plugins/WebGL/webp.cpp":
extern "C" { 
#include "../WebGL/webp_src~/dec/alpha.c"
    #include "../WebGL/webp_src~/dec/buffer.c"
    #include "../WebGL/webp_src~/dec/frame.c"
    #include "../WebGL/webp_src~/dec/idec.c"
    #include "../WebGL/webp_src~/dec/io.c"
    #include "../WebGL/webp_src~/dec/quant.c"
    #include "../WebGL/webp_src~/dec/tree.c"
    #include "../WebGL/webp_src~/dec/vp8.c"
    #include "../WebGL/webp_src~/dec/vp8l.c"
    #include "../WebGL/webp_src~/dec/webp.c"
    #include "../WebGL/webp_src~/dsp/alpha_processing.c"
    #include "../WebGL/webp_src~/dsp/cpu.c"
    #include "../WebGL/webp_src~/dsp/dec.c"
    #include "../WebGL/webp_src~/dsp/dec_clip_tables.c"
    #include "../WebGL/webp_src~/dsp/enc.c"
    #include "../WebGL/webp_src~/dsp/lossless.c"
    #include "../WebGL/webp_src~/dsp/upsampling.c"
    #include "../WebGL/webp_src~/dsp/yuv.c"
    #include "../WebGL/webp_src~/enc/alpha.c"
    #include "../WebGL/webp_src~/enc/analysis.c"
    #include "../WebGL/webp_src~/enc/backward_references.c"
    #include "../WebGL/webp_src~/enc/config.c"
    #include "../WebGL/webp_src~/enc/cost.c"
    #include "../WebGL/webp_src~/enc/filter.c"
    #include "../WebGL/webp_src~/enc/frame.c"
    #include "../WebGL/webp_src~/enc/histogram.c"
    #include "../WebGL/webp_src~/enc/iterator.c"
    #include "../WebGL/webp_src~/enc/near_lossless.c"
    #include "../WebGL/webp_src~/enc/picture.c"
    #include "../WebGL/webp_src~/enc/picture_csp.c"
    #include "../WebGL/webp_src~/enc/picture_psnr.c"
    #include "../WebGL/webp_src~/enc/picture_rescale.c"
    #include "../WebGL/webp_src~/enc/picture_tools.c"
    #include "../WebGL/webp_src~/enc/quant.c"
    #include "../WebGL/webp_src~/enc/syntax.c"
    #include "../WebGL/webp_src~/enc/token.c"
    #include "../WebGL/webp_src~/enc/tree.c"
    #include "../WebGL/webp_src~/enc/vp8l.c"
    #include "../WebGL/webp_src~/enc/webpenc.c"
    #include "../WebGL/webp_src~/utils/bit_reader.c"
    #include "../WebGL/webp_src~/utils/bit_writer.c"
    #include "../WebGL/webp_src~/utils/color_cache.c"
    #include "../WebGL/webp_src~/utils/filters.c"
    #include "../WebGL/webp_src~/utils/huffman.c"
    #include "../WebGL/webp_src~/utils/huffman_encode.c"
    #include "../WebGL/webp_src~/utils/quant_levels.c"
    #include "../WebGL/webp_src~/utils/quant_levels_dec.c"
    #include "../WebGL/webp_src~/utils/random.c"
    #include "../WebGL/webp_src~/utils/rescaler.c"
    #include "../WebGL/webp_src~/utils/thread.c"
    #include "../WebGL/webp_src~/utils/utils.c"
}

It produced many compile errors:


if you guys need this project to reproduce these problems, here is the repo

Pascal Massimino

unread,
Nov 5, 2020, 1:25:06 AM11/5/20
to WebP Discussion
hi,


On Thu, Nov 5, 2020 at 4:59 AM Suntabu <gou...@gmail.com> wrote:
Hello,

My unity webgl game wanna use WebP as raw texture format, but I could not 
set-up the compile file properly, here is the file locat at "Asset/WebP/Plugins/WebGL/webp.cpp":

why not link against the precompiled libraries? Including all the source files into a single
one is really not recommended....

skal/
 
--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.
To view this discussion on the web visit https://groups.google.com/a/webmproject.org/d/msgid/webp-discuss/a8413cec-9b1d-4642-81e9-336984ae1103n%40webmproject.org.

Suntabu

unread,
Nov 5, 2020, 2:33:45 AM11/5/20
to WebP Discussion, pascal.m...@gmail.com
Yes, I've imagined using precompiled libraries by following this file instruction,
but it produced js and wasm files that could not be used by Unity.

So I don't know how to integrated webp lib into unity WebGL now

Pascal Massimino

unread,
Nov 5, 2020, 3:41:02 AM11/5/20
to Suntabu, WebP Discussion
Hi,


On Thu, Nov 5, 2020 at 8:33 AM Suntabu <gou...@gmail.com> wrote:
Yes, I've imagined using precompiled libraries by following this file instruction,
but it produced js and wasm files that could not be used by Unity.

This is indeed the instructions for building the javascript/WASM version of the library, probably not what you need.
The instructions for building the library for C/C++ are available in the main README file here:


skal/

Suntabu

unread,
Nov 6, 2020, 4:59:49 AM11/6/20
to WebP Discussion, pascal.m...@gmail.com, WebP Discussion, Suntabu
hello, I've got this work by put src files into plugins.
It just worked.

Thanks for your help

Reply all
Reply to author
Forward
0 new messages