mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
Added initial behavior for ImageAssets to hold a list of GFX resources of different texture profiles to avoid mem leaks with incorrect-typed usages Added function to ImageAsset to get best-fit asset, allowing for fallbacks if the requested assetID is not found Added function to ShapeAsset to get best-fit asset, allowing for fallbacks if the requested assetID is not found Disabled fields for dynamic and static shadowmap refresh rates Moved noShape model to core/rendering/shapes to place it in a more logical module position Added an include to avoid undefined type compile error and removed unneeded semicolon from zone code Added call to reload probe textures when a reloadTextures call is made Adjusted default directional light shadowmap settings to not be as extreme Added utility function to probe manager to allow any class to request a 'best fit' list of probes that would affect a given location, allowing other classes such as fog or particles to utilize IBL. Also updated probeManager's forward rendering to utilize same function to reduce code duplication. Shifted shape loader code to utilize assimp for loader consistency and testing Changed render bin used for SSAO postfx so it runs at the right time Made Core_Rendering module scan for assets Updated loose file references to a number of assets to follow proper formatting Refactored asset import code to follow a more consistent object heirarchy structure on importing assets, allowing more reliable cross-referencing between inbound items Updated asset import logic for materials/images so that they properly utilize ImageType. Images correctly save out the assigned image type, materials reference the images' type to know what map slot they should be used in. Importer logic also updated to better find-and-add associated images based on type. Cleaned up a bunch of old, outdated code in the asset importer Added initial handling for in-place importing of files without needing to process them through the UI. Added ability to edit module script from RMB context menu if torsion path is set Updated list field code for variable inspector to utilize correct ownerObject field
110 lines
2.6 KiB
C
110 lines
2.6 KiB
C
/*
|
|
cencoder.c - c source to a base64 encoding algorithm implementation
|
|
|
|
This is part of the libb64 project, and has been placed in the public domain.
|
|
For details, see http://sourceforge.net/projects/libb64
|
|
*/
|
|
|
|
#include "cencode.h" // changed from <B64/cencode.h>
|
|
|
|
const int CHARS_PER_LINE = 72;
|
|
|
|
void base64_init_encodestate(base64_encodestate* state_in)
|
|
{
|
|
state_in->step = step_A;
|
|
state_in->result = 0;
|
|
state_in->stepcount = 0;
|
|
}
|
|
|
|
char base64_encode_value(char value_in)
|
|
{
|
|
static const char* encoding = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
if (value_in > 63) return '=';
|
|
return encoding[(int)value_in];
|
|
}
|
|
|
|
int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in)
|
|
{
|
|
const char* plainchar = plaintext_in;
|
|
const char* const plaintextend = plaintext_in + length_in;
|
|
char* codechar = code_out;
|
|
char result;
|
|
char fragment;
|
|
|
|
result = state_in->result;
|
|
|
|
switch (state_in->step)
|
|
{
|
|
while (1)
|
|
{
|
|
case step_A:
|
|
if (plainchar == plaintextend)
|
|
{
|
|
state_in->result = result;
|
|
state_in->step = step_A;
|
|
return (int)(codechar - code_out);
|
|
}
|
|
fragment = *plainchar++;
|
|
result = (fragment & 0x0fc) >> 2;
|
|
*codechar++ = base64_encode_value(result);
|
|
result = (fragment & 0x003) << 4;
|
|
case step_B:
|
|
if (plainchar == plaintextend)
|
|
{
|
|
state_in->result = result;
|
|
state_in->step = step_B;
|
|
return (int)(codechar - code_out);
|
|
}
|
|
fragment = *plainchar++;
|
|
result |= (fragment & 0x0f0) >> 4;
|
|
*codechar++ = base64_encode_value(result);
|
|
result = (fragment & 0x00f) << 2;
|
|
case step_C:
|
|
if (plainchar == plaintextend)
|
|
{
|
|
state_in->result = result;
|
|
state_in->step = step_C;
|
|
return (int)(codechar - code_out);
|
|
}
|
|
fragment = *plainchar++;
|
|
result |= (fragment & 0x0c0) >> 6;
|
|
*codechar++ = base64_encode_value(result);
|
|
result = (fragment & 0x03f) >> 0;
|
|
*codechar++ = base64_encode_value(result);
|
|
|
|
++(state_in->stepcount);
|
|
if (state_in->stepcount == CHARS_PER_LINE/4)
|
|
{
|
|
*codechar++ = '\n';
|
|
state_in->stepcount = 0;
|
|
}
|
|
}
|
|
}
|
|
/* control should not reach here */
|
|
return (int)(codechar - code_out);
|
|
}
|
|
|
|
int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
|
|
{
|
|
char* codechar = code_out;
|
|
|
|
switch (state_in->step)
|
|
{
|
|
case step_B:
|
|
*codechar++ = base64_encode_value(state_in->result);
|
|
*codechar++ = '=';
|
|
*codechar++ = '=';
|
|
break;
|
|
case step_C:
|
|
*codechar++ = base64_encode_value(state_in->result);
|
|
*codechar++ = '=';
|
|
break;
|
|
case step_A:
|
|
break;
|
|
}
|
|
*codechar++ = '\n';
|
|
|
|
return (int)(codechar - code_out);
|
|
}
|
|
|