66    if (
next==NULL) 
return;
 
   72        _curr_node->
next = NULL;
 
 
  197    char asset[] = 
"{\"asset\": {\"copyright\", \"generator\", \"version\"}}";
 
 
  240    for (
int i=1; i<=4; i++) trans.
element(i, i, 1.0);
 
 
  258    while (facet!=NULL) {
 
  277            if (affine!=NULL) scale = affine->
getScale();
 
 
  303    if (shelldata==NULL) 
return;
 
  315    if (skin_joint!=NULL) {
 
  318        if (joints_connection!=NULL) {
 
  333    int shell_indexes  = 0;
 
  334    int shell_vertexes = 0;
 
  335    while (facet!=NULL) {
 
  349    facet = shelldata->
facet;
 
 
  453        for (
int j=1; j<=3; j++) {
 
  454            for (
int i=1; i<=4; i++) {
 
  462        for (
int j=1; j<=4; j++) {
 
  463            for (
int i=1; i<=4; i++) {
 
 
  488    memset(buf, 0, 
LBUF);
 
  495        memset(buf, 0, 
LBUF);
 
  510            for (
int j=1; j<=4; j++) {
 
  511                for (
int i=1; i<=4; i++) {
 
  512                    float element = (float)bstrans.
element(i, j);
 
 
  531    memset(buf, 0, 
LBUF);
 
  570            for (
int j=1; j<=4; j++) {
 
  571                for (
int i=1; i<=4; i++) {
 
  572                    float element = (float)trans.
element(i, j);
 
  586    if (jl!=NULL) jl = jl->next;     
 
  590        int jnt = jl->ldat.id;
 
  593            PRINT_MESG(
"GLTFData::addSkeletonNodes: ERROR: Joint is not in the correct order. %s != \"%s\"\n", 
 
  597        memset(buf, 0, 
LBUF);
 
  606            if (jp->ldat.lv==jl->ldat.id) {
 
 
  633    if (facet==NULL) 
return;
 
  636    while (facet!=NULL) {
 
  647                memset(buf, 0, 
LBUF);
 
  652                memset(buf, 0, 
LBUF);
 
 
  668    if (facet==NULL) 
return;
 
  671    while (facet!=NULL) {
 
  674            if (material_name[0]==
'#') material_name++;
 
  687                    img_no = lt->ldat.id;
 
  690                    PRINT_MESG(
"GLTFData::addMaterials: ERROR: lost image file (%s). this is coding miss!\n", (
char*)file_name.
buf);
 
  694                memset(buf, 0, 
LBUF);
 
 
  725    char kind_obj   = param.
getKind();
 
  729    float red       = (float)texture.
getColor(0);
 
  730    float green     = (float)texture.
getColor(1);
 
  731    float blue      = (float)texture.
getColor(2);
 
  732    float transp    = (float)texture.
getColor(3);
 
  733    memset(buf, 0, 
LBUF);
 
  739        memset(buf, 0, 
LBUF);
 
  747    if (kind_obj==
'T' || kind_obj==
'G') {       
 
  759        memset(buf, 0, 
LBUF);
 
  774    float glow = (float)param.
getGlow();
 
  776        memset(buf, 0, 
LBUF);
 
 
  788    if (facet==NULL) 
return;
 
  793    while (facet!=NULL) {
 
  795        if (material_name[0]==
'#') material_name++;
 
  800            mtl_no = lt->ldat.id;
 
  803            PRINT_MESG(
"GLTFData::addMeshes: ERROR: lost material (%s). this is coding miss!\n", material_name);
 
  806        memset(buf, 0, 
LBUF);
 
 
  831    memset(buf, 0, 
LBUF);
 
  835    for (
unsigned int j=0; j<this->
num_joints; j++) {
 
 
  883    if (facet==NULL) 
return;
 
  886    unsigned int float_size  = (
unsigned int)
sizeof(
float);
 
  887    unsigned int uint_size   = (
unsigned int)
sizeof(
unsigned int);
 
  888    unsigned int shortu_size = (
unsigned int)
sizeof(
short unsigned int);
 
  890    unsigned int v_stride = float_size*8U;                                                      
 
  891    unsigned int j_stride = v_stride + shortu_size*4U + float_size*4U;                          
 
  893    while (facet!=NULL) {
 
  895        unsigned int i_length = (
unsigned int)facet->
num_index*uint_size;                       
 
  896        memset(buf, 0, 
LBUF);
 
  903            unsigned int j_length = (
unsigned int)facet->
num_vertex*j_stride;                   
 
  904            memset(buf, 0, 
LBUF);
 
  911            unsigned int v_length = (
unsigned int)facet->
num_vertex*v_stride;                   
 
  912            memset(buf, 0, 
LBUF);
 
 
  933    if (facet==NULL) 
return;
 
  936    unsigned int float_size  = (
unsigned int)
sizeof(
float);
 
  937    unsigned int shortu_size = (
unsigned int)
sizeof(
short unsigned int);
 
  939    while (facet!=NULL) {
 
  943        memset(buf, 0, 
LBUF);
 
  950        unsigned int offset = 0;
 
  951        memset(buf, 0, 
LBUF);
 
  955        offset += float_size*3U;
 
  958        memset(buf, 0, 
LBUF);
 
  961        offset += float_size*3U;
 
  964        memset(buf, 0, 
LBUF);
 
  967        offset += float_size*2U;
 
  972            memset(buf, 0, 
LBUF);
 
  975            offset += shortu_size*4U;
 
  978            memset(buf, 0, 
LBUF);
 
  981            offset += float_size*4U;
 
 
 1000    if (facet==NULL) 
return;
 
 1002    unsigned int float_size  = (
unsigned int)
sizeof(
float);
 
 1003    unsigned int uint_size   = (
unsigned int)
sizeof(
unsigned int);
 
 1004    unsigned int shortu_size = (
unsigned int)
sizeof(
short unsigned int);
 
 1006    unsigned int j_length   = shortu_size*4U;
 
 1007    unsigned int w_length   = float_size*4U;
 
 1009    unsigned int temp_len = (
unsigned int)shell_indexes*uint_size + (
unsigned int)shell_vertexes*float_size*8U;     
 
 1011        temp_len += (
unsigned int)shell_vertexes*(j_length + w_length);      
 
 1013    unsigned char* temp_buffer = (
unsigned char*)malloc(temp_len);
 
 1014    if (temp_buffer==NULL) {
 
 1015        PRINT_MESG(
"GLTFData::createBinDataSeqAoS: ERROR: temp_buffer. no more memory.\n");
 
 1022            PRINT_MESG(
"GLTFData::createBinDataSeqAoS: ERROR: bin_buffer. no more memory.\n");
 
 1028    unsigned int offset   = 0U;
 
 1030    while (facet!=NULL) {
 
 1032        unsigned int i_length = (
unsigned int)facet->
num_index*uint_size;
 
 1033        memcpy((
void*)(temp_buffer + offset), (
void*)facet->
data_index, i_length);
 
 1040            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1041            offset += float_size;
 
 1043            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1044            offset += float_size;
 
 1046            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1047            offset += float_size;
 
 1049            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1050            offset += float_size;
 
 1052            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1053            offset += float_size;
 
 1055            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1056            offset += float_size;
 
 1058            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1059            offset += float_size;
 
 1061            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1062            offset += float_size;
 
 1065                unsigned int total = 0;
 
 1068                for (
unsigned int j=0; j<jnum; j++) {   
 
 1073                if (wcount>4) 
PRINT_MESG(
"GLTFData::createBinDataSeqAoS: WARNING: more than 4 weighted joints (%d)\n", wcount);
 
 1075                short unsigned int weight_index[4];
 
 1076                float              weight_value[4];
 
 1077                memset(weight_index, 0, j_length);
 
 1078                memset(weight_value, 0, w_length);
 
 1081                    unsigned int jcnt = 0;
 
 1084                    if (jl!=NULL) jl = jl->next;
 
 1087                        int jnt = jl->ldat.id;
 
 1088                        if (jnt<facet->weight_value[i].get_size()) {
 
 1091                                weight_index[jcnt] = (
short unsigned int)(jord);
 
 1092                                weight_value[jcnt] = (float)w/(
float)total;
 
 1101                memcpy((
void*)(temp_buffer + offset), (
void*)weight_index, j_length);
 
 1103                memcpy((
void*)(temp_buffer + offset), (
void*)weight_value, w_length);
 
 1107        facet = facet->
next;
 
 
 1131    if (facet==NULL) 
return;
 
 1134    unsigned int length = 0;
 
 1135    unsigned int float_size  = (
unsigned int)
sizeof(
float);
 
 1136    unsigned int uint_size   = (
unsigned int)
sizeof(
unsigned int);
 
 1137    unsigned int shortu_size = (
unsigned int)
sizeof(
short unsigned int);
 
 1139    while (facet!=NULL) {
 
 1141        length = (
unsigned int)facet->
num_index*uint_size;
 
 1142        memset(buf, 0, 
LBUF);
 
 1148        length = (
unsigned int)facet->
num_vertex*float_size*3U;
 
 1149        memset(buf, 0, 
LBUF);
 
 1155        length = (
unsigned int)facet->
num_vertex*float_size*3U;
 
 1156        memset(buf, 0, 
LBUF);
 
 1162        length = (
unsigned int)facet->
num_vertex*float_size*2U;
 
 1163        memset(buf, 0, 
LBUF);
 
 1170            length = (
unsigned int)facet->
num_vertex*shortu_size*4U;
 
 1171            memset(buf, 0, 
LBUF);
 
 1177            length = (
unsigned int)facet->
num_vertex*float_size*4U;
 
 1178            memset(buf, 0, 
LBUF);
 
 1183        facet = facet->
next;
 
 
 1191    if (facet==NULL) 
return;
 
 1194    while (facet!=NULL) {
 
 1198        memset(buf, 0, 
LBUF);
 
 1205        memset(buf, 0, 
LBUF);
 
 1212        memset(buf, 0, 
LBUF);
 
 1218        memset(buf, 0, 
LBUF);
 
 1226            memset(buf, 0, 
LBUF);
 
 1232            memset(buf, 0, 
LBUF);
 
 1239        facet = facet->
next;
 
 
 1261    if (facet==NULL) 
return;
 
 1263    unsigned int float_size  = (
unsigned int)
sizeof(
float);
 
 1264    unsigned int uint_size   = (
unsigned int)
sizeof(
unsigned int);
 
 1265    unsigned int shortu_size = (
unsigned int)
sizeof(
short unsigned int);
 
 1267    unsigned int j_length = shortu_size*4U;
 
 1268    unsigned int w_length = float_size*4U;
 
 1270    unsigned int temp_len = (
unsigned int)shell_indexes*uint_size + (
unsigned int)shell_vertexes*float_size*8U;     
 
 1272        temp_len += (
unsigned int)shell_vertexes*(j_length + w_length);      
 
 1274    unsigned char* temp_buffer = (
unsigned char*)malloc(temp_len);
 
 1275    if (temp_buffer==NULL) {
 
 1276        PRINT_MESG(
"GLTFData::createBinDataSeqSoA: ERROR: temp_buffer. no more memory.\n");
 
 1283            PRINT_MESG(
"GLTFData::createBinDataSeqSoA: ERROR: bin_buffer. no more memory.\n");
 
 1289    unsigned int offset   = 0U;
 
 1291    while (facet!=NULL) {
 
 1293        unsigned int i_length = (
unsigned int)facet->
num_index*
sizeof(
unsigned int);
 
 1294        memcpy((
void*)(temp_buffer + offset), (
void*)facet->
data_index, i_length);
 
 1301            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1302            offset += float_size;
 
 1304            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1305            offset += float_size;
 
 1307            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1308            offset += float_size;
 
 1313            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1314            offset += float_size;
 
 1316            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1317            offset += float_size;
 
 1319            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1320            offset += float_size;
 
 1325            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1326            offset += float_size;
 
 1328            memcpy((
void*)(temp_buffer + offset), (
void*)&temp, float_size);
 
 1329            offset += float_size;
 
 1335                unsigned int total = 0;
 
 1338                for (
unsigned int j=0; j<jnum; j++) {
 
 1343                if (wcount>4) 
PRINT_MESG(
"GLTFData::createBinDataSeqSoA: WARNING: more than 4 weighted joints (%d)\n", wcount);
 
 1345                short unsigned int weight_index[4];
 
 1346                memset(weight_index, 0, j_length);
 
 1349                    unsigned int jcnt = 0;
 
 1352                    if (jl!=NULL) jl = jl->next;
 
 1355                        int jnt = jl->ldat.id;
 
 1356                        if (jnt<facet->weight_value[i].get_size()) {
 
 1359                                weight_index[jcnt] = (
short unsigned int)(jord);
 
 1368                memcpy((
void*)(temp_buffer + offset), (
void*)weight_index, j_length);
 
 1373                unsigned int total = 0;
 
 1375                for (
unsigned int j=0; j<jnum; j++) {
 
 1378                float weight_value[4];
 
 1379                memset(weight_value, 0, w_length);
 
 1382                    unsigned int jcnt = 0;
 
 1384                    if (jl!=NULL) jl = jl->next;
 
 1387                        int jnt = jl->ldat.id;
 
 1388                        if (jnt<facet->weight_value[i].get_size()) {
 
 1391                                weight_value[jcnt] = (float)w/(
float)total;
 
 1399                memcpy((
void*)(temp_buffer + offset), (
void*)weight_value, w_length);
 
 1403        facet = facet->
next;
 
 
 1430    unsigned int float_size  = (
unsigned int)
sizeof(
float);
 
 1431    unsigned int uint_size   = (
unsigned int)
sizeof(
unsigned int);
 
 1432    unsigned int shortu_size = (
unsigned int)
sizeof(
short unsigned int);
 
 1434    unsigned int j_length = shortu_size*4U;
 
 1435    unsigned int w_length = float_size*4U;
 
 1441    shell_node->
vi = (
unsigned int*) malloc(uint_size*shell_indexes);
 
 1448        shell_node->
vm = (
float*)malloc(float_size*16U*this->
num_joints);
 
 1451    if (shell_node->
vi==NULL || shell_node->
vv==NULL || shell_node->
vn==NULL || shell_node->
vu==NULL) {
 
 1456        if (shell_node->
vj==NULL || shell_node->
vw==NULL || shell_node->
vm==NULL) {
 
 1464    while (temp_facet!=NULL) {
 
 1466        temp_facet = temp_facet->
next;
 
 1471    float mag_fac = 1.0f;
 
 1476    unsigned int index_offset  = 0;
 
 1477    unsigned int vertex_offset = 0;
 
 1478    unsigned int facet_no      = 0;
 
 1480    while (facet!=NULL) {
 
 1487        for (
int i=0; i<facet->
num_index; i++) {
 
 1488            shell_node->
vi[index_offset + i] = facet->
data_index[i];
 
 1494            shell_node->
vv[vertex_offset + i]   = facet->
vertex_value[i] * mag_fac;
 
 1497            shell_node->
vu[vertex_offset + i].
v = 1.0f - (float)facet->
texcrd_value[i].
v;
 
 1502                unsigned int total = 0;
 
 1505                for (
unsigned int j=0; j<jnum; j++) {
 
 1511                    PRINT_MESG(
"GLTFData::createShellGeomertyData: WARNING: more than 4 weighted joints (%d)\n", wcount);
 
 1514                short unsigned int weight_index[4];
 
 1515                float              weight_value[4];
 
 1516                memset(weight_index, 0, j_length);
 
 1517                memset(weight_value, 0, w_length);
 
 1519                    unsigned int jcnt = 0;
 
 1522                    if (jl!=NULL) jl = jl->next;
 
 1525                        int jnt = (
unsigned int)jl->ldat.id;
 
 1526                        if (jnt<facet->weight_value[i].get_size()) {
 
 1529                                weight_index[jcnt] = (
short unsigned int)(jord);
 
 1530                                weight_value[jcnt] = (float)w/(
float)total;
 
 1541                for (
int j=0; j<4; j++) {
 
 1542                    shell_node->
vj[vertex_offset + i].
element(j+1) = weight_index[j];
 
 1543                    shell_node->
vw[vertex_offset + i].
element(j+1) = weight_value[j];
 
 1548        facet = facet->
next;
 
 1555        if (jl!=NULL) jl = jl->next;
 
 1557            int jnt = jl->ldat.id;
 
 1563            int ks = (int)jord*16;
 
 1564            for (
int j=1; j<=4; j++) {
 
 1566                for (
int i=1; i<=4; i++) {
 
 1567                    shell_node->
vm[ks + js + i - 1] = (float)ibm_trans.
element(i, j);
 
 1583    if (prv==NULL) this->
shellNode = shell_node;
 
 1584    else           prv->
next       = shell_node;
 
 
 1598    unsigned int float_size  = (
unsigned int)
sizeof(
float);
 
 1599    unsigned int uint_size   = (
unsigned int)
sizeof(
unsigned int);
 
 1600    unsigned int shortu_size = (
unsigned int)
sizeof(
short unsigned int);
 
 1602    unsigned int j_length = shortu_size*4U;
 
 1603    unsigned int w_length = float_size*4U;
 
 1604    unsigned int f_length = float_size*16U*this->
num_joints;
 
 1606    unsigned int solid_indexes  = 0;
 
 1607    unsigned int solid_vertexes = 0;
 
 1609    while (shell_node!=NULL) {
 
 1612        shell_node = shell_node->
next;
 
 1615    unsigned int buffer_len = solid_indexes*uint_size + solid_vertexes*float_size*8U;        
 
 1617        buffer_len += solid_vertexes*(j_length + w_length) + this->
shell_no*f_length;        
 
 1621        PRINT_MESG(
"GLTFData::createBinDataAoS: ERROR: No more memory.\n");
 
 1626    while (shell_node!=NULL) {             
 
 1627        unsigned int i_offset = 0;
 
 1628        unsigned int v_offset = 0;
 
 1629        for (
unsigned int f=0; f<shell_node->
num_facets; f++) {      
 
 1631            unsigned int i_length = shell_node->
facet_index[f] * uint_size;
 
 1632            cat_b2Buffer(shell_node->
vi + i_offset, &(this->bin_buffer), i_length);
 
 1635            for (
unsigned int i=0; i<shell_node->
facet_vertex[f]; i++) {
 
 1637                cat_b2Buffer(&shell_node->
vv[v_offset + i].
x, &(this->bin_buffer), float_size);
 
 1638                cat_b2Buffer(&shell_node->
vv[v_offset + i].
y, &(this->bin_buffer), float_size);
 
 1639                cat_b2Buffer(&shell_node->
vv[v_offset + i].
z, &(this->bin_buffer), float_size);
 
 1641                cat_b2Buffer(&shell_node->
vn[v_offset + i].
x, &(this->bin_buffer), float_size);
 
 1642                cat_b2Buffer(&shell_node->
vn[v_offset + i].
y, &(this->bin_buffer), float_size);
 
 1643                cat_b2Buffer(&shell_node->
vn[v_offset + i].
z, &(this->bin_buffer), float_size);
 
 1645                cat_b2Buffer(&shell_node->
vu[v_offset + i].
u, &(this->bin_buffer), float_size);
 
 1646                cat_b2Buffer(&shell_node->
vu[v_offset + i].
v, &(this->bin_buffer), float_size);
 
 1650                    for (
int j=1; j<=4; j++) {
 
 1654                    for (
int j=1; j<=4; j++) {
 
 1664            for (
unsigned int i=0; i<this->num_joints*16; i++) {
 
 1665                cat_b2Buffer(&shell_node->
vm[(
int)i], &(this->bin_buffer), float_size);
 
 1669        shell_node = shell_node->
next;
 
 
 1684    unsigned int float_size  = (
unsigned int)
sizeof(
float);
 
 1685    unsigned int uint_size   = (
unsigned int)
sizeof(
unsigned int);
 
 1686    unsigned int shortu_size = (
unsigned int)
sizeof(
short unsigned int);
 
 1688    unsigned int j_length = shortu_size*4U;
 
 1689    unsigned int w_length = float_size*4U;
 
 1691    unsigned int solid_indexes  = 0;
 
 1692    unsigned int solid_vertexes = 0;
 
 1694    while (shell_node!=NULL) {
 
 1697        shell_node = shell_node->
next;
 
 1700    unsigned int buffer_len = (
unsigned int)solid_indexes*uint_size + (
unsigned int)solid_vertexes*float_size*8U;           
 
 1702        buffer_len += (
unsigned int)solid_vertexes*(j_length + w_length) + (
unsigned int)this->
num_joints*float_size*16U;   
 
 1706        PRINT_MESG(
"GLTFData::createBinDataSoA: ERROR: No more memory.\n");
 
 1711    while (shell_node!=NULL) {             
 
 1712        unsigned int i_offset = 0;
 
 1713        unsigned int v_offset = 0;
 
 1714        for (
unsigned int f=0; f<shell_node->
num_facets; f++) {      
 
 1716            unsigned int i_length = shell_node->
facet_index[f] * uint_size;
 
 1717            cat_b2Buffer(shell_node->
vi + i_offset, &(this->bin_buffer), i_length);
 
 1721            for (
unsigned int i=0; i<shell_node->
facet_vertex[f]; i++) {
 
 1722                cat_b2Buffer(&shell_node->
vv[v_offset + i].
x, &(this->bin_buffer), float_size);
 
 1723                cat_b2Buffer(&shell_node->
vv[v_offset + i].
y, &(this->bin_buffer), float_size);
 
 1724                cat_b2Buffer(&shell_node->
vv[v_offset + i].
z, &(this->bin_buffer), float_size);
 
 1727            for (
unsigned int i=0; i<shell_node->
facet_vertex[f]; i++) {
 
 1728                cat_b2Buffer(&shell_node->
vn[v_offset + i].
x, &(this->bin_buffer), float_size);
 
 1729                cat_b2Buffer(&shell_node->
vn[v_offset + i].
y, &(this->bin_buffer), float_size);
 
 1730                cat_b2Buffer(&shell_node->
vn[v_offset + i].
z, &(this->bin_buffer), float_size);
 
 1733            for (
unsigned int i=0; i<shell_node->
facet_vertex[f]; i++) {
 
 1734                cat_b2Buffer(&shell_node->
vu[v_offset + i].
u, &(this->bin_buffer), float_size);
 
 1735                cat_b2Buffer(&shell_node->
vu[v_offset + i].
v, &(this->bin_buffer), float_size);
 
 1740                for (
unsigned int i=0; i<shell_node->
facet_vertex[f]; i++) {
 
 1741                    for (
int j=1; j<=4; j++) {
 
 1742                        short unsigned int jnt = shell_node->
vj[v_offset + i].
element(j);
 
 1747                for (
unsigned int i=0; i<shell_node->
facet_vertex[f]; i++) {
 
 1748                    for (
int j=1; j<=4; j++) {
 
 1749                        float wgt = (float)shell_node->
vw[v_offset + i].
element(j);
 
 1759            for (
unsigned int i=0; i<this->
num_joints*16U; i++) {
 
 1760                cat_b2Buffer(&shell_node->
vm[(
int)i], &(this->bin_buffer), float_size);
 
 1764        shell_node = shell_node->
next;
 
 
 1776    unsigned int float_size = (
unsigned int)
sizeof(
float);
 
 1779    unsigned int length = float_size*16U*this->
num_joints;
 
 1780    memset(buf, 0, 
LBUF);
 
 
 1791    memset(buf, 0, 
LBUF);
 
 
 1803    if (skin_joint==NULL) 
return;
 
 1804    unsigned int float_size = (
unsigned int)
sizeof(
float);
 
 1807    if (jl!=NULL) jl = jl->next;
 
 1809        int jnt = jl->ldat.id;
 
 1815        for (
int j=1; j<=4; j++) {
 
 1816            for (
int i=1; i<=4; i++) {
 
 1817                float ibm = (float)ibm_trans.
element(i, j);
 
 
 1840    if (file_name.
buf[0]==
'.') file_name.
buf[0] = 
'_';
 
 1844        this->
output_glb ((
char*)file_name.
buf, (
char*)out_dirn, (
char*)tex_dirn, (
char*)bin_dirn);
 
 1847        this->
output_gltf((
char*)file_name.
buf, (
char*)out_dirn, (
char*)tex_dirn, (
char*)bin_dirn);
 
 
 1878    memset(buf, 0, 
LBUF);
 
 1895    FILE* fp = fopen((
char*)out_path.
buf, 
"w");
 
 1901        PRINT_MESG(
"GLTFData::output_gltf: ERROR: Json file open Error! (%s)\n", (
char*)out_path.
buf);
 
 1905    fp = fopen((
char*)bin_path.
buf, 
"wb");
 
 1907        fwrite((
void*)(this->
bin_buffer.
buf), this->bin_buffer.vldsz, 1, fp);
 
 1911        PRINT_MESG(
"GLTFData::output_gltf: ERROR: Binary file open Error! (%s)\n", (
char*)bin_path.
buf);
 
 
 1928    memset(buf, 0, 
LBUF);
 
 1949        while (info!=NULL) {
 
 1959    uDWord pad        = (4 - len%4)%4;          
 
 1960    json_chunk.
length = len + pad;
 
 1961    json_chunk.
pad    = pad;
 
 1968    pad = (4 - len%4)%4;
 
 1969    bin_chunk.
length = len + pad;
 
 1970    bin_chunk.
pad    = pad;
 
 1977    FILE* fp = fopen((
char*)out_path.
buf, 
"wb");
 
 1981        fwrite((
void*)(&json_chunk), 
sizeof(
uDWord)*2, 1, fp);
 
 1982        fwrite((
void*)(json_chunk.
data), json_out.
vldsz, 1, fp);
 
 1983        for (
uDWord i=0; i<json_chunk.
pad; i++) fwrite((
void*)
" ", 1, 1, fp);
 
 1985        fwrite((
void*)(&bin_chunk), 
sizeof(
uDWord)*2, 1, fp);
 
 1987        for (
uDWord i=0; i<bin_chunk.
pad; i++) fwrite((
void*)
"\0", 1, 1, fp);
 
 1990        while (tex_info!=NULL) {
 
 1991            FILE* tp = fopen((
char*)tex_info->
fname->
buf, 
"rb");
 
 1994                if (tex_buf!=NULL) {
 
 1995                    size_t ret = fread(tex_buf, 1, tex_info->
length, tp);
 
 1997                        PRINT_MESG(
"GLTFData::output_glb: ERROR: Texture file read Error! (%s)\n",  (
char*)tex_info->
fname->
buf);
 
 1999                    fwrite((
void*)tex_buf, tex_info->
length, 1, fp);
 
 2000                    for (
uDWord i=0; i<tex_info->
pad; i++) fwrite((
void*)
"\0", 1, 1, fp);
 
 2006                PRINT_MESG(
"GLTFData::output_glb: ERROR: Texture file open Error! (%s)\n",  (
char*)tex_info->
fname->
buf);
 
 2008            tex_info = tex_info->
next;
 
 2013        PRINT_MESG(
"GLTFData::output_glb: ERROR: GLB file open Error! (%s)\n",  (
char*)out_path.
buf);
 
 
 2027    if (tex_dirn==NULL) 
return;
 
 2030    if (json!=NULL) json = json->next;
 
 2032        while (json->esis!=NULL) json = json->esis;
 
 2035    while (json!=NULL) {     
 
 2044            uri->ldat.val = *tex;
 
 
 2141    while (tex_info!=NULL) {
 
 2143        memset(buf, 0, 
LBUF);
 
 2148        memset(buf, 0, 
LBUF);
 
 2156        tex_size = tex_size + length;
 
 2157        tex_info = tex_info->
next;
 
 2162    uDWord bin_pad = (4 - bin_len%4)%4;
 
 2165    tJson* buffer_len = buffer_uri->ysis;
 
 
 2177    if (tjsn!=NULL) tjsn = tjsn->next;
 
 2179        while (tjsn->esis!=NULL) tjsn = tjsn->esis;
 
 2186    while (tjsn!=NULL) {     
 
 2188        if (texture_uri!=NULL) {
 
 2192            (*n_info)->fname  = 
new_Buffer((
int)strlen(tex_dirn) + texture_uri->ldat.val.vldsz + 2);     
 
 2193            (*n_info)->json   = texture_uri;
 
 2194            (*n_info)->next   = NULL;
 
 2197            if (texture_uri->ldat.val.buf[0]==
'"') {                                                
 
 2198                cat_s2Buffer(&(texture_uri->ldat.val.buf[1]), (*n_info)->fname);
 
 2200            if ((*n_info)->fname->buf[(*n_info)->fname->vldsz-1]==
'"') {                            
 
 2201                (*n_info)->fname->buf[(*n_info)->fname->vldsz-1] = 
'\0';
 
 2202                (*n_info)->fname->vldsz--;
 
 2206            (*n_info)->length = len;
 
 2207            (*n_info)->pad    = (4 - len%4)%4;
 
 2209            n_info = &((*n_info)->next);
 
 
 2228    while (tinfo!=NULL) {
 
 
#define MATERIAL_ALPHA_MASKING
 
#define MATERIAL_ALPHA_NONE
 
#define MATERIAL_MAPPING_PLANAR
 
#define MATERIAL_ALPHA_BLENDING
 
Buffer make_Buffer(int sz)
Buffer型変数のバッファ部をつくり出す.
 
int cat_b2Buffer(void *src, Buffer *dst, int len)
任意のバイナリデータsrcを Buffer型変数dstへ lenバイト catする.
 
void free_Buffer(Buffer *buf)
Buffer型変数のバッファ部を解放する
 
Buffer init_Buffer()
初期化したBuffer型変数を返す.
 
Buffer dup_Buffer(Buffer buf)
Buffer型変数のコピーをつくる.
 
int cat_i2Buffer(int src, Buffer *dst)
整数 srcを文字列に変換して,dstへ catする.
 
Buffer * new_Buffer(int sz)
空のBuffer型変数を生成する.
 
#define make_Buffer_str(str)
set_Buffer()
 
#define cat_s2Buffer(src, dst)
cat_b2Buffer()
 
#define make_Buffer_bystr(str)
set_Buffer()
 
void setShift(T x, T y, T z)
 
void computeMatrix(bool with_scale=true)
 
AffineTrans< T > getInverseAffine(void)
 
Vector< T > getScale(void)
 
void affineMatrixAfter(AffineTrans< T > a)
 
Vector< T > execRotationScale(Vector< T > v)
 
void computeComponents(void)
 
void element(int i, int j, T v)
 
void affineMatrixBefore(AffineTrans< T > a)
 
Vector< T > getShift(void)
 
void addRootNode(AffineTrans< double > *affine)
 
void createBinDataSeqSoA(MeshFacetNode *facet, int shell_indexes, int shell_vertexes)
 
GLTFShellNode * shellNode
 
void addShell(MeshObjectData *meshdata, bool collider, SkinJointData *skin_joint=NULL, tList *joints_info=NULL)
 
AffineTrans< double > affineRoot
 
glbTextureInfo * getGLBTextureInfo(const char *tex_dirn)
 
void freeGLBTextureInfo(glbTextureInfo *tex_info)
 
void addMeshes(MeshFacetNode *facet)
 
AffineTrans< double > getAffineBaseTrans4Engine(void)
 
void execAffineUVMap(MeshFacetNode *facet, AffineTrans< double > *affine)
 
void addAccessorsAoS(MeshFacetNode *facet)
 
uDWord convertJson_gltf2glb(glbTextureInfo *tex_info)
 
void createBinDataAoS(void)
 
void addAccessorsSoA(MeshFacetNode *facet)
 
void createBinDataIBM(SkinJointData *skin_joint, AffineTrans< double > *ue_trans=NULL)
 
gltfFacetMinMax getFacetMinMax(MeshFacetNode *facet)
 
void convertJson_TexturePath(char *tex_dirn)
 
unsigned int mesh_prim_no
 
void outputFile(const char *fn, const char *out_dirn, const char *tex_dirn, const char *bin_dirn)
 
void addMaterials(MeshFacetNode *facet)
 
void createShellGeometryData(MeshFacetNode *facet, int shell_indexes, int shell_vertexes, SkinJointData *skin_joint=NULL, AffineTrans< double > *ue_trans=NULL)
 
void addTextures(MeshFacetNode *facet)
 
void addMaterialParameters(tJson *pbr, MeshFacetNode *facet)
 
unsigned int joint_offset
 
void addBufferViewsIBM(void)
 
void addBufferViewsSoA(MeshFacetNode *facet)
 
void createBinDataSoA(void)
 
void output_glb(char *fn, char *out_dirn, char *tex_dirn, char *bin_dirn)
 
void createBinDataSeqAoS(MeshFacetNode *facet, int shell_indexes, int shell_vertexes)
 
void addNodes(AffineTrans< double > *affine)
 
void addBufferViewsAoS(MeshFacetNode *facet)
 
void addAccessorsIBM(void)
 
void addSkeletonNodes(SkinJointData *skin_joint, AffineTrans< double > *affin)
 
void output_gltf(char *fn, char *out_dirn, char *tex_dirn, char *bin_dirn)
 
unsigned int shell_vertexes
 
unsigned int shell_indexes
 
unsigned int * facet_index
 
Vector4< short unsigned > * vj
 
unsigned int * facet_vertex
 
void printParam(FILE *fp)
 
TextureParam texture
テクスチャ
 
double getShininess(void)
 
MeshObject の Polygonデータ(1面)を格納するクラス.リスト構造を取る.
 
MaterialParam material_param
マテリアルパラメータ
 
Vector< double > * normal_value
法線ベクトルデータの並び.要素数は num_vertex
 
bool same_material
他の Node が既に同じマテリアルを使用している.
 
int num_texcrd
テクスチャ画像の座標数.通常は num_vertex に等しい.(texcrd_value の要素数)
 
int num_index
頂点の延べ数.num_polygon*MeshObjectData::num_vcount (num_polygon*3)(data_index の要素数)
 
void execAffineTransUVMap(UVMap< double > *uvmap=NULL, int num=-1)
 
ArrayParam< int > * weight_value
頂点の重み.Jointを持つデータに使用される.要素数は num_vertex. 各 weight_value[i] の値は トータルで正規化される必要がある.
 
int * data_index
インデックスデータ.要素数は num_index
 
UVMap< double > * texcrd_value
テクスチャマップの並び.要素数は num_texcrd
 
UVMap< double > * generatePlanarUVMap(Vector< double > scale, UVMap< double > *uvmap=NULL)
 
Buffer material_id
マテリアルを識別するID.JBXL_MATERIAL_PREFIX で始まる.
 
int num_vertex
頂点のデータ数.(vertex_value, normal_value の要素数)
 
Vector< double > * vertex_value
頂点データの並び.要素数は num_vertex
 
AffineTrans< double > * affineTrans
アフィン変換.ここで使用するのは,shift, rotate, scale(size) のみ
 
MeshFacetNode * facet
FACETデータ(1面のポリゴンデータ)のリストへのポインタ
 
AffineTrans< double > bind_shape
 
AffineTrans< double > * alt_inverse_bind
 
AffineTrans< double > * inverse_bind
 
ArrayParam< char * > joint_names
Joint名の配列.
 
double getAlphaCutoff(void)
 
bool hasAlphaChannel(void)
 
Vector< double > getColor(void)
 
#define JBXL_3D_ENGINE_UE
 
#define JBXL_3D_ENGINE_UNITY
 
int bufsz
確保してあるバッファの大きさ - 1.
 
int vldsz
データの長さ.バイナリデータの場合も使用可能.文字列の場合は 0x00 を含まない.
 
unsigned char * buf
バッファの先頭へのポインタ.str[bufsz]は必ず 0x00となる.
 
struct _glb_texture_info * next
 
tJson * json_append_array_key(tJson *json, const char *key)
値(value)なしの配列 "key":[] を追加する.
 
void print_json(FILE *fp, tJson *json, int mode)
tJsonデータをmodeに従って fp に出力する.
 
tJson * search_key_json(tJson *pp, const char *key, int needval, int nn)
名前(属性名)が key である nn番目のノードへのポインタを返す
 
Buffer json_inverse_parse(tJson *pp, int mode)
tJsonデータをmodeに従って元の書式に戻して Bufferに格納する.
 
tJson * search_double_key_json(tJson *pp, const char *key1, const char *key2, int needval)
属性名が key1 -> key2 の親子関係を持つ,key2ノードのポインタを返す.
 
tJson * json_insert_parse(tJson *json, const char *str)
str をパースして繋げる.str は { または [ で始まる必要がある.
 
void json_append_array_real_val(tJson *json, float val)
配列 [] の要素として 実数 val を追加する.
 
void json_append_array_int_val(tJson *json, int val)
配列 [] の要素として 整数 val を追加する.
 
void json_set_str_val(tJson *json, const char *val)
json ノード "key":val に文字列の属性値(value)を設定する.
 
void json_set_int_val(tJson *json, int val)
json ノード "key":val に整数の属性値(value)を設定する.
 
tJson * json_parse(const char *str, int num)
文字列のJSONデータを解釈して,tJsonのツリーを生成する.ANCHOR付き.
 
#define JSON_INDENT_FORMAT
先頭にインデント(TAB)をつけ,ノードごとに改行する.
 
#define JSON_ONELINE_FORMAT
改行なしの一行にする.
 
#define del_json_node(j)
JSONデータのノード削除 del_tTree_node()
 
#define del_json(j)
JSONデータの削除 del_tTree()
 
tList * new_tList_anchor_node(void)
リスト用の ANCHORノードを動的に生成.
 
tList * del_tList(tList **pp)
指定したリストノード以降のリストを削除.
 
tList * find_tList_end(tList *pl)
リストの最後のノードを探す.
 
tList * add_tList_node_bystr(tList *pp, int id, int lv, const char *key, const char *val, void *ptr, int sz)
文字列データからリスト用ノードを生成し(new),それをリストに追加.
 
tList * search_key_tList(tList *pl, const char *key, int no)
リストの中から no番目の keyノード(ldat.key)を探し出し,tListへのポインタを返す.大文字小文字を無視.