From 42cd8265f554efdd0b88fe37e19420cb25b57e66 Mon Sep 17 00:00:00 2001 From: Xiang Silian Date: Wed, 15 Oct 2025 17:08:09 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=90=8D=E7=A7=B0=E4=B8=BAdemo0=202=E3=80=81?= =?UTF-8?q?1=E7=A7=92=E9=92=9F=E5=90=8E=E6=97=A0=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E7=82=B9=E5=B0=B1=E4=B8=8D=E7=94=BB=E7=BA=BF=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E5=B9=B3=E5=8F=B0=E5=88=A4=E6=96=AD=203?= =?UTF-8?q?=E3=80=81=E6=B7=BB=E5=8A=A0=E4=BA=86=E8=83=8C=E9=9D=A2=E5=89=94?= =?UTF-8?q?=E9=99=A4=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- samples/api/texture_loading/hardcode_data.h | 89 +++++++++++++++++++ .../api/texture_loading/texture_loading.cpp | 84 +++++++++-------- samples/api/texture_loading/texture_loading.h | 3 +- 3 files changed, 137 insertions(+), 39 deletions(-) create mode 100644 samples/api/texture_loading/hardcode_data.h diff --git a/samples/api/texture_loading/hardcode_data.h b/samples/api/texture_loading/hardcode_data.h new file mode 100644 index 0000000..7e79192 --- /dev/null +++ b/samples/api/texture_loading/hardcode_data.h @@ -0,0 +1,89 @@ +#ifndef __Hard_Code_Data__ +#define __Hard_Code_Data__ +#include + +class HardCodeData +{ +public: + static HardCodeData& Get() { + static HardCodeData instance; + return instance; + } + + + + // 顶点索引映射表 + // 用于将face_picture_3dmax.obj的顶点索引映射到face_picture.obj的顶点索引 + // 生成说明: modified_vertex_index -> original_vertex_index + // 注意: 这个映射是严格的一对一匹配,匹配容差为1e-4 + const int indexMap[468] = { + 127, 34, 139, 11, 0, 37, 232, 231, 120, 72, + 39, 128, 121, 47, 104, 69, 67, 175, 171, 148, + 118, 50, 101, 73, 40, 9, 151, 108, 48, 115, + 131, 194, 204, 211, 74, 185, 80, 42, 183, 92, + 186, 230, 229, 202, 212, 214, 83, 18, 17, 76, + 61, 146, 160, 29, 30, 56, 157, 173, 106, 135, + 192, 203, 165, 98, 21, 71, 68, 51, 45, 4, + 144, 24, 23, 77, 91, 205, 187, 201, 200, 182, + 90, 181, 85, 84, 206, 36, 140, 193, 189, 244, + 159, 158, 28, 247, 246, 161, 236, 3, 196, 54, + 168, 8, 117, 228, 31, 55, 97, 99, 126, 100, + 166, 79, 218, 155, 154, 26, 209, 49, 136, 150, + 217, 223, 52, 53, 134, 170, 43, 119, 226, 130, + 63, 238, 20, 242, 46, 70, 156, 78, 62, 96, + 143, 227, 123, 111, 44, 125, 19, 216, 153, 22, + 167, 208, 142, 57, 60, 35, 113, 27, 210, 225, + 137, 116, 41, 38, 129, 64, 240, 102, 207, 184, + 169, 149, 176, 105, 66, 122, 6, 147, 65, 107, + 89, 180, 93, 15, 86, 14, 87, 145, 88, 179, + 95, 138, 172, 215, 58, 219, 81, 195, 199, 82, + 163, 110, 234, 109, 235, 191, 222, 141, 221, 197, + 25, 7, 33, 220, 237, 245, 162, 188, 174, 2, + 241, 164, 12, 13, 198, 133, 112, 243, 239, 190, + 32, 178, 132, 177, 1, 213, 59, 94, 75, 224, + 233, 114, 124, 356, 389, 368, 302, 267, 452, 350, + 349, 303, 269, 357, 343, 277, 453, 333, 332, 297, + 152, 377, 347, 348, 330, 304, 270, 336, 337, 278, + 279, 360, 418, 262, 431, 408, 409, 310, 415, 407, + 410, 450, 422, 430, 434, 313, 314, 306, 307, 375, + 387, 388, 260, 286, 414, 398, 335, 406, 364, 367, + 416, 423, 358, 327, 251, 284, 298, 281, 5, 373, + 374, 253, 320, 321, 425, 427, 411, 421, 405, 404, + 315, 16, 426, 266, 400, 369, 322, 391, 417, 465, + 464, 386, 257, 258, 466, 456, 399, 419, 285, 346, + 340, 261, 413, 441, 460, 328, 355, 371, 329, 392, + 439, 438, 382, 341, 256, 429, 420, 394, 379, 437, + 443, 444, 283, 275, 440, 363, 338, 273, 451, 446, + 342, 467, 293, 334, 282, 458, 461, 462, 276, 353, + 383, 308, 324, 325, 300, 372, 345, 447, 352, 274, + 248, 436, 381, 252, 393, 428, 287, 250, 384, 265, + 259, 424, 292, 366, 271, 294, 455, 272, 432, 395, + 299, 351, 280, 319, 295, 296, 403, 323, 454, 316, + 380, 318, 402, 365, 435, 397, 344, 311, 291, 396, + 268, 445, 254, 339, 449, 264, 10, 442, 370, 263, + 255, 359, 412, 301, 378, 326, 457, 362, 459, 463, + 354, 401, 361, 309, 376, 433, 289, 305, 448, 290, + 288, 249, 103, 385, 331, 317, 312, 390 + }; + + + + + + + + + + + + + + + + std::string face_result_point_str = "0.497176,0.654941,0.056854,0.499096,0.571142,0.101093,0.499443,0.594826,0.053191,0.486665,0.507695,0.075654,0.499822,0.551577,0.107729,0.501566,0.526343,0.100379,0.507274,0.464574,0.049972,0.384071,0.451689,-0.029412,0.510934,0.411708,0.038101,0.512489,0.385395,0.042231,0.517780,0.303259,0.021708,0.496729,0.663534,0.054564,0.496503,0.672256,0.047820,0.495962,0.678167,0.039046,0.495333,0.708580,0.029263,0.494208,0.719311,0.031647,0.493171,0.732978,0.033173,0.491888,0.745546,0.026135,0.491751,0.757028,0.002595,0.499114,0.582417,0.091598,0.482417,0.582563,0.065089,0.331655,0.382730,-0.120031,0.430957,0.469391,-0.008093,0.414008,0.470789,-0.010267,0.397406,0.470345,-0.016058,0.377172,0.459990,-0.032563,0.445480,0.465845,-0.008916,0.407104,0.414617,-0.002052,0.427153,0.417373,-0.000860,0.388613,0.417688,-0.008829,0.376612,0.425300,-0.017125,0.363639,0.473838,-0.041905,0.424317,0.760712,-0.022355,0.378095,0.447231,-0.035613,0.321751,0.462365,-0.127255,0.346235,0.459834,-0.061681,0.412989,0.556626,0.007719,0.474707,0.648701,0.052639,0.477565,0.671162,0.044046,0.453343,0.656598,0.040157,0.441169,0.666182,0.025390,0.462063,0.673138,0.035794,0.451410,0.677070,0.022132,0.415549,0.701012,-0.009850,0.482972,0.570121,0.099036,0.480842,0.550994,0.104616,0.354530,0.407162,-0.024088,0.450885,0.506449,0.013582,0.439753,0.566562,0.050407,0.438681,0.556687,0.044705,0.367658,0.552965,-0.017865,0.483477,0.527524,0.093462,0.393368,0.385091,0.011027,0.369870,0.392510,-0.004918,0.346767,0.349522,-0.082266,0.471944,0.404162,0.030519,0.443971,0.426069,-0.005504,0.406778,0.677611,-0.012820,0.343144,0.640875,-0.180424,0.453649,0.577968,0.043753,0.469357,0.585499,0.046754,0.428715,0.686186,-0.007846,0.434532,0.686292,-0.001798,0.361692,0.380369,-0.014286,0.439307,0.577039,0.040063,0.426476,0.386744,0.023408,0.423940,0.371093,0.027273,0.414777,0.307725,-0.007059,0.353887,0.365024,-0.043705,0.420427,0.340030,0.011343,0.346111,0.399299,-0.040411,0.338442,0.392337,-0.078127,0.475432,0.660558,0.050712,0.457661,0.665396,0.039118,0.445976,0.671356,0.025472,0.458571,0.583021,0.040336,0.431722,0.686313,-0.004415,0.435878,0.695282,0.004963,0.437489,0.686573,-0.001261,0.462763,0.569201,0.070216,0.456034,0.680024,0.019362,0.466256,0.677225,0.028576,0.479924,0.676736,0.036048,0.464911,0.752547,0.001659,0.466742,0.740062,0.024617,0.469333,0.727902,0.030009,0.473432,0.715088,0.028101,0.477575,0.705166,0.025992,0.454353,0.695796,0.011947,0.448384,0.699739,0.014157,0.441746,0.705512,0.015491,0.436396,0.711411,0.011211,0.424883,0.637143,0.018464,0.325325,0.544807,-0.205772,0.499228,0.588374,0.066624,0.447251,0.691595,0.003838,0.441597,0.693799,0.005282,0.474352,0.594317,0.047149,0.445976,0.590867,0.026735,0.471912,0.590299,0.047519,0.431958,0.518003,0.005830,0.404263,0.531010,-0.001291,0.435866,0.566975,0.033930,0.372888,0.323790,-0.041875,0.379619,0.346958,-0.014714,0.387929,0.370099,0.007512,0.426430,0.717957,-0.004290,0.467216,0.378078,0.038139,0.464274,0.341760,0.026842,0.461524,0.302084,0.014733,0.384502,0.466873,-0.024661,0.346507,0.487632,-0.053234,0.454992,0.460955,-0.011123,0.361290,0.433688,-0.034316,0.464132,0.493651,0.021163,0.450753,0.557678,0.069416,0.330230,0.499824,-0.074338,0.356020,0.501891,-0.036197,0.376221,0.510058,-0.018012,0.408600,0.507543,-0.008056,0.432897,0.499322,-0.002740,0.451626,0.490892,0.003327,0.489139,0.468516,0.041895,0.333081,0.540845,-0.070264,0.349464,0.431355,-0.043972,0.489674,0.581322,0.090078,0.450037,0.526338,0.021342,0.321799,0.461356,-0.190019,0.466393,0.480258,0.006815,0.435159,0.569218,0.014873,0.370473,0.448105,-0.039533,0.450797,0.545711,0.062428,0.330949,0.590338,-0.198092,0.454828,0.454231,-0.016034,0.466584,0.533999,0.081427,0.368977,0.696224,-0.085285,0.371028,0.715130,-0.118389,0.321597,0.542365,-0.137881,0.354546,0.665653,-0.106874,0.329959,0.424926,-0.108036,0.419492,0.778306,-0.034538,0.492124,0.587480,0.065140,0.433445,0.541551,0.013330,0.334037,0.463275,-0.080820,0.399471,0.457458,-0.017688,0.413581,0.458728,-0.012470,0.431282,0.698495,0.001523,0.338871,0.579736,-0.077310,0.448546,0.812289,-0.040055,0.402613,0.769888,-0.073760,0.387343,0.746064,-0.093037,0.514690,0.345274,0.033323,0.488000,0.820705,-0.033467,0.427727,0.457785,-0.010751,0.441068,0.456047,-0.012633,0.450414,0.455453,-0.015941,0.339809,0.428071,-0.063515,0.439953,0.442173,-0.009664,0.425213,0.436909,-0.006777,0.410450,0.434989,-0.008594,0.395831,0.436903,-0.013989,0.386744,0.440697,-0.020517,0.324071,0.418275,-0.159265,0.390377,0.454714,-0.023950,0.498653,0.616235,0.049360,0.438696,0.624162,0.028365,0.453541,0.573481,0.051026,0.471848,0.616528,0.046160,0.509473,0.439198,0.036626,0.383119,0.726852,-0.069040,0.400357,0.751140,-0.052905,0.448261,0.799376,-0.017654,0.357804,0.682843,-0.150576,0.450187,0.449297,-0.013365,0.474411,0.499158,0.047327,0.488080,0.808697,-0.012143,0.421590,0.793239,-0.053836,0.328169,0.584662,-0.136360,0.464164,0.700852,0.019479,0.458453,0.707157,0.021782,0.452413,0.716912,0.022893,0.447621,0.727753,0.018560,0.441569,0.737180,0.001004,0.442923,0.681201,0.009745,0.437506,0.678748,0.009459,0.433157,0.675614,0.009226,0.414865,0.655540,0.003868,0.359632,0.593782,-0.039332,0.476808,0.479702,0.030386,0.470438,0.440075,-0.001203,0.458674,0.442170,-0.009146,0.447241,0.683111,0.007838,0.359273,0.641053,-0.069698,0.486246,0.440059,0.022744,0.433378,0.746332,-0.012836,0.503507,0.505421,0.083170,0.487594,0.488947,0.060638,0.504958,0.485987,0.065768,0.458841,0.529919,0.046526,0.488781,0.790678,-0.001805,0.490518,0.771693,-0.000881,0.459529,0.764384,-0.005205,0.399752,0.700763,-0.023859,0.421744,0.585210,0.009102,0.413708,0.725289,-0.019314,0.390449,0.580406,-0.002206,0.409394,0.606362,0.004826,0.379239,0.612465,-0.018335,0.452143,0.782220,-0.007722,0.447252,0.541647,0.032212,0.386091,0.709841,-0.044705,0.404779,0.735822,-0.036374,0.390113,0.673154,-0.024213,0.345029,0.613400,-0.085212,0.373498,0.668782,-0.044750,0.338735,0.625841,-0.129784,0.399408,0.634678,-0.005042,0.462545,0.512394,0.033459,0.456919,0.565750,0.073789,0.445414,0.572512,0.052962,0.464870,0.552529,0.087854,0.456662,0.419967,0.003821,0.427102,0.406517,0.005780,0.401550,0.403677,0.003182,0.380497,0.407585,-0.005612,0.366728,0.417166,-0.018378,0.360299,0.453843,-0.047318,0.319157,0.501776,-0.133228,0.371666,0.481921,-0.032133,0.388200,0.488065,-0.020028,0.410637,0.487840,-0.011281,0.432495,0.483586,-0.007046,0.449902,0.477569,-0.005056,0.462053,0.471918,-0.003384,0.323676,0.502520,-0.204049,0.446251,0.579433,0.043590,0.472275,0.516499,0.061793,0.469923,0.566576,0.089211,0.481198,0.578090,0.082282,0.470678,0.570257,0.080035,0.451695,0.587196,0.037530,0.483688,0.579992,0.087260,0.486153,0.585274,0.064986,0.461669,0.455214,-0.012452,0.472018,0.460982,-0.000621,0.477589,0.464747,0.012801,0.381748,0.444165,-0.027075,0.369820,0.434840,-0.028560,0.520120,0.509670,0.077569,0.639928,0.465285,-0.016150,0.517380,0.584724,0.066471,0.715554,0.403696,-0.100026,0.590783,0.477515,0.000460,0.607198,0.480811,0.000009,0.624547,0.482151,-0.004264,0.647336,0.474262,-0.018475,0.576117,0.472179,-0.002154,0.619830,0.424470,0.008838,0.599101,0.425106,0.007646,0.638910,0.429879,0.003611,0.650881,0.439135,-0.003648,0.662162,0.489699,-0.026696,0.560030,0.769691,-0.016272,0.646872,0.461100,-0.021607,0.716455,0.484529,-0.106504,0.684725,0.478005,-0.044433,0.596133,0.567597,0.016302,0.520766,0.651431,0.054897,0.515542,0.673358,0.045988,0.541919,0.662133,0.044746,0.554441,0.673315,0.031651,0.531531,0.677956,0.039761,0.543236,0.682623,0.027319,0.577329,0.711360,-0.001842,0.515131,0.572015,0.100255,0.518993,0.553834,0.106169,0.677453,0.423590,-0.008011,0.563336,0.512941,0.019279,0.564279,0.574269,0.055779,0.566811,0.564718,0.050342,0.646290,0.568883,-0.003657,0.519468,0.529384,0.095423,0.635524,0.395683,0.022401,0.660811,0.406598,0.009193,0.699735,0.368182,-0.064351,0.551948,0.406547,0.034263,0.581497,0.431749,0.001411,0.589114,0.688159,-0.003169,0.677339,0.660422,-0.161864,0.548818,0.583685,0.047779,0.532009,0.589124,0.048746,0.566879,0.695510,0.000392,0.561139,0.694875,0.005586,0.671557,0.395433,0.000750,0.564795,0.584796,0.045456,0.600293,0.393871,0.031245,0.604306,0.378296,0.035326,0.625639,0.318594,0.003472,0.685322,0.382141,-0.027171,0.613096,0.349371,0.020430,0.688210,0.416882,-0.023606,0.701864,0.411915,-0.059446,0.518584,0.663321,0.052861,0.536769,0.670465,0.043372,0.549341,0.678211,0.031193,0.544084,0.587934,0.043605,0.564634,0.695251,0.003240,0.558536,0.704098,0.011482,0.558584,0.694747,0.005856,0.538829,0.573424,0.073854,0.538066,0.684949,0.024283,0.527404,0.681348,0.032242,0.512870,0.679137,0.038064,0.519139,0.755499,0.003671,0.518486,0.743786,0.026903,0.517634,0.731575,0.032250,0.516113,0.717844,0.030494,0.513420,0.708511,0.028220,0.539353,0.701737,0.016899,0.544395,0.706313,0.019210,0.550164,0.713512,0.020773,0.555166,0.720026,0.016870,0.572683,0.645528,0.025733,0.710030,0.567562,-0.184627,0.547799,0.698297,0.009966,0.552628,0.701337,0.011608,0.525599,0.597337,0.049125,0.556687,0.598083,0.031061,0.528567,0.593943,0.049423,0.582289,0.526249,0.013291,0.609304,0.542779,0.008762,0.569631,0.575154,0.039721,0.671492,0.339204,-0.027124,0.657767,0.360742,-0.001246,0.643095,0.381494,0.019428,0.563003,0.726708,0.002365,0.558594,0.380698,0.042151,0.566732,0.346787,0.031789,0.575973,0.307779,0.019911,0.638921,0.479888,-0.011529,0.680104,0.506291,-0.036422,0.567154,0.466710,-0.005030,0.667807,0.449921,-0.018832,0.550147,0.498595,0.025793,0.551850,0.563974,0.073770,0.698622,0.520703,-0.056037,0.666594,0.519332,-0.020402,0.642671,0.525317,-0.004680,0.608893,0.518557,0.002099,0.584730,0.507539,0.005064,0.565693,0.496641,0.009221,0.525270,0.470289,0.043947,0.689720,0.561844,-0.051289,0.682081,0.449040,-0.027038,0.508370,0.582191,0.091036,0.561341,0.532878,0.026843,0.722118,0.483905,-0.168103,0.551568,0.484314,0.011533,0.571334,0.577608,0.020740,0.655745,0.462946,-0.024868,0.554447,0.552057,0.066893,0.698238,0.612234,-0.178164,0.567927,0.459930,-0.009761,0.537288,0.538458,0.084675,0.632147,0.712626,-0.070805,0.631425,0.731063,-0.104205,0.708065,0.564654,-0.117313,0.653631,0.683332,-0.089901,0.709937,0.446087,-0.088208,0.563700,0.788143,-0.027752,0.506608,0.587999,0.065732,0.577317,0.550120,0.020060,0.699288,0.482938,-0.062662,0.622400,0.468586,-0.006056,0.608608,0.468353,-0.002165,0.563362,0.707131,0.008588,0.679961,0.599426,-0.058863,0.529228,0.818271,-0.036302,0.586102,0.782835,-0.064767,0.607442,0.760490,-0.081599,0.594157,0.466182,-0.002041,0.581561,0.463268,-0.005113,0.572854,0.461417,-0.009229,0.695451,0.446951,-0.045060,0.583458,0.448689,-0.001909,0.598850,0.444863,0.002287,0.614531,0.445195,0.001993,0.628708,0.448975,-0.002102,0.638063,0.454161,-0.007812,0.722382,0.440050,-0.138154,0.632341,0.467407,-0.011427,0.559611,0.631257,0.033997,0.548870,0.579269,0.054880,0.525722,0.619836,0.048493,0.611235,0.741212,-0.057593,0.588662,0.763930,-0.043926,0.529641,0.805579,-0.013950,0.653161,0.700565,-0.133655,0.573097,0.454888,-0.006403,0.536101,0.502899,0.050517,0.560977,0.803411,-0.047012,0.695693,0.606590,-0.116395,0.528442,0.705387,0.023332,0.532238,0.712963,0.025645,0.537150,0.723772,0.027100,0.540330,0.734254,0.022970,0.545016,0.743686,0.005916,0.552721,0.688764,0.016160,0.557956,0.686471,0.016583,0.562730,0.684328,0.016763,0.582108,0.665690,0.012731,0.652568,0.610692,-0.024044,0.537377,0.482965,0.033562,0.552371,0.443228,0.002903,0.565118,0.446780,-0.003220,0.547636,0.689476,0.014027,0.648242,0.658063,-0.053998,0.533559,0.441745,0.025209,0.552603,0.753907,-0.007422,0.522843,0.491058,0.062317,0.549125,0.535002,0.050448,0.522652,0.768990,-0.002450,0.594508,0.712875,-0.014648,0.583565,0.594997,0.016242,0.576379,0.735216,-0.011804,0.617739,0.593849,0.008780,0.594202,0.617152,0.013655,0.626712,0.626660,-0.005683,0.527749,0.787587,-0.004351,0.561398,0.548432,0.037376,0.607854,0.723607,-0.033930,0.584988,0.747213,-0.027949,0.607137,0.685510,-0.013096,0.669223,0.632014,-0.067645,0.627381,0.684162,-0.031626,0.678666,0.645903,-0.110840,0.601086,0.646556,0.005274,0.548538,0.517258,0.037911,0.544143,0.570758,0.077744,0.557145,0.579607,0.057561,0.536327,0.556903,0.091150,0.568297,0.424490,0.009520,0.599297,0.413819,0.014083,0.625785,0.414205,0.013963,0.647781,0.420823,0.007414,0.661941,0.432020,-0.003774,0.667822,0.470236,-0.031640,0.714666,0.524582,-0.112061,0.651834,0.497336,-0.017913,0.632866,0.501171,-0.007662,0.609142,0.498461,-0.001143,0.587206,0.491510,0.000973,0.570245,0.483593,0.000986,0.557426,0.476755,0.001619,0.717041,0.525139,-0.182401,0.556791,0.586069,0.048235,0.535028,0.519947,0.064947,0.529718,0.570055,0.091877,0.518192,0.580142,0.083682,0.529499,0.573941,0.082695,0.551106,0.593469,0.041341,0.514593,0.581485,0.088573,0.513056,0.587428,0.066045,0.560480,0.459829,-0.007225,0.548299,0.464467,0.003353,0.541220,0.467790,0.016204,0.643205,0.458092,-0.013781,0.658050,0.449765,-0.014260,0.412286,0.445339,-0.001516,0.430124,0.445958,-0.001554,0.412898,0.429588,-0.001565,0.394553,0.444505,-0.001557,0.411734,0.461423,-0.001548,0.609282,0.455161,0.000551,0.627642,0.456293,0.000596,0.610426,0.439139,0.000597,0.590772,0.453523,0.000621,0.607511,0.470991,0.000620"; + +}; + + + +#endif \ No newline at end of file diff --git a/samples/api/texture_loading/texture_loading.cpp b/samples/api/texture_loading/texture_loading.cpp index 32b8597..721d5d6 100644 --- a/samples/api/texture_loading/texture_loading.cpp +++ b/samples/api/texture_loading/texture_loading.cpp @@ -1,6 +1,7 @@  #include "texture_loading.h" +#include "hardcode_data.h" #include "lodepng.cpp" //#ifdef _WIN32 // #include @@ -44,7 +45,7 @@ TextureLoading::~TextureLoading() } - destroy_texture(texture); + destroy_texture(tex_demo0); destroy_texture(tex_demo1); destroy_texture(tex_demo2); destroy_texture(tex_demo3); @@ -259,10 +260,16 @@ void TextureLoading::build_command_buffers() vkCmdBindVertexBuffers(draw_cmd_buffers[i], 0, 1, vertex_buffer->get(), offsets); vkCmdBindIndexBuffer(draw_cmd_buffers[i], index_buffer->get_handle(), 0, VK_INDEX_TYPE_UINT32); +#ifdef _WIN32 + vkCmdDrawIndexed(draw_cmd_buffers[i], index_count, 1, 0, 0, 0); +#else if (getCurrentTimeMillis() - last_update_time < 1000) { vkCmdDrawIndexed(draw_cmd_buffers[i], index_count, 1, 0, 0, 0); - } + } +#endif + + //draw_ui(draw_cmd_buffers[i]); @@ -588,9 +595,9 @@ void TextureLoading::setup_descriptor_set() // Setup a descriptor image info for the current texture to be used as a combined image sampler VkDescriptorImageInfo image_descriptor; - image_descriptor.imageView = texture.view; // The image's view (images are never directly accessed by the shader, but rather through views defining subresources) - image_descriptor.sampler = texture.sampler; // The sampler (Telling the pipeline how to sample the texture, including repeat, border, etc.) - image_descriptor.imageLayout = texture.image_layout; // The current layout of the image (Note: Should always fit the actual use, e.g. shader read) + image_descriptor.imageView = tex_demo0.view; // The image's view (images are never directly accessed by the shader, but rather through views defining subresources) + image_descriptor.sampler = tex_demo0.sampler; // The sampler (Telling the pipeline how to sample the texture, including repeat, border, etc.) + image_descriptor.imageLayout = tex_demo0.image_layout; // The current layout of the image (Note: Should always fit the actual use, e.g. shader read) std::vector write_descriptor_sets = { @@ -994,7 +1001,7 @@ void TextureLoading::prepare_pipelines() 0); rasterization_state.cullMode = VK_CULL_MODE_BACK_BIT; - rasterization_state.frontFace = VK_FRONT_FACE_CLOCKWISE; + rasterization_state.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; //VkPipelineColorBlendAttachmentState blend_attachment_state = // vkb::initializers::pipeline_color_blend_attachment_state( @@ -1413,13 +1420,13 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options) dataSize = lineImage.size(); processWithVulkan(lineImage.data(), width, height, rowStride, dataSize, texture_point_line, false); #ifdef _WIN32 - const char* filename_test = "assets/DemoHeadBaseColor.png"; + const char* filename_demo0 = "assets/demo0.png"; const char* filename_demo1 = "assets/demo1.png"; const char* filename_demo2 = "assets/demo2.png"; const char* filename_demo3 = "assets/demo3.png"; const char* filename_demo4 = "assets/demo4.png"; #else - const char* filename_test = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/DemoHeadBaseColor.png"; + const char* filename_demo0 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/demo0.png"; const char* filename_demo1 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/demo1.png"; const char* filename_demo2 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/demo2.png"; const char* filename_demo3 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/demo3.png"; @@ -1429,8 +1436,8 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options) std::vector image_test; unsigned w_t, h_t; - unsigned error_t = lodepng::decode(image_test, w_t, h_t, filename_test, LCT_RGBA, 8); - processWithVulkan(image_test.data(), w_t, h_t, w_t * 4, image_test.size(), texture, true); + unsigned error_t = lodepng::decode(image_test, w_t, h_t, filename_demo0, LCT_RGBA, 8); + processWithVulkan(image_test.data(), w_t, h_t, w_t * 4, image_test.size(), tex_demo0, true); image_test.clear(); w_t, h_t; @@ -1502,11 +1509,11 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options) #ifdef _WIN32 - LoadOBJ("assets/face_929.obj", obj_vertices, obj_indices); + LoadOBJ("assets/face_picture_3dmax.obj", obj_vertices, obj_indices); //std::vector positions_test; //LoadOBJ_test("assets/face.obj", positions_test); #else - LoadOBJ("/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/face_929.obj", obj_vertices, obj_indices); + LoadOBJ("/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/face_picture_3dmax.obj", obj_vertices, obj_indices); #endif // _WIN32 @@ -1598,7 +1605,7 @@ void ReceiveFacePoint(float* pos, int pointCount, int width, int height) TextureLoading* self = TextureLoading::Get(); if (self != nullptr) { - TextureLoading::Get()->update_point_vertex_buffer(pos, pointCount); + //TextureLoading::Get()->update_point_vertex_buffer(pos, pointCount); TextureLoading::Get()->update_face_vertex_buffer(pos, pointCount); //self->demo1(pos); } @@ -1612,10 +1619,10 @@ void TextureLoading::render(float delta_time) return; } #if _WIN32 - string str = "0.497176,0.654941,0.056854,0.499096,0.571142,0.101093,0.499443,0.594826,0.053191,0.486665,0.507695,0.075654,0.499822,0.551577,0.107729,0.501566,0.526343,0.100379,0.507274,0.464574,0.049972,0.384071,0.451689,-0.029412,0.510934,0.411708,0.038101,0.512489,0.385395,0.042231,0.517780,0.303259,0.021708,0.496729,0.663534,0.054564,0.496503,0.672256,0.047820,0.495962,0.678167,0.039046,0.495333,0.708580,0.029263,0.494208,0.719311,0.031647,0.493171,0.732978,0.033173,0.491888,0.745546,0.026135,0.491751,0.757028,0.002595,0.499114,0.582417,0.091598,0.482417,0.582563,0.065089,0.331655,0.382730,-0.120031,0.430957,0.469391,-0.008093,0.414008,0.470789,-0.010267,0.397406,0.470345,-0.016058,0.377172,0.459990,-0.032563,0.445480,0.465845,-0.008916,0.407104,0.414617,-0.002052,0.427153,0.417373,-0.000860,0.388613,0.417688,-0.008829,0.376612,0.425300,-0.017125,0.363639,0.473838,-0.041905,0.424317,0.760712,-0.022355,0.378095,0.447231,-0.035613,0.321751,0.462365,-0.127255,0.346235,0.459834,-0.061681,0.412989,0.556626,0.007719,0.474707,0.648701,0.052639,0.477565,0.671162,0.044046,0.453343,0.656598,0.040157,0.441169,0.666182,0.025390,0.462063,0.673138,0.035794,0.451410,0.677070,0.022132,0.415549,0.701012,-0.009850,0.482972,0.570121,0.099036,0.480842,0.550994,0.104616,0.354530,0.407162,-0.024088,0.450885,0.506449,0.013582,0.439753,0.566562,0.050407,0.438681,0.556687,0.044705,0.367658,0.552965,-0.017865,0.483477,0.527524,0.093462,0.393368,0.385091,0.011027,0.369870,0.392510,-0.004918,0.346767,0.349522,-0.082266,0.471944,0.404162,0.030519,0.443971,0.426069,-0.005504,0.406778,0.677611,-0.012820,0.343144,0.640875,-0.180424,0.453649,0.577968,0.043753,0.469357,0.585499,0.046754,0.428715,0.686186,-0.007846,0.434532,0.686292,-0.001798,0.361692,0.380369,-0.014286,0.439307,0.577039,0.040063,0.426476,0.386744,0.023408,0.423940,0.371093,0.027273,0.414777,0.307725,-0.007059,0.353887,0.365024,-0.043705,0.420427,0.340030,0.011343,0.346111,0.399299,-0.040411,0.338442,0.392337,-0.078127,0.475432,0.660558,0.050712,0.457661,0.665396,0.039118,0.445976,0.671356,0.025472,0.458571,0.583021,0.040336,0.431722,0.686313,-0.004415,0.435878,0.695282,0.004963,0.437489,0.686573,-0.001261,0.462763,0.569201,0.070216,0.456034,0.680024,0.019362,0.466256,0.677225,0.028576,0.479924,0.676736,0.036048,0.464911,0.752547,0.001659,0.466742,0.740062,0.024617,0.469333,0.727902,0.030009,0.473432,0.715088,0.028101,0.477575,0.705166,0.025992,0.454353,0.695796,0.011947,0.448384,0.699739,0.014157,0.441746,0.705512,0.015491,0.436396,0.711411,0.011211,0.424883,0.637143,0.018464,0.325325,0.544807,-0.205772,0.499228,0.588374,0.066624,0.447251,0.691595,0.003838,0.441597,0.693799,0.005282,0.474352,0.594317,0.047149,0.445976,0.590867,0.026735,0.471912,0.590299,0.047519,0.431958,0.518003,0.005830,0.404263,0.531010,-0.001291,0.435866,0.566975,0.033930,0.372888,0.323790,-0.041875,0.379619,0.346958,-0.014714,0.387929,0.370099,0.007512,0.426430,0.717957,-0.004290,0.467216,0.378078,0.038139,0.464274,0.341760,0.026842,0.461524,0.302084,0.014733,0.384502,0.466873,-0.024661,0.346507,0.487632,-0.053234,0.454992,0.460955,-0.011123,0.361290,0.433688,-0.034316,0.464132,0.493651,0.021163,0.450753,0.557678,0.069416,0.330230,0.499824,-0.074338,0.356020,0.501891,-0.036197,0.376221,0.510058,-0.018012,0.408600,0.507543,-0.008056,0.432897,0.499322,-0.002740,0.451626,0.490892,0.003327,0.489139,0.468516,0.041895,0.333081,0.540845,-0.070264,0.349464,0.431355,-0.043972,0.489674,0.581322,0.090078,0.450037,0.526338,0.021342,0.321799,0.461356,-0.190019,0.466393,0.480258,0.006815,0.435159,0.569218,0.014873,0.370473,0.448105,-0.039533,0.450797,0.545711,0.062428,0.330949,0.590338,-0.198092,0.454828,0.454231,-0.016034,0.466584,0.533999,0.081427,0.368977,0.696224,-0.085285,0.371028,0.715130,-0.118389,0.321597,0.542365,-0.137881,0.354546,0.665653,-0.106874,0.329959,0.424926,-0.108036,0.419492,0.778306,-0.034538,0.492124,0.587480,0.065140,0.433445,0.541551,0.013330,0.334037,0.463275,-0.080820,0.399471,0.457458,-0.017688,0.413581,0.458728,-0.012470,0.431282,0.698495,0.001523,0.338871,0.579736,-0.077310,0.448546,0.812289,-0.040055,0.402613,0.769888,-0.073760,0.387343,0.746064,-0.093037,0.514690,0.345274,0.033323,0.488000,0.820705,-0.033467,0.427727,0.457785,-0.010751,0.441068,0.456047,-0.012633,0.450414,0.455453,-0.015941,0.339809,0.428071,-0.063515,0.439953,0.442173,-0.009664,0.425213,0.436909,-0.006777,0.410450,0.434989,-0.008594,0.395831,0.436903,-0.013989,0.386744,0.440697,-0.020517,0.324071,0.418275,-0.159265,0.390377,0.454714,-0.023950,0.498653,0.616235,0.049360,0.438696,0.624162,0.028365,0.453541,0.573481,0.051026,0.471848,0.616528,0.046160,0.509473,0.439198,0.036626,0.383119,0.726852,-0.069040,0.400357,0.751140,-0.052905,0.448261,0.799376,-0.017654,0.357804,0.682843,-0.150576,0.450187,0.449297,-0.013365,0.474411,0.499158,0.047327,0.488080,0.808697,-0.012143,0.421590,0.793239,-0.053836,0.328169,0.584662,-0.136360,0.464164,0.700852,0.019479,0.458453,0.707157,0.021782,0.452413,0.716912,0.022893,0.447621,0.727753,0.018560,0.441569,0.737180,0.001004,0.442923,0.681201,0.009745,0.437506,0.678748,0.009459,0.433157,0.675614,0.009226,0.414865,0.655540,0.003868,0.359632,0.593782,-0.039332,0.476808,0.479702,0.030386,0.470438,0.440075,-0.001203,0.458674,0.442170,-0.009146,0.447241,0.683111,0.007838,0.359273,0.641053,-0.069698,0.486246,0.440059,0.022744,0.433378,0.746332,-0.012836,0.503507,0.505421,0.083170,0.487594,0.488947,0.060638,0.504958,0.485987,0.065768,0.458841,0.529919,0.046526,0.488781,0.790678,-0.001805,0.490518,0.771693,-0.000881,0.459529,0.764384,-0.005205,0.399752,0.700763,-0.023859,0.421744,0.585210,0.009102,0.413708,0.725289,-0.019314,0.390449,0.580406,-0.002206,0.409394,0.606362,0.004826,0.379239,0.612465,-0.018335,0.452143,0.782220,-0.007722,0.447252,0.541647,0.032212,0.386091,0.709841,-0.044705,0.404779,0.735822,-0.036374,0.390113,0.673154,-0.024213,0.345029,0.613400,-0.085212,0.373498,0.668782,-0.044750,0.338735,0.625841,-0.129784,0.399408,0.634678,-0.005042,0.462545,0.512394,0.033459,0.456919,0.565750,0.073789,0.445414,0.572512,0.052962,0.464870,0.552529,0.087854,0.456662,0.419967,0.003821,0.427102,0.406517,0.005780,0.401550,0.403677,0.003182,0.380497,0.407585,-0.005612,0.366728,0.417166,-0.018378,0.360299,0.453843,-0.047318,0.319157,0.501776,-0.133228,0.371666,0.481921,-0.032133,0.388200,0.488065,-0.020028,0.410637,0.487840,-0.011281,0.432495,0.483586,-0.007046,0.449902,0.477569,-0.005056,0.462053,0.471918,-0.003384,0.323676,0.502520,-0.204049,0.446251,0.579433,0.043590,0.472275,0.516499,0.061793,0.469923,0.566576,0.089211,0.481198,0.578090,0.082282,0.470678,0.570257,0.080035,0.451695,0.587196,0.037530,0.483688,0.579992,0.087260,0.486153,0.585274,0.064986,0.461669,0.455214,-0.012452,0.472018,0.460982,-0.000621,0.477589,0.464747,0.012801,0.381748,0.444165,-0.027075,0.369820,0.434840,-0.028560,0.520120,0.509670,0.077569,0.639928,0.465285,-0.016150,0.517380,0.584724,0.066471,0.715554,0.403696,-0.100026,0.590783,0.477515,0.000460,0.607198,0.480811,0.000009,0.624547,0.482151,-0.004264,0.647336,0.474262,-0.018475,0.576117,0.472179,-0.002154,0.619830,0.424470,0.008838,0.599101,0.425106,0.007646,0.638910,0.429879,0.003611,0.650881,0.439135,-0.003648,0.662162,0.489699,-0.026696,0.560030,0.769691,-0.016272,0.646872,0.461100,-0.021607,0.716455,0.484529,-0.106504,0.684725,0.478005,-0.044433,0.596133,0.567597,0.016302,0.520766,0.651431,0.054897,0.515542,0.673358,0.045988,0.541919,0.662133,0.044746,0.554441,0.673315,0.031651,0.531531,0.677956,0.039761,0.543236,0.682623,0.027319,0.577329,0.711360,-0.001842,0.515131,0.572015,0.100255,0.518993,0.553834,0.106169,0.677453,0.423590,-0.008011,0.563336,0.512941,0.019279,0.564279,0.574269,0.055779,0.566811,0.564718,0.050342,0.646290,0.568883,-0.003657,0.519468,0.529384,0.095423,0.635524,0.395683,0.022401,0.660811,0.406598,0.009193,0.699735,0.368182,-0.064351,0.551948,0.406547,0.034263,0.581497,0.431749,0.001411,0.589114,0.688159,-0.003169,0.677339,0.660422,-0.161864,0.548818,0.583685,0.047779,0.532009,0.589124,0.048746,0.566879,0.695510,0.000392,0.561139,0.694875,0.005586,0.671557,0.395433,0.000750,0.564795,0.584796,0.045456,0.600293,0.393871,0.031245,0.604306,0.378296,0.035326,0.625639,0.318594,0.003472,0.685322,0.382141,-0.027171,0.613096,0.349371,0.020430,0.688210,0.416882,-0.023606,0.701864,0.411915,-0.059446,0.518584,0.663321,0.052861,0.536769,0.670465,0.043372,0.549341,0.678211,0.031193,0.544084,0.587934,0.043605,0.564634,0.695251,0.003240,0.558536,0.704098,0.011482,0.558584,0.694747,0.005856,0.538829,0.573424,0.073854,0.538066,0.684949,0.024283,0.527404,0.681348,0.032242,0.512870,0.679137,0.038064,0.519139,0.755499,0.003671,0.518486,0.743786,0.026903,0.517634,0.731575,0.032250,0.516113,0.717844,0.030494,0.513420,0.708511,0.028220,0.539353,0.701737,0.016899,0.544395,0.706313,0.019210,0.550164,0.713512,0.020773,0.555166,0.720026,0.016870,0.572683,0.645528,0.025733,0.710030,0.567562,-0.184627,0.547799,0.698297,0.009966,0.552628,0.701337,0.011608,0.525599,0.597337,0.049125,0.556687,0.598083,0.031061,0.528567,0.593943,0.049423,0.582289,0.526249,0.013291,0.609304,0.542779,0.008762,0.569631,0.575154,0.039721,0.671492,0.339204,-0.027124,0.657767,0.360742,-0.001246,0.643095,0.381494,0.019428,0.563003,0.726708,0.002365,0.558594,0.380698,0.042151,0.566732,0.346787,0.031789,0.575973,0.307779,0.019911,0.638921,0.479888,-0.011529,0.680104,0.506291,-0.036422,0.567154,0.466710,-0.005030,0.667807,0.449921,-0.018832,0.550147,0.498595,0.025793,0.551850,0.563974,0.073770,0.698622,0.520703,-0.056037,0.666594,0.519332,-0.020402,0.642671,0.525317,-0.004680,0.608893,0.518557,0.002099,0.584730,0.507539,0.005064,0.565693,0.496641,0.009221,0.525270,0.470289,0.043947,0.689720,0.561844,-0.051289,0.682081,0.449040,-0.027038,0.508370,0.582191,0.091036,0.561341,0.532878,0.026843,0.722118,0.483905,-0.168103,0.551568,0.484314,0.011533,0.571334,0.577608,0.020740,0.655745,0.462946,-0.024868,0.554447,0.552057,0.066893,0.698238,0.612234,-0.178164,0.567927,0.459930,-0.009761,0.537288,0.538458,0.084675,0.632147,0.712626,-0.070805,0.631425,0.731063,-0.104205,0.708065,0.564654,-0.117313,0.653631,0.683332,-0.089901,0.709937,0.446087,-0.088208,0.563700,0.788143,-0.027752,0.506608,0.587999,0.065732,0.577317,0.550120,0.020060,0.699288,0.482938,-0.062662,0.622400,0.468586,-0.006056,0.608608,0.468353,-0.002165,0.563362,0.707131,0.008588,0.679961,0.599426,-0.058863,0.529228,0.818271,-0.036302,0.586102,0.782835,-0.064767,0.607442,0.760490,-0.081599,0.594157,0.466182,-0.002041,0.581561,0.463268,-0.005113,0.572854,0.461417,-0.009229,0.695451,0.446951,-0.045060,0.583458,0.448689,-0.001909,0.598850,0.444863,0.002287,0.614531,0.445195,0.001993,0.628708,0.448975,-0.002102,0.638063,0.454161,-0.007812,0.722382,0.440050,-0.138154,0.632341,0.467407,-0.011427,0.559611,0.631257,0.033997,0.548870,0.579269,0.054880,0.525722,0.619836,0.048493,0.611235,0.741212,-0.057593,0.588662,0.763930,-0.043926,0.529641,0.805579,-0.013950,0.653161,0.700565,-0.133655,0.573097,0.454888,-0.006403,0.536101,0.502899,0.050517,0.560977,0.803411,-0.047012,0.695693,0.606590,-0.116395,0.528442,0.705387,0.023332,0.532238,0.712963,0.025645,0.537150,0.723772,0.027100,0.540330,0.734254,0.022970,0.545016,0.743686,0.005916,0.552721,0.688764,0.016160,0.557956,0.686471,0.016583,0.562730,0.684328,0.016763,0.582108,0.665690,0.012731,0.652568,0.610692,-0.024044,0.537377,0.482965,0.033562,0.552371,0.443228,0.002903,0.565118,0.446780,-0.003220,0.547636,0.689476,0.014027,0.648242,0.658063,-0.053998,0.533559,0.441745,0.025209,0.552603,0.753907,-0.007422,0.522843,0.491058,0.062317,0.549125,0.535002,0.050448,0.522652,0.768990,-0.002450,0.594508,0.712875,-0.014648,0.583565,0.594997,0.016242,0.576379,0.735216,-0.011804,0.617739,0.593849,0.008780,0.594202,0.617152,0.013655,0.626712,0.626660,-0.005683,0.527749,0.787587,-0.004351,0.561398,0.548432,0.037376,0.607854,0.723607,-0.033930,0.584988,0.747213,-0.027949,0.607137,0.685510,-0.013096,0.669223,0.632014,-0.067645,0.627381,0.684162,-0.031626,0.678666,0.645903,-0.110840,0.601086,0.646556,0.005274,0.548538,0.517258,0.037911,0.544143,0.570758,0.077744,0.557145,0.579607,0.057561,0.536327,0.556903,0.091150,0.568297,0.424490,0.009520,0.599297,0.413819,0.014083,0.625785,0.414205,0.013963,0.647781,0.420823,0.007414,0.661941,0.432020,-0.003774,0.667822,0.470236,-0.031640,0.714666,0.524582,-0.112061,0.651834,0.497336,-0.017913,0.632866,0.501171,-0.007662,0.609142,0.498461,-0.001143,0.587206,0.491510,0.000973,0.570245,0.483593,0.000986,0.557426,0.476755,0.001619,0.717041,0.525139,-0.182401,0.556791,0.586069,0.048235,0.535028,0.519947,0.064947,0.529718,0.570055,0.091877,0.518192,0.580142,0.083682,0.529499,0.573941,0.082695,0.551106,0.593469,0.041341,0.514593,0.581485,0.088573,0.513056,0.587428,0.066045,0.560480,0.459829,-0.007225,0.548299,0.464467,0.003353,0.541220,0.467790,0.016204,0.643205,0.458092,-0.013781,0.658050,0.449765,-0.014260,0.412286,0.445339,-0.001516,0.430124,0.445958,-0.001554,0.412898,0.429588,-0.001565,0.394553,0.444505,-0.001557,0.411734,0.461423,-0.001548,0.609282,0.455161,0.000551,0.627642,0.456293,0.000596,0.610426,0.439139,0.000597,0.590772,0.453523,0.000621,0.607511,0.470991,0.000620"; + std::vector floatArray; - + string& str = HardCodeData::Get().face_result_point_str; std::stringstream ss(str); std::string token; @@ -1647,7 +1654,7 @@ void TextureLoading::input_event(const vkb::InputEvent& input_event) } else if (touch_event.get_action() == vkb::TouchAction::Up) { - if (cur_texture == "texture") + if (cur_texture == "tex_demo0") { update_texture(tex_demo1); cur_texture = "tex_demo1"; @@ -1669,8 +1676,8 @@ void TextureLoading::input_event(const vkb::InputEvent& input_event) } else if (cur_texture == "tex_demo4") { - update_texture(texture); - cur_texture = "texture"; + update_texture(tex_demo0); + cur_texture = "tex_demo0"; } } } @@ -1680,7 +1687,7 @@ void TextureLoading::input_event(const vkb::InputEvent& input_event) const auto& touch_event = static_cast(input_event); if (touch_event.get_action() == vkb::MouseAction::Up) { - if (cur_texture == "texture") + if (cur_texture == "tex_demo0") { update_texture(tex_demo1); cur_texture = "tex_demo1"; @@ -1702,8 +1709,8 @@ void TextureLoading::input_event(const vkb::InputEvent& input_event) } else if (cur_texture == "tex_demo4") { - update_texture(texture); - cur_texture = "texture"; + update_texture(tex_demo0); + cur_texture = "tex_demo0"; } } } @@ -1711,13 +1718,13 @@ void TextureLoading::input_event(const vkb::InputEvent& input_event) void TextureLoading::on_update_ui_overlay(vkb::Drawer& drawer) { - if (drawer.header("Settings")) - { - if (drawer.slider_float("LOD bias", &ubo_vs.lod_bias, 0.0f, static_cast(texture.mip_levels))) - { - update_uniform_buffers(); - } - } + //if (drawer.header("Settings")) + //{ + // if (drawer.slider_float("LOD bias", &ubo_vs.lod_bias, 0.0f, static_cast(texture.mip_levels))) + // { + // update_uniform_buffers(); + // } + //} } std::unique_ptr create_texture_loading() @@ -1756,19 +1763,20 @@ void TextureLoading::update_face_vertex_buffer(float* pos, int pointCount) std::lock_guard lock(mtx_point); last_update_time = getCurrentTimeMillis(); - extendPoint(pos, 68, 54); - extendPoint(pos, 104, 103); - extendPoint(pos, 69, 67); - extendPoint(pos, 108, 109); - extendPoint(pos, 151, 10); - extendPoint(pos, 337, 338); - extendPoint(pos, 299, 297); - extendPoint(pos, 333, 332); - extendPoint(pos, 298, 284); + //extendPoint(pos, 68, 54); + //extendPoint(pos, 104, 103); + //extendPoint(pos, 69, 67); + //extendPoint(pos, 108, 109); + //extendPoint(pos, 151, 10); + //extendPoint(pos, 337, 338); + //extendPoint(pos, 299, 297); + //extendPoint(pos, 333, 332); + //extendPoint(pos, 298, 284); for (int i = 0; i < obj_vertices.size(); ++i) { - int face_index = obj_vertices_map[i]; + + int face_index = obj_vertices_map[HardCodeData::Get().indexMap[i]]; float x = pos[face_index * 3 + 0]; float y = pos[face_index * 3 + 1]; float z = pos[face_index * 3 + 2]; diff --git a/samples/api/texture_loading/texture_loading.h b/samples/api/texture_loading/texture_loading.h index ab9bb4c..5909f13 100644 --- a/samples/api/texture_loading/texture_loading.h +++ b/samples/api/texture_loading/texture_loading.h @@ -49,7 +49,7 @@ public: uint32_t mip_levels; }; - Texture texture = { 0 }; + Texture tex_demo0 = { 0 }; Texture tex_demo1 = { 0 }; Texture tex_demo2 = { 0 }; Texture tex_demo3 = { 0 }; @@ -206,6 +206,7 @@ private: std::vector obj_vertices; std::vector obj_indices; std::map obj_vertices_map; + std::map vertices_map_3dmax; std::thread workerThread; bool running = false;