diff --git a/README.md b/README.md index 77e4fd3..2d45feb 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ Ensure that your PC has a proper cooling solution, since all of the CPU cores wi - Backface Culling - Matrix Multiplication - Wavefront OBJ Support -- Shaders! (Vertex & Fragment) # Any Experimental Features? The future iteration of Ghetty will feature a Super Resolution Model that will be integrated into the renderer. The model in this case will be handled by the GPU, diff --git a/main.go b/main.go index 20e1f68..3a91298 100644 --- a/main.go +++ b/main.go @@ -27,11 +27,6 @@ var Time float32 func BasicVertex(vertex, uv, normal, color *Vertex, matrices ...*Matrix) { //(*vertex)[X] += float32(math.Sin(float64(Time*.0125+(*vertex)[Y]))) * .25 - //(*uv)[X] *= 2 - //(*uv)[Y] *= 2 - - //(*uv)[X] += Time - (*color)[R] = 1 (*color)[G] = 1 (*color)[B] = 1 @@ -43,6 +38,10 @@ func BasicVertex(vertex, uv, normal, color *Vertex, matrices ...*Matrix) { for index := range matrices { vertex.Transform(matrices[index]) } + + //(*vertex)[X] = float32(math.Round(float64((*vertex)[X]) * 32)) / 32; + //(*vertex)[Y] = float32(math.Round(float64((*vertex)[Y]) * 32)) / 32; + //(*vertex)[Z] = float32(math.Round(float64((*vertex)[Z]) * 32)) / 32; } func BasicFragment(r, g, b *float32, uv *Vertex, textures ...*Texture) { diff --git a/raw_data/AMD Ryzen 5 5600U with Radeon Graphics/Scene3/Barycentric/12.txt b/raw_data/AMD Ryzen 5 5600U with Radeon Graphics/Scene3/Barycentric/12.txt index 06f8d08..9e83749 100644 --- a/raw_data/AMD Ryzen 5 5600U with Radeon Graphics/Scene3/Barycentric/12.txt +++ b/raw_data/AMD Ryzen 5 5600U with Radeon Graphics/Scene3/Barycentric/12.txt @@ -998,3 +998,374 @@ 418.4073324888811 371.5221482129685 382.7328907155696 +259.38895743297513 +345.4343167628691 +381.71409614198967 +382.9560749382046 +391.0183484362508 +390.0557141216828 +307.11768161249546 +283.4569814606159 +322.1243693268588 +351.9894734207563 +347.28778221623094 +94.9910423447069 +343.3938754704072 +379.8386445437978 +342.5472895021939 +353.7071649414226 +402.55450727527597 +366.57528587378664 +375.35757550951547 +369.4049624864269 +341.6956175438919 +366.65087503678996 +347.922067849389 +431.86713776671155 +422.19120830225535 +372.93201737723973 +354.99086746106843 +418.5179928276604 +369.7810537344697 +420.55181792763454 +369.7984787166561 +373.53603089602404 +352.4189428964835 +375.0982145424483 +335.76502267011705 +360.9350120645503 +336.69893215784685 +334.6502570163922 +364.4142769326861 +325.94602333853516 +357.8714525742353 +373.84526544463245 +353.41174614853577 +360.9601100190461 +372.9077053429276 +281.8360277990265 +345.4303508084817 +389.9762114511015 +391.5209349839536 +377.54332359577853 +372.8019636097437 +372.979635311912 +369.3128933619002 +437.2573980913864 +472.87412090901404 +377.92013101763024 +368.7516649885144 +368.48490627223885 +367.99915092379194 +390.3679942173621 +445.482641574533 +285.2979957516535 +343.2092801394866 +418.32415549438326 +371.621429250023 +98.74167203761519 +118.96993629709772 +125.89595957900391 +129.79820273420913 +133.1869866772262 +153.86607496834756 +171.82178644310122 +143.92108122250735 +167.55375408674078 +167.00891897214362 +171.46055081502575 +139.7279308899708 +120.54416225044993 +128.47712380155244 +125.26091052354687 +127.73163583311462 +155.72007758852686 +139.56778647883235 +122.85517831580134 +131.37702329324577 +156.2560648751295 +156.63585296901763 +121.55494268585628 +134.54344028972085 +150.732329529222 +123.21766639254048 +127.59938895842612 +153.66884364195158 +144.28107625324532 +123.60827302196608 +283.37153860168917 +316.8970401516547 +359.9382541379439 +368.3352719050977 +372.459152065286 +259.697270891322 +348.95400786176384 +351.94316117946954 +374.75389911445154 +363.4795336557583 +359.6265502419709 +366.7861636665824 +373.5294276270754 +378.7678531827843 +304.28341553957506 +324.76731318607096 +388.3200903537995 +367.6695753526306 +346.1182637231652 +375.93327184424766 +286.35915684290126 +322.11839416700434 +346.5764143064347 +341.8271721817449 +349.1600257261107 +331.41154565952695 +360.91096326536245 +370.72029154003303 +365.55898963490444 +368.6805751496903 +367 +402.6286555909485 +356.4127387303939 +352.22222288742 +368.2321255485935 +287.83276916111737 +319.3392443259584 +334.0014692076568 +346.70107433370947 +364.36847655643237 +362.18452239669705 +368.75805783825234 +363.19669210403424 +346.1947510091527 +354.99282914485127 +342.25436583250786 +341.5878401121207 +338.5403975562776 +341.72416025783986 +345.5051718738876 +269.5821476711098 +321.1902793058699 +334.8522966519468 +374.3902680095197 +359.62976116088487 +59.53678003660321 +56.97887223417557 +59.98310875657415 +60.00696277512332 +59.98566047703154 +59.992722882714325 +60.02655535447206 +59.989543822511735 +60.05036355080753 +59.94060485464953 +60.02983975083483 +60.036019643391946 +59.9031434911061 +60.06838145155342 +60.03339037489573 +59.937358582224036 +60.02919583905169 +60.04324688680686 +60.013013969652306 +59.950972095020695 +60.05186512232959 +59.99755485374809 +59.930061618091685 +60.07865181929484 +59.94510404258972 +60.06240188166643 +59.96715569390601 +60.037514588623935 +60.00487908525021 +59.98362447051955 +59.98522396761742 +60.03995511373585 +60.002642083551414 +59.920377801976734 +60.08770638033922 +60.004973526986106 +59.974732645136605 +60.028930007940545 +59.998109567760835 +59.55517052034941 +56.97576820578208 +60.02445258437248 +60.01528126801073 +59.998369224652876 +60.010132858499055 +60.004648884764414 +59.99862888379239 +59.998338046036125 +60.011986656482335 +59.99583028979486 +60.008934444961135 +60.00304933529409 +59.98595541942131 +60.015765452878966 +60.00314377127037 +60.010770457622456 +60.002583062018374 +59.99515839071787 +60.006171782323975 +59.99578829566165 +60.010044304136805 +60.01982228425801 +59.99278886677821 +59.99533236314215 +60.0089462517576 +59.960623858312246 +60.040410148837225 +60.60155688380039 +57.04440917089197 +60.01747787667215 +60.00918238866255 +59.99809806029149 +59.58242846657768 +57.03850758154859 +59.99334073917795 +59.97754480052206 +59.99462448164645 +60.07322039239631 +60.00986129261635 +59.95042100183149 +60.00634886845241 +60.04627894685914 +59.997282123119824 +59.983804372819336 +60.01958015811716 +59.93050458688105 +60.0497487557889 +59.99086339150547 +284.20023212677205 +348.7858803480543 +380.95836125111526 +391.6527606623967 +394.64947004854685 +382.2881138262859 +351.6567127170456 +362.79882804984635 +379.70721085918774 +398.19425392717835 +436.8456085124989 +331.46317100762315 +271.9172555791273 +338.75078105038125 +372.8515305205467 +384.19668315519084 +387.26539626981577 +373.30181272373846 +349.484824420322 +401.4617201256555 +351.0123215296798 +327.6905290643516 +354.672566286804 +350.2548328431262 +351.0812204460926 +370.90786648596486 +408.72974968393225 +369.5843654226457 +376.7088417362221 +355.46821954356284 +350.6195077102329 +343.8434137093967 +375.47842292271804 +361.1965183449417 +264.68690186378535 +345.622338470753 +386.97391795792964 +385.1491285452179 +378.7773925264122 +366.7079537856051 +377.4827354076709 +382.90174741161417 +384.0177210712718 +427.5790484268238 +458.84578193269243 +387.9439421003665 +382.372717556848 +377.97645206703623 +259.34556739523487 +323.7446302356701 +366.33480439756636 +366.3475350400936 +358.27739033144053 +366.4973854855451 +233.81951471659028 +297.72528947085584 +381.3250927183977 +388.33637197393375 +379.95168049047584 +278.875175471459 +334.51219013195015 +382.07107060603556 +353.9992088366978 +367.10862355115546 +386.6850836678609 +296.09991547693323 +334.3422641857144 +404.90041195126395 +423.5023846979799 +422.7491829097796 +424.6960980397982 +425.72464130200586 +435.0441644662512 +425.1084625323771 +422.70769762709085 +383.2016759484965 +367.92880577608236 +401.47511143930427 +412.49963793917976 +412.84229424359893 +418.8129166689934 +480.07117005296124 +394.29306588846225 +385.3067310397726 +511.9592992357108 +400.2555646752605 +303.8980118272308 +385.64798052337824 +381.81802552903287 +422.16727504996396 +427.88070685892774 +428.02154275326603 +428.1137617019009 +435.88165812981777 +427.53245051211996 +430.05147845911057 +434.26370588666913 +432.9513362698033 +433.8177965254593 +483.51849931808937 +396.8786439601685 +404.64186006089164 +364.14902015480027 +433.6455381371267 +393.496285405053 +451.37890262998116 +387.28132205067055 +391.20628157531183 +392.19902209056016 +431.29220636014236 +444.7207607317551 +374.70327247852424 +391.380679213213 +425.7294530204059 +410.6348224523931 +441.3167736934558 +384.37780764276863 +464.95118012608674 +446.35706728028947 +385.0822719295375 +448.1614451200359 +494.6704999799633 +206.8976270541336 +293.8105803188684 +382.4630219172282 +417.8565498464377 +406.98940460941435 +390.96176393948673 +423.32505053942 +428.3552396932138 +430.56719385673523 +435.9273744994084 +434.1235046441235 diff --git a/raw_data/AMD Ryzen 5 5600U with Radeon Graphics/Scene3/Barycentric/128.txt b/raw_data/AMD Ryzen 5 5600U with Radeon Graphics/Scene3/Barycentric/128.txt new file mode 100644 index 0000000..e69de29 diff --git a/raw_data/AMD Ryzen 5 5600U with Radeon Graphics/Scene3/Barycentric/64.txt b/raw_data/AMD Ryzen 5 5600U with Radeon Graphics/Scene3/Barycentric/64.txt new file mode 100644 index 0000000..66a3e8c --- /dev/null +++ b/raw_data/AMD Ryzen 5 5600U with Radeon Graphics/Scene3/Barycentric/64.txt @@ -0,0 +1,29 @@ +316.8116554708226 +386.5689369783754 +354.3392989431905 +388.9935038084864 +390.5963967432452 +391.3579772383405 +375.5737238234604 +384.3429438319629 +374.9634035718114 +382.2074546220956 +380.2638851710858 +381.1550174418332 +380.2177779653918 +380.76891134770307 +377.54464340558854 +379.1603872384991 +345.95312335178585 +357.20457684827426 +376.40900022874087 +378.74173601021465 +379.8247488608756 +387.9967796267291 +379.27066251598177 +377.59114430894226 +377.1075749239425 +359.50341792881494 +343.0748301056541 +343.8375711313975 +418.3298773694419 diff --git a/vertex.go b/vertex.go index 38a4ce3..572970d 100644 --- a/vertex.go +++ b/vertex.go @@ -28,9 +28,15 @@ func (v1 *Vertex) Multiply(v2 *Vertex) { } func (v1 *Vertex) Transform(m2 *Matrix) { - var matrix Matrix = v1.Matrix() - matrix = matrix.Multiply(m2) - *v1 = matrix.Vertex() + var result Vertex = make(Vertex, len(*v1)) + + for i := range *v1 { + for j := range *m2 { + result[i] += (*v1)[j] * (*m2)[j][i] + } + } + + *v1 = result } func (v1 *Vertex) Dot(v2 *Vertex) (result float32) {