wojtek #1
BIN
Debug/Camera.obj
BIN
Debug/SOIL.obj
BIN
Debug/Skybox.obj
Normal file
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project>
|
<Project>
|
||||||
<ProjectOutputs>D:\Documents\2020\studia\s3e1\grafika\Projekt_Grafika\Debug\grk-cw8.exe</ProjectOutputs>
|
<ProjectOutputs>D:\Studia\grk\Projekt_Grafika\Debug\grk-cw8.exe</ProjectOutputs>
|
||||||
<ContentFiles></ContentFiles>
|
<ContentFiles></ContentFiles>
|
||||||
<SatelliteDlls></SatelliteDlls>
|
<SatelliteDlls></SatelliteDlls>
|
||||||
<NonRecipeFileRefs></NonRecipeFileRefs>
|
<NonRecipeFileRefs></NonRecipeFileRefs>
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
Camera.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO”
|
main_8_1.cpp
|
||||||
PhysXExtensions_static_32.lib(ExtCpuWorkerThread.obj) : warning LNK4099: nie znaleziono pliku PDB „PhysXExtensions_static_32.pdb” z elementem „PhysXExtensions_static_32.lib(ExtCpuWorkerThread.obj)” lub w pozycji „D:\Documents\2020\studia\s3e1\grafika\Projekt_Grafika\Debug\PhysXExtensions_static_32.pdb”; obiekt zostanie skonsolidowany bez informacji debugowania
|
Skybox.cpp
|
||||||
PhysXExtensions_static_32.lib(ExtDefaultCpuDispatcher.obj) : warning LNK4099: nie znaleziono pliku PDB „PhysXExtensions_static_32.pdb” z elementem „PhysXExtensions_static_32.lib(ExtDefaultCpuDispatcher.obj)” lub w pozycji „D:\Documents\2020\studia\s3e1\grafika\Projekt_Grafika\Debug\PhysXExtensions_static_32.pdb”; obiekt zostanie skonsolidowany bez informacji debugowania
|
Generating Code...
|
||||||
PhysXExtensions_static_32.lib(ExtDefaultErrorCallback.obj) : warning LNK4099: nie znaleziono pliku PDB „PhysXExtensions_static_32.pdb” z elementem „PhysXExtensions_static_32.lib(ExtDefaultErrorCallback.obj)” lub w pozycji „D:\Documents\2020\studia\s3e1\grafika\Projekt_Grafika\Debug\PhysXExtensions_static_32.pdb”; obiekt zostanie skonsolidowany bez informacji debugowania
|
Camera.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
|
||||||
PhysXExtensions_static_32.lib(ExtDefaultSimulationFilterShader.obj) : warning LNK4099: nie znaleziono pliku PDB „PhysXExtensions_static_32.pdb” z elementem „PhysXExtensions_static_32.lib(ExtDefaultSimulationFilterShader.obj)” lub w pozycji „D:\Documents\2020\studia\s3e1\grafika\Projekt_Grafika\Debug\PhysXExtensions_static_32.pdb”; obiekt zostanie skonsolidowany bez informacji debugowania
|
PhysXExtensions_static_32.lib(ExtCpuWorkerThread.obj) : warning LNK4099: PDB 'PhysXExtensions_static_32.pdb' was not found with 'PhysXExtensions_static_32.lib(ExtCpuWorkerThread.obj)' or at 'D:\Studia\grk\Projekt_Grafika\Debug\PhysXExtensions_static_32.pdb'; linking object as if no debug info
|
||||||
grk-cw8.vcxproj -> D:\Documents\2020\studia\s3e1\grafika\Projekt_Grafika\Debug\grk-cw8.exe
|
PhysXExtensions_static_32.lib(ExtDefaultCpuDispatcher.obj) : warning LNK4099: PDB 'PhysXExtensions_static_32.pdb' was not found with 'PhysXExtensions_static_32.lib(ExtDefaultCpuDispatcher.obj)' or at 'D:\Studia\grk\Projekt_Grafika\Debug\PhysXExtensions_static_32.pdb'; linking object as if no debug info
|
||||||
|
PhysXExtensions_static_32.lib(ExtDefaultErrorCallback.obj) : warning LNK4099: PDB 'PhysXExtensions_static_32.pdb' was not found with 'PhysXExtensions_static_32.lib(ExtDefaultErrorCallback.obj)' or at 'D:\Studia\grk\Projekt_Grafika\Debug\PhysXExtensions_static_32.pdb'; linking object as if no debug info
|
||||||
|
PhysXExtensions_static_32.lib(ExtDefaultSimulationFilterShader.obj) : warning LNK4099: PDB 'PhysXExtensions_static_32.pdb' was not found with 'PhysXExtensions_static_32.lib(ExtDefaultSimulationFilterShader.obj)' or at 'D:\Studia\grk\Projekt_Grafika\Debug\PhysXExtensions_static_32.pdb'; linking object as if no debug info
|
||||||
|
grk-cw8.vcxproj -> D:\Studia\grk\Projekt_Grafika\Debug\grk-cw8.exe
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.27.29110:TargetPlatformVersion=10.0.18362.0:
|
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.27.29110:TargetPlatformVersion=10.0.17763.0:
|
||||||
Debug|Win32|D:\Documents\2020\studia\s3e1\grafika\Projekt_Grafika\|
|
Debug|Win32|D:\Studia\grk\Projekt_Grafika\|
|
||||||
|
@ -2,3 +2,5 @@ D:\Documents\2020\studia\s3e1\grafika\grk-cw8\Debug\grk-cw8.exe
|
|||||||
D:\Documents\2020\studia\s3e1\grafika\grk-cw8\Debug\grk-cw8.pdb
|
D:\Documents\2020\studia\s3e1\grafika\grk-cw8\Debug\grk-cw8.pdb
|
||||||
D:\Documents\2020\studia\s3e1\grafika\Projekt_Grafika\Debug\grk-cw8.exe
|
D:\Documents\2020\studia\s3e1\grafika\Projekt_Grafika\Debug\grk-cw8.exe
|
||||||
D:\Documents\2020\studia\s3e1\grafika\Projekt_Grafika\Debug\grk-cw8.pdb
|
D:\Documents\2020\studia\s3e1\grafika\Projekt_Grafika\Debug\grk-cw8.pdb
|
||||||
|
D:\Studia\grk\Projekt_Grafika\Debug\grk-cw8.exe
|
||||||
|
D:\Studia\grk\Projekt_Grafika\Debug\grk-cw8.pdb
|
||||||
|
BIN
Debug/start.obj
BIN
Debug/vc142.idb
BIN
Debug/vc142.pdb
@ -12,14 +12,15 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\Camera.cpp" />
|
<ClCompile Include="src\Camera.cpp" />
|
||||||
|
<ClCompile Include="src\main_8_1.cpp" />
|
||||||
<ClCompile Include="src\Physics.cpp" />
|
<ClCompile Include="src\Physics.cpp" />
|
||||||
<ClCompile Include="src\Render_Utils.cpp" />
|
<ClCompile Include="src\Render_Utils.cpp" />
|
||||||
<ClCompile Include="src\Shader_Loader.cpp" />
|
<ClCompile Include="src\Shader_Loader.cpp" />
|
||||||
|
<ClCompile Include="src\Skybox.cpp" />
|
||||||
<ClCompile Include="src\SOIL\image_DXT.c" />
|
<ClCompile Include="src\SOIL\image_DXT.c" />
|
||||||
<ClCompile Include="src\SOIL\image_helper.c" />
|
<ClCompile Include="src\SOIL\image_helper.c" />
|
||||||
<ClCompile Include="src\SOIL\SOIL.c" />
|
<ClCompile Include="src\SOIL\SOIL.c" />
|
||||||
<ClCompile Include="src\SOIL\stb_image_aug.c" />
|
<ClCompile Include="src\SOIL\stb_image_aug.c" />
|
||||||
<ClCompile Include="src\start.cpp" />
|
|
||||||
<ClCompile Include="src\Texture.cpp" />
|
<ClCompile Include="src\Texture.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -48,7 +48,10 @@
|
|||||||
<ClCompile Include="src\Physics.cpp">
|
<ClCompile Include="src\Physics.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\start.cpp">
|
<ClCompile Include="src\main_8_1.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\Skybox.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
20987
models/blender-rocket.obj
Normal file
86222
models/bottom.obj
Normal file
151
models/crane.obj
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
# Blender v2.91.2 OBJ File: 'starting_site_2.blend'
|
||||||
|
# www.blender.org
|
||||||
|
mtllib crane.mtl
|
||||||
|
o Kostka.002_Kostka.027
|
||||||
|
v -2.969376 1.555083 7.509674
|
||||||
|
v -2.969376 30.188183 7.509674
|
||||||
|
v -2.969376 1.555083 5.493874
|
||||||
|
v -2.969376 30.188183 5.493874
|
||||||
|
v 3.030624 1.555083 7.509674
|
||||||
|
v 3.030624 30.188183 7.509674
|
||||||
|
v 3.030624 1.555083 5.493874
|
||||||
|
v 3.030624 30.188183 5.493874
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||||
|
f 3/4/2 4/3/2 8/5/2 7/6/2
|
||||||
|
f 7/6/3 8/5/3 6/7/3 5/8/3
|
||||||
|
f 5/8/4 6/7/4 2/9/4 1/10/4
|
||||||
|
f 3/11/5 7/6/5 5/8/5 1/12/5
|
||||||
|
f 8/5/6 4/13/6 2/14/6 6/7/6
|
||||||
|
o Kostka
|
||||||
|
v -0.162833 15.989394 6.133174
|
||||||
|
v -0.162833 16.658024 6.133174
|
||||||
|
v -0.162833 15.989394 0.976624
|
||||||
|
v -0.162833 16.658024 0.976624
|
||||||
|
v 0.224081 15.989394 6.133174
|
||||||
|
v 0.224081 16.658024 6.133174
|
||||||
|
v 0.224081 15.989394 0.976624
|
||||||
|
v 0.224081 16.658024 0.976624
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 9/15/7 10/16/7 12/17/7 11/18/7
|
||||||
|
f 11/18/8 12/17/8 16/19/8 15/20/8
|
||||||
|
f 15/20/9 16/19/9 14/21/9 13/22/9
|
||||||
|
f 13/22/10 14/21/10 10/23/10 9/24/10
|
||||||
|
f 11/25/11 15/20/11 13/22/11 9/26/11
|
||||||
|
f 16/19/12 12/27/12 10/28/12 14/21/12
|
||||||
|
o Kostka.001
|
||||||
|
v -0.162833 14.651886 6.133174
|
||||||
|
v -0.162833 15.320517 6.133174
|
||||||
|
v -0.162833 14.651886 0.976624
|
||||||
|
v -0.162833 15.320517 0.976624
|
||||||
|
v 0.224081 14.651886 6.133174
|
||||||
|
v 0.224081 15.320517 6.133174
|
||||||
|
v 0.224081 14.651886 0.976624
|
||||||
|
v 0.224081 15.320517 0.976624
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 17/29/13 18/30/13 20/31/13 19/32/13
|
||||||
|
f 19/32/14 20/31/14 24/33/14 23/34/14
|
||||||
|
f 23/34/15 24/33/15 22/35/15 21/36/15
|
||||||
|
f 21/36/16 22/35/16 18/37/16 17/38/16
|
||||||
|
f 19/39/17 23/34/17 21/36/17 17/40/17
|
||||||
|
f 24/33/18 20/41/18 18/42/18 22/35/18
|
||||||
|
o Kostka.003_Kostka.002
|
||||||
|
v -0.162833 13.285920 6.133174
|
||||||
|
v -0.162833 13.954551 6.133174
|
||||||
|
v -0.162833 13.285920 0.976624
|
||||||
|
v -0.162833 13.954551 0.976624
|
||||||
|
v 0.224081 13.285920 6.133174
|
||||||
|
v 0.224081 13.954551 6.133174
|
||||||
|
v 0.224081 13.285920 0.976624
|
||||||
|
v 0.224081 13.954551 0.976624
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 25/43/19 26/44/19 28/45/19 27/46/19
|
||||||
|
f 27/46/20 28/45/20 32/47/20 31/48/20
|
||||||
|
f 31/48/21 32/47/21 30/49/21 29/50/21
|
||||||
|
f 29/50/22 30/49/22 26/51/22 25/52/22
|
||||||
|
f 27/53/23 31/48/23 29/50/23 25/54/23
|
||||||
|
f 32/47/24 28/55/24 26/56/24 30/49/24
|
268
models/lamp.obj
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
# Blender v2.91.2 OBJ File: 'starting_site_2.blend'
|
||||||
|
# www.blender.org
|
||||||
|
mtllib lamp.mtl
|
||||||
|
o Walec
|
||||||
|
v 0.000000 -0.046428 -0.350492
|
||||||
|
v 0.000000 0.350492 -0.046428
|
||||||
|
v 0.048773 -0.049349 -0.346678
|
||||||
|
v 0.048773 0.347570 -0.042615
|
||||||
|
v 0.095671 -0.058001 -0.335385
|
||||||
|
v 0.095671 0.338919 -0.031321
|
||||||
|
v 0.138893 -0.072050 -0.317045
|
||||||
|
v 0.138893 0.324870 -0.012982
|
||||||
|
v 0.176777 -0.090957 -0.292364
|
||||||
|
v 0.176777 0.305963 0.011699
|
||||||
|
v 0.207867 -0.113996 -0.262290
|
||||||
|
v 0.207867 0.282924 0.041773
|
||||||
|
v 0.230970 -0.140280 -0.227979
|
||||||
|
v 0.230970 0.256640 0.076084
|
||||||
|
v 0.245196 -0.168800 -0.190749
|
||||||
|
v 0.245196 0.228120 0.113314
|
||||||
|
v 0.250000 -0.198460 -0.152032
|
||||||
|
v 0.250000 0.198460 0.152032
|
||||||
|
v 0.245196 -0.228120 -0.113314
|
||||||
|
v 0.245196 0.168800 0.190749
|
||||||
|
v 0.230970 -0.256640 -0.076084
|
||||||
|
v 0.230970 0.140280 0.227979
|
||||||
|
v 0.207867 -0.282924 -0.041773
|
||||||
|
v 0.207867 0.113996 0.262290
|
||||||
|
v 0.176777 -0.305963 -0.011699
|
||||||
|
v 0.176777 0.090957 0.292364
|
||||||
|
v 0.138893 -0.324870 0.012982
|
||||||
|
v 0.138893 0.072050 0.317045
|
||||||
|
v 0.095671 -0.338919 0.031321
|
||||||
|
v 0.095671 0.058001 0.335385
|
||||||
|
v 0.048773 -0.347570 0.042615
|
||||||
|
v 0.048773 0.049349 0.346678
|
||||||
|
v -0.000000 -0.350492 0.046428
|
||||||
|
v -0.000000 0.046428 0.350492
|
||||||
|
v -0.048773 -0.347570 0.042615
|
||||||
|
v -0.048773 0.049349 0.346678
|
||||||
|
v -0.095671 -0.338919 0.031321
|
||||||
|
v -0.095671 0.058001 0.335385
|
||||||
|
v -0.138893 -0.324870 0.012982
|
||||||
|
v -0.138893 0.072050 0.317045
|
||||||
|
v -0.176777 -0.305963 -0.011699
|
||||||
|
v -0.176777 0.090957 0.292364
|
||||||
|
v -0.207868 -0.282924 -0.041773
|
||||||
|
v -0.207868 0.113996 0.262290
|
||||||
|
v -0.230970 -0.256640 -0.076085
|
||||||
|
v -0.230970 0.140280 0.227979
|
||||||
|
v -0.245196 -0.228120 -0.113314
|
||||||
|
v -0.245196 0.168800 0.190749
|
||||||
|
v -0.250000 -0.198460 -0.152032
|
||||||
|
v -0.250000 0.198460 0.152032
|
||||||
|
v -0.245196 -0.168800 -0.190750
|
||||||
|
v -0.245196 0.228120 0.113314
|
||||||
|
v -0.230970 -0.140280 -0.227979
|
||||||
|
v -0.230970 0.256640 0.076084
|
||||||
|
v -0.207867 -0.113995 -0.262290
|
||||||
|
v -0.207867 0.282924 0.041773
|
||||||
|
v -0.176776 -0.090957 -0.292364
|
||||||
|
v -0.176776 0.305963 0.011699
|
||||||
|
v -0.138892 -0.072050 -0.317045
|
||||||
|
v -0.138892 0.324870 -0.012982
|
||||||
|
v -0.095671 -0.058001 -0.335385
|
||||||
|
v -0.095671 0.338919 -0.031321
|
||||||
|
v -0.048772 -0.049349 -0.346678
|
||||||
|
v -0.048772 0.347570 -0.042615
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.968750 1.000000
|
||||||
|
vt 0.968750 0.500000
|
||||||
|
vt 0.937500 1.000000
|
||||||
|
vt 0.937500 0.500000
|
||||||
|
vt 0.906250 1.000000
|
||||||
|
vt 0.906250 0.500000
|
||||||
|
vt 0.875000 1.000000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.843750 1.000000
|
||||||
|
vt 0.843750 0.500000
|
||||||
|
vt 0.812500 1.000000
|
||||||
|
vt 0.812500 0.500000
|
||||||
|
vt 0.781250 1.000000
|
||||||
|
vt 0.781250 0.500000
|
||||||
|
vt 0.750000 1.000000
|
||||||
|
vt 0.750000 0.500000
|
||||||
|
vt 0.718750 1.000000
|
||||||
|
vt 0.718750 0.500000
|
||||||
|
vt 0.687500 1.000000
|
||||||
|
vt 0.687500 0.500000
|
||||||
|
vt 0.656250 1.000000
|
||||||
|
vt 0.656250 0.500000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.593750 1.000000
|
||||||
|
vt 0.593750 0.500000
|
||||||
|
vt 0.562500 1.000000
|
||||||
|
vt 0.562500 0.500000
|
||||||
|
vt 0.531250 1.000000
|
||||||
|
vt 0.531250 0.500000
|
||||||
|
vt 0.500000 1.000000
|
||||||
|
vt 0.500000 0.500000
|
||||||
|
vt 0.468750 1.000000
|
||||||
|
vt 0.468750 0.500000
|
||||||
|
vt 0.437500 1.000000
|
||||||
|
vt 0.437500 0.500000
|
||||||
|
vt 0.406250 1.000000
|
||||||
|
vt 0.406250 0.500000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.343750 1.000000
|
||||||
|
vt 0.343750 0.500000
|
||||||
|
vt 0.312500 1.000000
|
||||||
|
vt 0.312500 0.500000
|
||||||
|
vt 0.281250 1.000000
|
||||||
|
vt 0.281250 0.500000
|
||||||
|
vt 0.250000 1.000000
|
||||||
|
vt 0.250000 0.500000
|
||||||
|
vt 0.218750 1.000000
|
||||||
|
vt 0.218750 0.500000
|
||||||
|
vt 0.187500 1.000000
|
||||||
|
vt 0.187500 0.500000
|
||||||
|
vt 0.156250 1.000000
|
||||||
|
vt 0.156250 0.500000
|
||||||
|
vt 0.125000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.093750 1.000000
|
||||||
|
vt 0.093750 0.500000
|
||||||
|
vt 0.062500 1.000000
|
||||||
|
vt 0.062500 0.500000
|
||||||
|
vt 0.296822 0.485388
|
||||||
|
vt 0.250000 0.490000
|
||||||
|
vt 0.203179 0.485389
|
||||||
|
vt 0.158156 0.471731
|
||||||
|
vt 0.116663 0.449553
|
||||||
|
vt 0.080295 0.419706
|
||||||
|
vt 0.050447 0.383337
|
||||||
|
vt 0.028269 0.341844
|
||||||
|
vt 0.014612 0.296822
|
||||||
|
vt 0.010000 0.250000
|
||||||
|
vt 0.014611 0.203179
|
||||||
|
vt 0.028269 0.158156
|
||||||
|
vt 0.050447 0.116663
|
||||||
|
vt 0.080294 0.080294
|
||||||
|
vt 0.116663 0.050447
|
||||||
|
vt 0.158156 0.028269
|
||||||
|
vt 0.203178 0.014612
|
||||||
|
vt 0.250000 0.010000
|
||||||
|
vt 0.296822 0.014612
|
||||||
|
vt 0.341844 0.028269
|
||||||
|
vt 0.383337 0.050447
|
||||||
|
vt 0.419706 0.080294
|
||||||
|
vt 0.449553 0.116663
|
||||||
|
vt 0.471731 0.158156
|
||||||
|
vt 0.485388 0.203178
|
||||||
|
vt 0.490000 0.250000
|
||||||
|
vt 0.485388 0.296822
|
||||||
|
vt 0.471731 0.341844
|
||||||
|
vt 0.449553 0.383337
|
||||||
|
vt 0.419706 0.419706
|
||||||
|
vt 0.383337 0.449553
|
||||||
|
vt 0.341844 0.471731
|
||||||
|
vt 0.031250 1.000000
|
||||||
|
vt 0.031250 0.500000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.500000
|
||||||
|
vt 0.750000 0.490000
|
||||||
|
vt 0.796822 0.485388
|
||||||
|
vt 0.841844 0.471731
|
||||||
|
vt 0.883337 0.449553
|
||||||
|
vt 0.919706 0.419706
|
||||||
|
vt 0.949553 0.383337
|
||||||
|
vt 0.971731 0.341844
|
||||||
|
vt 0.985388 0.296822
|
||||||
|
vt 0.990000 0.250000
|
||||||
|
vt 0.985388 0.203178
|
||||||
|
vt 0.971731 0.158156
|
||||||
|
vt 0.949553 0.116663
|
||||||
|
vt 0.919706 0.080294
|
||||||
|
vt 0.883337 0.050447
|
||||||
|
vt 0.841844 0.028269
|
||||||
|
vt 0.796822 0.014612
|
||||||
|
vt 0.750000 0.010000
|
||||||
|
vt 0.703178 0.014612
|
||||||
|
vt 0.658156 0.028269
|
||||||
|
vt 0.616663 0.050447
|
||||||
|
vt 0.580294 0.080294
|
||||||
|
vt 0.550447 0.116663
|
||||||
|
vt 0.528269 0.158156
|
||||||
|
vt 0.514611 0.203179
|
||||||
|
vt 0.510000 0.250000
|
||||||
|
vt 0.514612 0.296822
|
||||||
|
vt 0.528269 0.341844
|
||||||
|
vt 0.550447 0.383337
|
||||||
|
vt 0.580295 0.419706
|
||||||
|
vt 0.616663 0.449553
|
||||||
|
vt 0.658156 0.471731
|
||||||
|
vt 0.703179 0.485389
|
||||||
|
vn 0.0980 0.6052 -0.7900
|
||||||
|
vn 0.2903 0.5819 -0.7597
|
||||||
|
vn 0.4714 0.5363 -0.7001
|
||||||
|
vn 0.6344 0.4701 -0.6136
|
||||||
|
vn 0.7730 0.3858 -0.5036
|
||||||
|
vn 0.8819 0.2867 -0.3742
|
||||||
|
vn 0.9569 0.1765 -0.2304
|
||||||
|
vn 0.9952 0.0596 -0.0778
|
||||||
|
vn 0.9952 -0.0596 0.0778
|
||||||
|
vn 0.9569 -0.1765 0.2304
|
||||||
|
vn 0.8819 -0.2867 0.3742
|
||||||
|
vn 0.7730 -0.3858 0.5036
|
||||||
|
vn 0.6344 -0.4701 0.6136
|
||||||
|
vn 0.4714 -0.5363 0.7001
|
||||||
|
vn 0.2903 -0.5819 0.7597
|
||||||
|
vn 0.0980 -0.6052 0.7900
|
||||||
|
vn -0.0980 -0.6052 0.7900
|
||||||
|
vn -0.2903 -0.5819 0.7597
|
||||||
|
vn -0.4714 -0.5363 0.7001
|
||||||
|
vn -0.6344 -0.4701 0.6136
|
||||||
|
vn -0.7730 -0.3858 0.5036
|
||||||
|
vn -0.8819 -0.2867 0.3742
|
||||||
|
vn -0.9569 -0.1765 0.2304
|
||||||
|
vn -0.9952 -0.0596 0.0778
|
||||||
|
vn -0.9952 0.0596 -0.0778
|
||||||
|
vn -0.9569 0.1765 -0.2304
|
||||||
|
vn -0.8819 0.2867 -0.3742
|
||||||
|
vn -0.7730 0.3858 -0.5036
|
||||||
|
vn -0.6344 0.4701 -0.6136
|
||||||
|
vn -0.4714 0.5363 -0.7001
|
||||||
|
vn -0.0000 0.7938 0.6081
|
||||||
|
vn -0.2903 0.5819 -0.7597
|
||||||
|
vn -0.0980 0.6052 -0.7900
|
||||||
|
vn 0.0000 -0.7938 -0.6081
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||||
|
f 3/4/2 4/3/2 6/5/2 5/6/2
|
||||||
|
f 5/6/3 6/5/3 8/7/3 7/8/3
|
||||||
|
f 7/8/4 8/7/4 10/9/4 9/10/4
|
||||||
|
f 9/10/5 10/9/5 12/11/5 11/12/5
|
||||||
|
f 11/12/6 12/11/6 14/13/6 13/14/6
|
||||||
|
f 13/14/7 14/13/7 16/15/7 15/16/7
|
||||||
|
f 15/16/8 16/15/8 18/17/8 17/18/8
|
||||||
|
f 17/18/9 18/17/9 20/19/9 19/20/9
|
||||||
|
f 19/20/10 20/19/10 22/21/10 21/22/10
|
||||||
|
f 21/22/11 22/21/11 24/23/11 23/24/11
|
||||||
|
f 23/24/12 24/23/12 26/25/12 25/26/12
|
||||||
|
f 25/26/13 26/25/13 28/27/13 27/28/13
|
||||||
|
f 27/28/14 28/27/14 30/29/14 29/30/14
|
||||||
|
f 29/30/15 30/29/15 32/31/15 31/32/15
|
||||||
|
f 31/32/16 32/31/16 34/33/16 33/34/16
|
||||||
|
f 33/34/17 34/33/17 36/35/17 35/36/17
|
||||||
|
f 35/36/18 36/35/18 38/37/18 37/38/18
|
||||||
|
f 37/38/19 38/37/19 40/39/19 39/40/19
|
||||||
|
f 39/40/20 40/39/20 42/41/20 41/42/20
|
||||||
|
f 41/42/21 42/41/21 44/43/21 43/44/21
|
||||||
|
f 43/44/22 44/43/22 46/45/22 45/46/22
|
||||||
|
f 45/46/23 46/45/23 48/47/23 47/48/23
|
||||||
|
f 47/48/24 48/47/24 50/49/24 49/50/24
|
||||||
|
f 49/50/25 50/49/25 52/51/25 51/52/25
|
||||||
|
f 51/52/26 52/51/26 54/53/26 53/54/26
|
||||||
|
f 53/54/27 54/53/27 56/55/27 55/56/27
|
||||||
|
f 55/56/28 56/55/28 58/57/28 57/58/28
|
||||||
|
f 57/58/29 58/57/29 60/59/29 59/60/29
|
||||||
|
f 59/60/30 60/59/30 62/61/30 61/62/30
|
||||||
|
f 4/63/31 2/64/31 64/65/31 62/66/31 60/67/31 58/68/31 56/69/31 54/70/31 52/71/31 50/72/31 48/73/31 46/74/31 44/75/31 42/76/31 40/77/31 38/78/31 36/79/31 34/80/31 32/81/31 30/82/31 28/83/31 26/84/31 24/85/31 22/86/31 20/87/31 18/88/31 16/89/31 14/90/31 12/91/31 10/92/31 8/93/31 6/94/31
|
||||||
|
f 61/62/32 62/61/32 64/95/32 63/96/32
|
||||||
|
f 63/96/33 64/95/33 2/97/33 1/98/33
|
||||||
|
f 1/99/34 3/100/34 5/101/34 7/102/34 9/103/34 11/104/34 13/105/34 15/106/34 17/107/34 19/108/34 21/109/34 23/110/34 25/111/34 27/112/34 29/113/34 31/114/34 33/115/34 35/116/34 37/117/34 39/118/34 41/119/34 43/120/34 45/121/34 47/122/34 49/123/34 51/124/34 53/125/34 55/126/34 57/127/34 59/128/34 61/129/34 63/130/34
|
40107
models/lamp2.obj
Normal file
@ -1,18 +1,16 @@
|
|||||||
v 0 -100 -100
|
# Blender v2.91.2 OBJ File: ''
|
||||||
v 0 -100 100
|
# www.blender.org
|
||||||
v 0 100 -100
|
mtllib plane.mtl
|
||||||
v 0 100 100
|
o Prostokąt
|
||||||
|
v -5000.000000 0.000000 5000.000000
|
||||||
vt 0 0
|
v 5000.000000 0.000000 5000.000000
|
||||||
vt 20 0
|
v -5000.000000 0.000000 -5000.000000
|
||||||
vt 0 20
|
v 5000.000000 0.000000 -5000.000000
|
||||||
vt 20 20
|
vt 0.000000 0.000000
|
||||||
|
vt 1.000000 0.000000
|
||||||
vn 0 1 0
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl None
|
||||||
s off
|
s off
|
||||||
f 1/3/1 3/1/1 4/2/1
|
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||||
f 1/3/1 4/2/1 2/4/1
|
|
||||||
|
|
||||||
f 1/3/1 4/2/1 3/1/1
|
|
||||||
f 1/3/1 2/4/1 4/2/1
|
|
||||||
|
16
models/plane2.obj
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Blender v2.91.2 OBJ File: ''
|
||||||
|
# www.blender.org
|
||||||
|
mtllib plane2.mtl
|
||||||
|
o Prostokąt
|
||||||
|
v 0.000219 5000.000000 5000.000000
|
||||||
|
v -0.000219 -5000.000000 5000.000000
|
||||||
|
v 0.000219 5000.000000 -5000.000000
|
||||||
|
v -0.000219 -5000.000000 -5000.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vn 1.0000 -0.0000 0.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 1/1/1 2/2/1 4/3/1 3/4/1
|
359
models/platform3.obj
Normal file
@ -0,0 +1,359 @@
|
|||||||
|
# Blender v2.91.2 OBJ File: 'starting_site_2.blend'
|
||||||
|
# www.blender.org
|
||||||
|
mtllib platform3.mtl
|
||||||
|
o Kostka.009_Kostka.013
|
||||||
|
v -49.969376 -2.805061 50.006348
|
||||||
|
v -49.187107 -0.070366 49.224083
|
||||||
|
v -49.969376 -2.805061 -49.993652
|
||||||
|
v -49.187107 -0.070366 -49.211380
|
||||||
|
v 50.030624 -2.805061 50.006348
|
||||||
|
v 49.248356 -0.070366 49.224083
|
||||||
|
v 50.030624 -2.805061 -49.993652
|
||||||
|
v 49.248356 -0.070366 -49.211380
|
||||||
|
v -49.187107 1.791470 49.224083
|
||||||
|
v -49.187107 1.791470 -49.211380
|
||||||
|
v 49.248356 1.791470 49.224083
|
||||||
|
v 49.248356 1.791470 -49.211380
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vn -0.9614 0.2750 0.0000
|
||||||
|
vn 0.0000 0.2750 -0.9614
|
||||||
|
vn 0.9614 0.2750 0.0000
|
||||||
|
vn 0.0000 0.2750 0.9614
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||||
|
f 3/4/2 4/3/2 8/5/2 7/6/2
|
||||||
|
f 7/6/3 8/5/3 6/7/3 5/8/3
|
||||||
|
f 5/8/4 6/7/4 2/9/4 1/10/4
|
||||||
|
f 3/11/5 7/6/5 5/8/5 1/12/5
|
||||||
|
f 6/7/6 8/5/6 12/13/6 11/14/6
|
||||||
|
f 12/13/7 10/15/7 9/16/7 11/14/7
|
||||||
|
f 4/3/8 2/2/8 9/17/8 10/18/8
|
||||||
|
f 2/9/9 6/7/9 11/14/9 9/19/9
|
||||||
|
f 8/5/10 4/3/10 10/18/10 12/13/10
|
||||||
|
o Kostka.004_Kostka.003
|
||||||
|
v -0.969376 1.369067 -14.278819
|
||||||
|
v -0.969376 2.585751 -15.931281
|
||||||
|
v -0.969376 1.369067 -16.278820
|
||||||
|
v -0.969376 2.585751 -16.278820
|
||||||
|
v 1.030624 1.369067 -14.278819
|
||||||
|
v 1.030624 2.585751 -15.931281
|
||||||
|
v 1.030624 1.369067 -16.278820
|
||||||
|
v 1.030624 2.585751 -16.278820
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.8053 0.5929
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 13/20/11 14/21/11 16/22/11 15/23/11
|
||||||
|
f 15/23/12 16/22/12 20/24/12 19/25/12
|
||||||
|
f 19/25/13 20/24/13 18/26/13 17/27/13
|
||||||
|
f 17/27/14 18/26/14 14/28/14 13/29/14
|
||||||
|
f 15/30/15 19/25/15 17/27/15 13/31/15
|
||||||
|
f 20/24/16 16/32/16 14/33/16 18/26/16
|
||||||
|
o Walec
|
||||||
|
v 0.030624 2.143338 -15.940321
|
||||||
|
v 0.030624 2.540258 -15.636257
|
||||||
|
v 0.079397 2.140417 -15.936508
|
||||||
|
v 0.079397 2.537337 -15.632444
|
||||||
|
v 0.126295 2.131766 -15.925214
|
||||||
|
v 0.126295 2.528686 -15.621151
|
||||||
|
v 0.169517 2.117717 -15.906875
|
||||||
|
v 0.169517 2.514636 -15.602811
|
||||||
|
v 0.207401 2.098809 -15.882194
|
||||||
|
v 0.207401 2.495729 -15.578130
|
||||||
|
v 0.238492 2.075771 -15.852119
|
||||||
|
v 0.238492 2.472691 -15.548056
|
||||||
|
v 0.261594 2.049487 -15.817808
|
||||||
|
v 0.261594 2.446407 -15.513745
|
||||||
|
v 0.275821 2.020967 -15.780579
|
||||||
|
v 0.275821 2.417886 -15.476515
|
||||||
|
v 0.280624 1.991307 -15.741861
|
||||||
|
v 0.280624 2.388227 -15.437798
|
||||||
|
v 0.275821 1.961647 -15.703144
|
||||||
|
v 0.275821 2.358567 -15.399080
|
||||||
|
v 0.261594 1.933127 -15.665914
|
||||||
|
v 0.261594 2.330047 -15.361851
|
||||||
|
v 0.238492 1.906842 -15.631603
|
||||||
|
v 0.238492 2.303762 -15.327539
|
||||||
|
v 0.207401 1.883804 -15.601529
|
||||||
|
v 0.207401 2.280724 -15.297465
|
||||||
|
v 0.169517 1.864897 -15.576848
|
||||||
|
v 0.169517 2.261817 -15.272784
|
||||||
|
v 0.126295 1.850848 -15.558508
|
||||||
|
v 0.126295 2.247767 -15.254444
|
||||||
|
v 0.079397 1.842196 -15.547215
|
||||||
|
v 0.079397 2.239116 -15.243151
|
||||||
|
v 0.030624 1.839275 -15.543402
|
||||||
|
v 0.030624 2.236195 -15.239338
|
||||||
|
v -0.018148 1.842196 -15.547215
|
||||||
|
v -0.018148 2.239116 -15.243151
|
||||||
|
v -0.065047 1.850848 -15.558508
|
||||||
|
v -0.065047 2.247767 -15.254445
|
||||||
|
v -0.108268 1.864897 -15.576848
|
||||||
|
v -0.108268 2.261817 -15.272784
|
||||||
|
v -0.146152 1.883804 -15.601529
|
||||||
|
v -0.146152 2.280724 -15.297465
|
||||||
|
v -0.177243 1.906842 -15.631603
|
||||||
|
v -0.177243 2.303762 -15.327539
|
||||||
|
v -0.200346 1.933127 -15.665914
|
||||||
|
v -0.200346 2.330047 -15.361851
|
||||||
|
v -0.214572 1.961647 -15.703144
|
||||||
|
v -0.214572 2.358567 -15.399080
|
||||||
|
v -0.219376 1.991307 -15.741861
|
||||||
|
v -0.219376 2.388227 -15.437798
|
||||||
|
v -0.214572 2.020967 -15.780579
|
||||||
|
v -0.214572 2.417887 -15.476516
|
||||||
|
v -0.200345 2.049487 -15.817809
|
||||||
|
v -0.200345 2.446407 -15.513745
|
||||||
|
v -0.177243 2.075771 -15.852119
|
||||||
|
v -0.177243 2.472691 -15.548057
|
||||||
|
v -0.146152 2.098809 -15.882194
|
||||||
|
v -0.146152 2.495729 -15.578130
|
||||||
|
v -0.108268 2.117717 -15.906875
|
||||||
|
v -0.108268 2.514637 -15.602811
|
||||||
|
v -0.065046 2.131766 -15.925215
|
||||||
|
v -0.065046 2.528686 -15.621151
|
||||||
|
v -0.018148 2.140417 -15.936508
|
||||||
|
v -0.018148 2.537337 -15.632444
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.968750 1.000000
|
||||||
|
vt 0.968750 0.500000
|
||||||
|
vt 0.937500 1.000000
|
||||||
|
vt 0.937500 0.500000
|
||||||
|
vt 0.906250 1.000000
|
||||||
|
vt 0.906250 0.500000
|
||||||
|
vt 0.875000 1.000000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.843750 1.000000
|
||||||
|
vt 0.843750 0.500000
|
||||||
|
vt 0.812500 1.000000
|
||||||
|
vt 0.812500 0.500000
|
||||||
|
vt 0.781250 1.000000
|
||||||
|
vt 0.781250 0.500000
|
||||||
|
vt 0.750000 1.000000
|
||||||
|
vt 0.750000 0.500000
|
||||||
|
vt 0.718750 1.000000
|
||||||
|
vt 0.718750 0.500000
|
||||||
|
vt 0.687500 1.000000
|
||||||
|
vt 0.687500 0.500000
|
||||||
|
vt 0.656250 1.000000
|
||||||
|
vt 0.656250 0.500000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.593750 1.000000
|
||||||
|
vt 0.593750 0.500000
|
||||||
|
vt 0.562500 1.000000
|
||||||
|
vt 0.562500 0.500000
|
||||||
|
vt 0.531250 1.000000
|
||||||
|
vt 0.531250 0.500000
|
||||||
|
vt 0.500000 1.000000
|
||||||
|
vt 0.500000 0.500000
|
||||||
|
vt 0.468750 1.000000
|
||||||
|
vt 0.468750 0.500000
|
||||||
|
vt 0.437500 1.000000
|
||||||
|
vt 0.437500 0.500000
|
||||||
|
vt 0.406250 1.000000
|
||||||
|
vt 0.406250 0.500000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.343750 1.000000
|
||||||
|
vt 0.343750 0.500000
|
||||||
|
vt 0.312500 1.000000
|
||||||
|
vt 0.312500 0.500000
|
||||||
|
vt 0.281250 1.000000
|
||||||
|
vt 0.281250 0.500000
|
||||||
|
vt 0.250000 1.000000
|
||||||
|
vt 0.250000 0.500000
|
||||||
|
vt 0.218750 1.000000
|
||||||
|
vt 0.218750 0.500000
|
||||||
|
vt 0.187500 1.000000
|
||||||
|
vt 0.187500 0.500000
|
||||||
|
vt 0.156250 1.000000
|
||||||
|
vt 0.156250 0.500000
|
||||||
|
vt 0.125000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.093750 1.000000
|
||||||
|
vt 0.093750 0.500000
|
||||||
|
vt 0.062500 1.000000
|
||||||
|
vt 0.062500 0.500000
|
||||||
|
vt 0.296822 0.485388
|
||||||
|
vt 0.250000 0.490000
|
||||||
|
vt 0.203179 0.485389
|
||||||
|
vt 0.158156 0.471731
|
||||||
|
vt 0.116663 0.449553
|
||||||
|
vt 0.080295 0.419706
|
||||||
|
vt 0.050447 0.383337
|
||||||
|
vt 0.028269 0.341844
|
||||||
|
vt 0.014612 0.296822
|
||||||
|
vt 0.010000 0.250000
|
||||||
|
vt 0.014611 0.203179
|
||||||
|
vt 0.028269 0.158156
|
||||||
|
vt 0.050447 0.116663
|
||||||
|
vt 0.080294 0.080294
|
||||||
|
vt 0.116663 0.050447
|
||||||
|
vt 0.158156 0.028269
|
||||||
|
vt 0.203178 0.014612
|
||||||
|
vt 0.250000 0.010000
|
||||||
|
vt 0.296822 0.014612
|
||||||
|
vt 0.341844 0.028269
|
||||||
|
vt 0.383337 0.050447
|
||||||
|
vt 0.419706 0.080294
|
||||||
|
vt 0.449553 0.116663
|
||||||
|
vt 0.471731 0.158156
|
||||||
|
vt 0.485388 0.203178
|
||||||
|
vt 0.490000 0.250000
|
||||||
|
vt 0.485388 0.296822
|
||||||
|
vt 0.471731 0.341844
|
||||||
|
vt 0.449553 0.383337
|
||||||
|
vt 0.419706 0.419706
|
||||||
|
vt 0.383337 0.449553
|
||||||
|
vt 0.341844 0.471731
|
||||||
|
vt 0.031250 1.000000
|
||||||
|
vt 0.031250 0.500000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.500000
|
||||||
|
vt 0.750000 0.490000
|
||||||
|
vt 0.796822 0.485388
|
||||||
|
vt 0.841844 0.471731
|
||||||
|
vt 0.883337 0.449553
|
||||||
|
vt 0.919706 0.419706
|
||||||
|
vt 0.949553 0.383337
|
||||||
|
vt 0.971731 0.341844
|
||||||
|
vt 0.985388 0.296822
|
||||||
|
vt 0.990000 0.250000
|
||||||
|
vt 0.985388 0.203178
|
||||||
|
vt 0.971731 0.158156
|
||||||
|
vt 0.949553 0.116663
|
||||||
|
vt 0.919706 0.080294
|
||||||
|
vt 0.883337 0.050447
|
||||||
|
vt 0.841844 0.028269
|
||||||
|
vt 0.796822 0.014612
|
||||||
|
vt 0.750000 0.010000
|
||||||
|
vt 0.703178 0.014612
|
||||||
|
vt 0.658156 0.028269
|
||||||
|
vt 0.616663 0.050447
|
||||||
|
vt 0.580294 0.080294
|
||||||
|
vt 0.550447 0.116663
|
||||||
|
vt 0.528269 0.158156
|
||||||
|
vt 0.514611 0.203179
|
||||||
|
vt 0.510000 0.250000
|
||||||
|
vt 0.514612 0.296822
|
||||||
|
vt 0.528269 0.341844
|
||||||
|
vt 0.550447 0.383337
|
||||||
|
vt 0.580295 0.419706
|
||||||
|
vt 0.616663 0.449553
|
||||||
|
vt 0.658156 0.471731
|
||||||
|
vt 0.703179 0.485389
|
||||||
|
vn 0.0980 0.6052 -0.7900
|
||||||
|
vn 0.2903 0.5819 -0.7597
|
||||||
|
vn 0.4714 0.5363 -0.7001
|
||||||
|
vn 0.6344 0.4701 -0.6136
|
||||||
|
vn 0.7730 0.3858 -0.5036
|
||||||
|
vn 0.8819 0.2867 -0.3742
|
||||||
|
vn 0.9569 0.1765 -0.2304
|
||||||
|
vn 0.9952 0.0596 -0.0778
|
||||||
|
vn 0.9952 -0.0596 0.0778
|
||||||
|
vn 0.9569 -0.1765 0.2304
|
||||||
|
vn 0.8819 -0.2867 0.3742
|
||||||
|
vn 0.7730 -0.3858 0.5036
|
||||||
|
vn 0.6344 -0.4701 0.6136
|
||||||
|
vn 0.4714 -0.5363 0.7001
|
||||||
|
vn 0.2903 -0.5819 0.7597
|
||||||
|
vn 0.0980 -0.6052 0.7900
|
||||||
|
vn -0.0980 -0.6052 0.7900
|
||||||
|
vn -0.2903 -0.5819 0.7597
|
||||||
|
vn -0.4714 -0.5363 0.7001
|
||||||
|
vn -0.6344 -0.4701 0.6136
|
||||||
|
vn -0.7730 -0.3858 0.5036
|
||||||
|
vn -0.8819 -0.2867 0.3742
|
||||||
|
vn -0.9569 -0.1765 0.2304
|
||||||
|
vn -0.9952 -0.0596 0.0778
|
||||||
|
vn -0.9952 0.0596 -0.0778
|
||||||
|
vn -0.9569 0.1765 -0.2304
|
||||||
|
vn -0.8819 0.2867 -0.3742
|
||||||
|
vn -0.7730 0.3858 -0.5036
|
||||||
|
vn -0.6344 0.4701 -0.6136
|
||||||
|
vn -0.4714 0.5363 -0.7001
|
||||||
|
vn -0.0000 0.7938 0.6081
|
||||||
|
vn -0.2903 0.5819 -0.7597
|
||||||
|
vn -0.0980 0.6052 -0.7900
|
||||||
|
vn -0.0000 -0.7938 -0.6081
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 21/34/17 22/35/17 24/36/17 23/37/17
|
||||||
|
f 23/37/18 24/36/18 26/38/18 25/39/18
|
||||||
|
f 25/39/19 26/38/19 28/40/19 27/41/19
|
||||||
|
f 27/41/20 28/40/20 30/42/20 29/43/20
|
||||||
|
f 29/43/21 30/42/21 32/44/21 31/45/21
|
||||||
|
f 31/45/22 32/44/22 34/46/22 33/47/22
|
||||||
|
f 33/47/23 34/46/23 36/48/23 35/49/23
|
||||||
|
f 35/49/24 36/48/24 38/50/24 37/51/24
|
||||||
|
f 37/51/25 38/50/25 40/52/25 39/53/25
|
||||||
|
f 39/53/26 40/52/26 42/54/26 41/55/26
|
||||||
|
f 41/55/27 42/54/27 44/56/27 43/57/27
|
||||||
|
f 43/57/28 44/56/28 46/58/28 45/59/28
|
||||||
|
f 45/59/29 46/58/29 48/60/29 47/61/29
|
||||||
|
f 47/61/30 48/60/30 50/62/30 49/63/30
|
||||||
|
f 49/63/31 50/62/31 52/64/31 51/65/31
|
||||||
|
f 51/65/32 52/64/32 54/66/32 53/67/32
|
||||||
|
f 53/67/33 54/66/33 56/68/33 55/69/33
|
||||||
|
f 55/69/34 56/68/34 58/70/34 57/71/34
|
||||||
|
f 57/71/35 58/70/35 60/72/35 59/73/35
|
||||||
|
f 59/73/36 60/72/36 62/74/36 61/75/36
|
||||||
|
f 61/75/37 62/74/37 64/76/37 63/77/37
|
||||||
|
f 63/77/38 64/76/38 66/78/38 65/79/38
|
||||||
|
f 65/79/39 66/78/39 68/80/39 67/81/39
|
||||||
|
f 67/81/40 68/80/40 70/82/40 69/83/40
|
||||||
|
f 69/83/41 70/82/41 72/84/41 71/85/41
|
||||||
|
f 71/85/42 72/84/42 74/86/42 73/87/42
|
||||||
|
f 73/87/43 74/86/43 76/88/43 75/89/43
|
||||||
|
f 75/89/44 76/88/44 78/90/44 77/91/44
|
||||||
|
f 77/91/45 78/90/45 80/92/45 79/93/45
|
||||||
|
f 79/93/46 80/92/46 82/94/46 81/95/46
|
||||||
|
f 24/96/47 22/97/47 84/98/47 82/99/47 80/100/47 78/101/47 76/102/47 74/103/47 72/104/47 70/105/47 68/106/47 66/107/47 64/108/47 62/109/47 60/110/47 58/111/47 56/112/47 54/113/47 52/114/47 50/115/47 48/116/47 46/117/47 44/118/47 42/119/47 40/120/47 38/121/47 36/122/47 34/123/47 32/124/47 30/125/47 28/126/47 26/127/47
|
||||||
|
f 81/95/48 82/94/48 84/128/48 83/129/48
|
||||||
|
f 83/129/49 84/128/49 22/130/49 21/131/49
|
||||||
|
f 21/132/50 23/133/50 25/134/50 27/135/50 29/136/50 31/137/50 33/138/50 35/139/50 37/140/50 39/141/50 41/142/50 43/143/50 45/144/50 47/145/50 49/146/50 51/147/50 53/148/50 55/149/50 57/150/50 59/151/50 61/152/50 63/153/50 65/154/50 67/155/50 69/156/50 71/157/50 73/158/50 75/159/50 77/160/50 79/161/50 81/162/50 83/163/50
|
94
models/platform4.obj
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
# Blender v2.91.2 OBJ File: 'starting_site_2.blend'
|
||||||
|
# www.blender.org
|
||||||
|
mtllib platfomr3.mtl
|
||||||
|
o Kostka.009_Kostka.013
|
||||||
|
v -49.969376 -2.805061 50.006348
|
||||||
|
v -49.187107 -0.070366 49.224083
|
||||||
|
v -49.969376 -2.805061 -49.993652
|
||||||
|
v -49.187107 -0.070366 -49.211380
|
||||||
|
v 50.030624 -2.805061 50.006348
|
||||||
|
v 49.248356 -0.070366 49.224083
|
||||||
|
v 50.030624 -2.805061 -49.993652
|
||||||
|
v 49.248356 -0.070366 -49.211380
|
||||||
|
v -49.187107 1.791470 49.224083
|
||||||
|
v -49.187107 1.791470 -49.211380
|
||||||
|
v 49.248356 1.791470 49.224083
|
||||||
|
v 49.248356 1.791470 -49.211380
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vn -0.9614 0.2750 0.0000
|
||||||
|
vn 0.0000 0.2750 -0.9614
|
||||||
|
vn 0.9614 0.2750 0.0000
|
||||||
|
vn 0.0000 0.2750 0.9614
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||||
|
f 3/4/2 4/3/2 8/5/2 7/6/2
|
||||||
|
f 7/6/3 8/5/3 6/7/3 5/8/3
|
||||||
|
f 5/8/4 6/7/4 2/9/4 1/10/4
|
||||||
|
f 3/11/5 7/6/5 5/8/5 1/12/5
|
||||||
|
f 6/7/6 8/5/6 12/13/6 11/14/6
|
||||||
|
f 12/13/7 10/15/7 9/16/7 11/14/7
|
||||||
|
f 4/3/8 2/2/8 9/17/8 10/18/8
|
||||||
|
f 2/9/9 6/7/9 11/14/9 9/19/9
|
||||||
|
f 8/5/10 4/3/10 10/18/10 12/13/10
|
||||||
|
o Kostka.004_Kostka.003
|
||||||
|
v -0.969376 1.369067 -14.278819
|
||||||
|
v -0.969376 2.585751 -15.931281
|
||||||
|
v -0.969376 1.369067 -16.278820
|
||||||
|
v -0.969376 2.585751 -16.278820
|
||||||
|
v 1.030624 1.369067 -14.278819
|
||||||
|
v 1.030624 2.585751 -15.931281
|
||||||
|
v 1.030624 1.369067 -16.278820
|
||||||
|
v 1.030624 2.585751 -16.278820
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.8053 0.5929
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 13/20/11 14/21/11 16/22/11 15/23/11
|
||||||
|
f 15/23/12 16/22/12 20/24/12 19/25/12
|
||||||
|
f 19/25/13 20/24/13 18/26/13 17/27/13
|
||||||
|
f 17/27/14 18/26/14 14/28/14 13/29/14
|
||||||
|
f 15/30/15 19/25/15 17/27/15 13/31/15
|
||||||
|
f 20/24/16 16/32/16 14/33/16 18/26/16
|
205
models/platform_2.obj
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
# Blender v2.91.2 OBJ File: 'starting_site_2.blend'
|
||||||
|
# www.blender.org
|
||||||
|
mtllib platform_2.mtl
|
||||||
|
o Kostka.009_Kostka.013
|
||||||
|
v -49.969376 -2.805061 50.006348
|
||||||
|
v -49.187107 -0.070366 49.224083
|
||||||
|
v -49.969376 -2.805061 -49.993652
|
||||||
|
v -49.187107 -0.070366 -49.211380
|
||||||
|
v 50.030624 -2.805061 50.006348
|
||||||
|
v 49.248356 -0.070366 49.224083
|
||||||
|
v 50.030624 -2.805061 -49.993652
|
||||||
|
v 49.248356 -0.070366 -49.211380
|
||||||
|
v -49.187107 1.791470 49.224083
|
||||||
|
v -49.187107 1.791470 -49.211380
|
||||||
|
v 49.248356 1.791470 49.224083
|
||||||
|
v 49.248356 1.791470 -49.211380
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vn -0.9614 0.2750 0.0000
|
||||||
|
vn 0.0000 0.2750 -0.9614
|
||||||
|
vn 0.9614 0.2750 0.0000
|
||||||
|
vn 0.0000 0.2750 0.9614
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||||
|
f 3/4/2 4/3/2 8/5/2 7/6/2
|
||||||
|
f 7/6/3 8/5/3 6/7/3 5/8/3
|
||||||
|
f 5/8/4 6/7/4 2/9/4 1/10/4
|
||||||
|
f 3/11/5 7/6/5 5/8/5 1/12/5
|
||||||
|
f 6/7/6 8/5/6 12/13/6 11/14/6
|
||||||
|
f 12/13/7 10/15/7 9/16/7 11/14/7
|
||||||
|
f 4/3/8 2/2/8 9/17/8 10/18/8
|
||||||
|
f 2/9/9 6/7/9 11/14/9 9/19/9
|
||||||
|
f 8/5/10 4/3/10 10/18/10 12/13/10
|
||||||
|
o Kostka.002_Kostka.027
|
||||||
|
v -2.969376 1.555083 7.509674
|
||||||
|
v -2.969376 30.188183 7.509674
|
||||||
|
v -2.969376 1.555083 5.493874
|
||||||
|
v -2.969376 30.188183 5.493874
|
||||||
|
v 3.030624 1.555083 7.509674
|
||||||
|
v 3.030624 30.188183 7.509674
|
||||||
|
v 3.030624 1.555083 5.493874
|
||||||
|
v 3.030624 30.188183 5.493874
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 13/20/11 14/21/11 16/22/11 15/23/11
|
||||||
|
f 15/23/12 16/22/12 20/24/12 19/25/12
|
||||||
|
f 19/25/13 20/24/13 18/26/13 17/27/13
|
||||||
|
f 17/27/14 18/26/14 14/28/14 13/29/14
|
||||||
|
f 15/30/15 19/25/15 17/27/15 13/31/15
|
||||||
|
f 20/24/16 16/32/16 14/33/16 18/26/16
|
||||||
|
o Kostka
|
||||||
|
v -0.162833 15.989394 6.133174
|
||||||
|
v -0.162833 16.658024 6.133174
|
||||||
|
v -0.162833 15.989394 0.976624
|
||||||
|
v -0.162833 16.658024 0.976624
|
||||||
|
v 0.224081 15.989394 6.133174
|
||||||
|
v 0.224081 16.658024 6.133174
|
||||||
|
v 0.224081 15.989394 0.976624
|
||||||
|
v 0.224081 16.658024 0.976624
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 21/34/17 22/35/17 24/36/17 23/37/17
|
||||||
|
f 23/37/18 24/36/18 28/38/18 27/39/18
|
||||||
|
f 27/39/19 28/38/19 26/40/19 25/41/19
|
||||||
|
f 25/41/20 26/40/20 22/42/20 21/43/20
|
||||||
|
f 23/44/21 27/39/21 25/41/21 21/45/21
|
||||||
|
f 28/38/22 24/46/22 22/47/22 26/40/22
|
||||||
|
o Kostka.001
|
||||||
|
v -0.162833 14.651886 6.133174
|
||||||
|
v -0.162833 15.320517 6.133174
|
||||||
|
v -0.162833 14.651886 0.976624
|
||||||
|
v -0.162833 15.320517 0.976624
|
||||||
|
v 0.224081 14.651886 6.133174
|
||||||
|
v 0.224081 15.320517 6.133174
|
||||||
|
v 0.224081 14.651886 0.976624
|
||||||
|
v 0.224081 15.320517 0.976624
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 29/48/23 30/49/23 32/50/23 31/51/23
|
||||||
|
f 31/51/24 32/50/24 36/52/24 35/53/24
|
||||||
|
f 35/53/25 36/52/25 34/54/25 33/55/25
|
||||||
|
f 33/55/26 34/54/26 30/56/26 29/57/26
|
||||||
|
f 31/58/27 35/53/27 33/55/27 29/59/27
|
||||||
|
f 36/52/28 32/60/28 30/61/28 34/54/28
|
||||||
|
o Kostka.003_Kostka.002
|
||||||
|
v -0.162833 13.285920 6.133174
|
||||||
|
v -0.162833 13.954551 6.133174
|
||||||
|
v -0.162833 13.285920 0.976624
|
||||||
|
v -0.162833 13.954551 0.976624
|
||||||
|
v 0.224081 13.285920 6.133174
|
||||||
|
v 0.224081 13.954551 6.133174
|
||||||
|
v 0.224081 13.285920 0.976624
|
||||||
|
v 0.224081 13.954551 0.976624
|
||||||
|
vt 0.375000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.250000
|
||||||
|
vt 0.375000 0.250000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.375000 0.500000
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.625000 1.000000
|
||||||
|
vt 0.375000 1.000000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 37/62/29 38/63/29 40/64/29 39/65/29
|
||||||
|
f 39/65/30 40/64/30 44/66/30 43/67/30
|
||||||
|
f 43/67/31 44/66/31 42/68/31 41/69/31
|
||||||
|
f 41/69/32 42/68/32 38/70/32 37/71/32
|
||||||
|
f 39/72/33 43/67/33 41/69/33 37/73/33
|
||||||
|
f 44/66/34 40/74/34 38/75/34 42/68/34
|
184320
models/rakieta_saturn.obj
Normal file
142509
models/rocket.obj
Normal file
21957
models/saturn-v.obj
Normal file
11
shaders/shader_skybox.frag
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#version 430 core
|
||||||
|
out vec4 FragColor;
|
||||||
|
|
||||||
|
in vec3 TexCoords;
|
||||||
|
|
||||||
|
uniform samplerCube skybox;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_FragColor = texture(skybox, TexCoords);
|
||||||
|
}
|
14
shaders/shader_skybox.vert
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#version 430 core
|
||||||
|
layout (location = 0) in vec3 aPos;
|
||||||
|
|
||||||
|
out vec3 TexCoords;
|
||||||
|
|
||||||
|
uniform mat4 projection;
|
||||||
|
uniform mat4 view;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
TexCoords = aPos;
|
||||||
|
vec4 pos = projection * view * vec4(aPos, 1.0);
|
||||||
|
gl_Position = pos.xyww;
|
||||||
|
}
|
@ -1,13 +1,15 @@
|
|||||||
#version 430 core
|
#version 430 core
|
||||||
|
|
||||||
uniform sampler2D textureSampler;
|
uniform sampler2D textureSampler;
|
||||||
uniform vec3 lightDir;
|
//uniform vec3 lightDir;
|
||||||
|
uniform vec3 lightPos;
|
||||||
|
|
||||||
in vec3 interpNormal;
|
in vec3 interpNormal;
|
||||||
in vec2 interpTexCoord;
|
in vec2 interpTexCoord;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
vec3 lightDir = normalize(-lightPos);
|
||||||
vec2 modifiedTexCoord = vec2(interpTexCoord.x, 1.0 - interpTexCoord.y); // Poprawka dla tekstur Ziemi, ktore bez tego wyswietlaja sie 'do gory nogami'
|
vec2 modifiedTexCoord = vec2(interpTexCoord.x, 1.0 - interpTexCoord.y); // Poprawka dla tekstur Ziemi, ktore bez tego wyswietlaja sie 'do gory nogami'
|
||||||
vec3 color = texture2D(textureSampler, modifiedTexCoord).rgb;
|
vec3 color = texture2D(textureSampler, modifiedTexCoord).rgb;
|
||||||
vec3 normal = normalize(interpNormal);
|
vec3 normal = normalize(interpNormal);
|
||||||
|
113
src/Skybox.cpp
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
#include "Skybox.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include "glew.h"
|
||||||
|
#include "freeglut.h"
|
||||||
|
#include "glm.hpp"
|
||||||
|
#include "ext.hpp"
|
||||||
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
|
#include "stb_image.h"
|
||||||
|
|
||||||
|
static GLuint skyboxVAO, skyboxVBO;
|
||||||
|
float skyboxVertices[] = {
|
||||||
|
// positions
|
||||||
|
-10.0f, 10.0f, -10.0f,
|
||||||
|
-10.0f, -10.0f, -10.0f,
|
||||||
|
10.0f, -10.0f, -10.0f,
|
||||||
|
10.0f, -10.0f, -10.0f,
|
||||||
|
10.0f, 10.0f, -10.0f,
|
||||||
|
-10.0f, 10.0f, -10.0f,
|
||||||
|
|
||||||
|
-10.0f, -10.0f, 10.0f,
|
||||||
|
-10.0f, -10.0f, -10.0f,
|
||||||
|
-10.0f, 10.0f, -10.0f,
|
||||||
|
-10.0f, 10.0f, -10.0f,
|
||||||
|
-10.0f, 10.0f, 10.0f,
|
||||||
|
-10.0f, -10.0f, 10.0f,
|
||||||
|
|
||||||
|
10.0f, -10.0f, -10.0f,
|
||||||
|
10.0f, -10.0f, 10.0f,
|
||||||
|
10.0f, 10.0f, 10.0f,
|
||||||
|
10.0f, 10.0f, 10.0f,
|
||||||
|
10.0f, 10.0f, -10.0f,
|
||||||
|
10.0f, -10.0f, -10.0f,
|
||||||
|
|
||||||
|
-10.0f, -10.0f, 10.0f,
|
||||||
|
-10.0f, 10.0f, 10.0f,
|
||||||
|
10.0f, 10.0f, 10.0f,
|
||||||
|
10.0f, 10.0f, 10.0f,
|
||||||
|
10.0f, -10.0f, 10.0f,
|
||||||
|
-10.0f, -10.0f, 10.0f,
|
||||||
|
|
||||||
|
-10.0f, 10.0f, -10.0f,
|
||||||
|
10.0f, 10.0f, -10.0f,
|
||||||
|
10.0f, 10.0f, 10.0f,
|
||||||
|
10.0f, 10.0f, 10.0f,
|
||||||
|
-10.0f, 10.0f, 10.0f,
|
||||||
|
-10.0f, 10.0f, -10.0f,
|
||||||
|
|
||||||
|
-10.0f, -10.0f, -10.0f,
|
||||||
|
-10.0f, -10.0f, 10.0f,
|
||||||
|
10.0f, -10.0f, -10.0f,
|
||||||
|
10.0f, -10.0f, -10.0f,
|
||||||
|
-10.0f, -10.0f, 10.0f,
|
||||||
|
10.0f, -10.0f, 10.0f
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned int Skybox::loadCubemap(std::vector<std::string> faces)
|
||||||
|
{
|
||||||
|
unsigned int textureID;
|
||||||
|
glGenTextures(1, &textureID);
|
||||||
|
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
|
||||||
|
|
||||||
|
int width, height, nrChannels;
|
||||||
|
for (unsigned int i = 0; i < faces.size(); i++)
|
||||||
|
{
|
||||||
|
unsigned char* data = stbi_load(faces[i].c_str(), &width , &height, &nrChannels, 0);
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
|
||||||
|
0, GL_RGB, width , height , 0, GL_RGB, GL_UNSIGNED_BYTE, data
|
||||||
|
);
|
||||||
|
stbi_image_free(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Cubemap tex failed to load at path: " << faces[i] << std::endl;
|
||||||
|
stbi_image_free(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||||
|
|
||||||
|
return textureID;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Skybox::drawSkybox(GLuint program, glm::mat4 cameraMatrix, glm::mat4 perspectiveMatrix, GLuint texture)
|
||||||
|
{
|
||||||
|
glUseProgram(program);
|
||||||
|
glDepthFunc(GL_LEQUAL);
|
||||||
|
glGenVertexArrays(1, &skyboxVAO);
|
||||||
|
glGenBuffers(1, &skyboxVBO);
|
||||||
|
glBindVertexArray(skyboxVAO);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, skyboxVBO);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(skyboxVertices), &skyboxVertices, GL_STATIC_DRAW);
|
||||||
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
|
||||||
|
glEnableVertexAttribArray(0);
|
||||||
|
glm::mat4 view = glm::mat4(glm::mat3(cameraMatrix));
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(program, "projection"), 1, GL_FALSE, (float*)&perspectiveMatrix);
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(program, "view"), 1, GL_FALSE, (float*)&view);
|
||||||
|
glBindVertexArray(skyboxVAO);
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
|
||||||
|
glDrawArrays(GL_TRIANGLES, 0, 36);
|
||||||
|
glBindVertexArray(0);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
glDeleteBuffers(1, &skyboxVBO);
|
||||||
|
glDeleteVertexArrays(1, &skyboxVAO);
|
||||||
|
glDepthFunc(GL_LESS);
|
||||||
|
glUseProgram(0);
|
||||||
|
}
|
17
src/Skybox.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include "glew.h"
|
||||||
|
#include "freeglut.h"
|
||||||
|
#include "glm.hpp"
|
||||||
|
#include "ext.hpp"
|
||||||
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
|
#include "stb_image.h"
|
||||||
|
class Skybox
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
unsigned static int loadCubemap(std::vector<std::string> faces);
|
||||||
|
static void drawSkybox(GLuint program, glm::mat4 cameraMatrix, glm::mat4 perspectiveMatrix, GLuint texture);
|
||||||
|
};
|
296
src/main_8_1.cpp
Normal file
@ -0,0 +1,296 @@
|
|||||||
|
#include "glew.h"
|
||||||
|
#include "freeglut.h"
|
||||||
|
#include "glm.hpp"
|
||||||
|
#include "ext.hpp"
|
||||||
|
#include <iostream>
|
||||||
|
#include <cmath>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "Shader_Loader.h"
|
||||||
|
#include "Render_Utils.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "Texture.h"
|
||||||
|
#include "Physics.h"
|
||||||
|
#include "Skybox.h"
|
||||||
|
|
||||||
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
|
#include "stb_image.h"
|
||||||
|
|
||||||
|
Core::Shader_Loader shaderLoader;
|
||||||
|
GLuint programColor;
|
||||||
|
GLuint programTexture;
|
||||||
|
GLuint programSkybox;
|
||||||
|
GLuint cubemapTexture;
|
||||||
|
GLuint skyboxVAO, skyboxVBO;
|
||||||
|
|
||||||
|
obj::Model planeModel;
|
||||||
|
obj::Model boxModel;
|
||||||
|
obj::Model shipModel;
|
||||||
|
obj::Model boosterModel;
|
||||||
|
obj::Model platformModel;
|
||||||
|
obj::Model craneModel;
|
||||||
|
obj::Model lampModel;
|
||||||
|
glm::mat4 boxModelMatrix;
|
||||||
|
GLuint boxTexture, groundTexture, shipTexture, stoneTexture, redTex;
|
||||||
|
Core::RenderContext planeContext, boxContext, shipContext, boosterContext, platformContext, craneContext, lampContext;
|
||||||
|
|
||||||
|
glm::vec3 cameraPos = glm::vec3(0, 10, 25);
|
||||||
|
glm::vec3 cameraDir;
|
||||||
|
glm::vec3 cameraSide;
|
||||||
|
float cameraAngle = 0;
|
||||||
|
glm::mat4 cameraMatrix, perspectiveMatrix;
|
||||||
|
|
||||||
|
glm::vec3 lightDir = glm::normalize(glm::vec3(0.5, -1, -0.5));
|
||||||
|
glm::vec3 lightPos = glm::vec3(-15.75, 2, 0);
|
||||||
|
|
||||||
|
|
||||||
|
// Initalization of physical scene (PhysX)
|
||||||
|
Physics pxScene(9.8f /* gravity (m/s^2) */);
|
||||||
|
|
||||||
|
// fixed timestep for stable and deterministic simulation
|
||||||
|
const double physicsStepTime = 1.f / 60.f;
|
||||||
|
double physicsTimeToProcess = 0;
|
||||||
|
|
||||||
|
// physical objects
|
||||||
|
PxRigidStatic *planeBody = nullptr;
|
||||||
|
PxMaterial *planeMaterial = nullptr;
|
||||||
|
PxRigidDynamic *boxBody = nullptr;
|
||||||
|
PxMaterial *boxMaterial = nullptr;
|
||||||
|
|
||||||
|
std::vector<std::string> faces
|
||||||
|
{
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void initRenderables()
|
||||||
|
{
|
||||||
|
// load models
|
||||||
|
planeModel = obj::loadModelFromFile("models/plane.obj");
|
||||||
|
boxModel = obj::loadModelFromFile("models/box.obj");
|
||||||
|
shipModel = obj::loadModelFromFile("models/ship.obj");
|
||||||
|
boosterModel = obj::loadModelFromFile("models/booster.obj");
|
||||||
|
platformModel = obj::loadModelFromFile("models/platform4.obj");
|
||||||
|
craneModel = obj::loadModelFromFile("models/crane.obj");
|
||||||
|
lampModel = obj::loadModelFromFile("models/lamp2.obj");
|
||||||
|
|
||||||
|
// load textures
|
||||||
|
groundTexture = Core::LoadTexture("textures/sand.jpg");
|
||||||
|
boxTexture = Core::LoadTexture("textures/a.jpg");
|
||||||
|
shipTexture = Core::LoadTexture("textures/ship.png");
|
||||||
|
stoneTexture = Core::LoadTexture("textures/stone.png");
|
||||||
|
redTex = Core::LoadTexture("textures/redTex.png");
|
||||||
|
|
||||||
|
planeContext.initFromOBJ(planeModel);
|
||||||
|
boxContext.initFromOBJ(boxModel);
|
||||||
|
shipContext.initFromOBJ(shipModel);
|
||||||
|
boosterContext.initFromOBJ(boosterModel);
|
||||||
|
platformContext.initFromOBJ(platformModel);
|
||||||
|
craneContext.initFromOBJ(craneModel);
|
||||||
|
lampContext.initFromOBJ(lampModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void initPhysicsScene()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateTransforms()
|
||||||
|
{
|
||||||
|
// Here we retrieve the current transforms of the objects from the physical simulation.
|
||||||
|
auto actorFlags = PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC;
|
||||||
|
PxU32 nbActors = pxScene.scene->getNbActors(actorFlags);
|
||||||
|
if (nbActors)
|
||||||
|
{
|
||||||
|
std::vector<PxRigidActor*> actors(nbActors);
|
||||||
|
pxScene.scene->getActors(actorFlags, (PxActor**)&actors[0], nbActors);
|
||||||
|
for (auto actor : actors)
|
||||||
|
{
|
||||||
|
// We use the userData of the objects to set up the proper model matrices.
|
||||||
|
if (!actor->userData) continue;
|
||||||
|
glm::mat4 *modelMatrix = (glm::mat4*)actor->userData;
|
||||||
|
|
||||||
|
// get world matrix of the object (actor)
|
||||||
|
PxMat44 transform = actor->getGlobalPose();
|
||||||
|
auto &c0 = transform.column0;
|
||||||
|
auto &c1 = transform.column1;
|
||||||
|
auto &c2 = transform.column2;
|
||||||
|
auto &c3 = transform.column3;
|
||||||
|
|
||||||
|
// set up the model matrix used for the rendering
|
||||||
|
*modelMatrix = glm::mat4(
|
||||||
|
c0.x, c0.y, c0.z, c0.w,
|
||||||
|
c1.x, c1.y, c1.z, c1.w,
|
||||||
|
c2.x, c2.y, c2.z, c2.w,
|
||||||
|
c3.x, c3.y, c3.z, c3.w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyboard(unsigned char key, int x, int y)
|
||||||
|
{
|
||||||
|
float angleSpeed = 0.1f;
|
||||||
|
float moveSpeed = 0.5f;
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case 'z': cameraAngle -= angleSpeed; break;
|
||||||
|
case 'x': cameraAngle += angleSpeed; break;
|
||||||
|
case 'w': cameraPos += cameraDir * moveSpeed; break;
|
||||||
|
case 's': cameraPos -= cameraDir * moveSpeed; break;
|
||||||
|
case 'd': cameraPos += cameraSide * moveSpeed; break;
|
||||||
|
case 'a': cameraPos -= cameraSide * moveSpeed; break;
|
||||||
|
case 'e': cameraPos += glm::cross(cameraDir, glm::vec3(1, 0, 0)) * moveSpeed; break;
|
||||||
|
case 'q': cameraPos -= glm::cross(cameraDir, glm::vec3(1, 0, 0)) * moveSpeed; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouse(int x, int y)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::mat4 createCameraMatrix()
|
||||||
|
{
|
||||||
|
cameraDir = glm::normalize(glm::vec3(cosf(cameraAngle - glm::radians(90.0f)), 0, sinf(cameraAngle - glm::radians(90.0f))));
|
||||||
|
glm::vec3 up = glm::vec3(0, 1, 0);
|
||||||
|
cameraSide = glm::cross(cameraDir, up);
|
||||||
|
|
||||||
|
return Core::createViewMatrix(cameraPos, cameraDir, up);
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawObjectColor(Core::RenderContext context, glm::mat4 modelMatrix, glm::vec3 color)
|
||||||
|
{
|
||||||
|
GLuint program = programColor;
|
||||||
|
|
||||||
|
glUseProgram(program);
|
||||||
|
|
||||||
|
glUniform3f(glGetUniformLocation(program, "objectColor"), color.x, color.y, color.z);
|
||||||
|
glUniform3f(glGetUniformLocation(program, "lightDir"), lightDir.x, lightDir.y, lightDir.z);
|
||||||
|
|
||||||
|
glm::mat4 transformation = perspectiveMatrix * cameraMatrix * modelMatrix;
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(program, "modelViewProjectionMatrix"), 1, GL_FALSE, (float*)&transformation);
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
|
||||||
|
|
||||||
|
Core::DrawContext(context);
|
||||||
|
|
||||||
|
glUseProgram(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawObjectTexture(Core::RenderContext context, glm::mat4 modelMatrix, GLuint textureId)
|
||||||
|
{
|
||||||
|
GLuint program = programTexture;
|
||||||
|
|
||||||
|
glUseProgram(program);
|
||||||
|
|
||||||
|
glUniform3f(glGetUniformLocation(program, "lightDir"), lightDir.x, lightDir.y, lightDir.z);
|
||||||
|
glUniform3f(glGetUniformLocation(program, "lightPos"), lightPos.x, lightPos.y, lightPos.z);
|
||||||
|
Core::SetActiveTexture(textureId, "textureSampler", program, 0);
|
||||||
|
|
||||||
|
glm::mat4 transformation = perspectiveMatrix * cameraMatrix * modelMatrix;
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(program, "modelViewProjectionMatrix"), 1, GL_FALSE, (float*)&transformation);
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
|
||||||
|
|
||||||
|
Core::DrawContext(context);
|
||||||
|
|
||||||
|
glUseProgram(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void renderScene()
|
||||||
|
{
|
||||||
|
double time = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
|
||||||
|
static double prevTime = time;
|
||||||
|
double dtime = time - prevTime;
|
||||||
|
prevTime = time;
|
||||||
|
|
||||||
|
// Update physics
|
||||||
|
if (dtime < 1.f) {
|
||||||
|
physicsTimeToProcess += dtime;
|
||||||
|
while (physicsTimeToProcess > 0) {
|
||||||
|
// here we perform the physics simulation step
|
||||||
|
pxScene.step(physicsStepTime);
|
||||||
|
physicsTimeToProcess -= physicsStepTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update of camera and perspective matrices
|
||||||
|
cameraMatrix = createCameraMatrix();
|
||||||
|
perspectiveMatrix = Core::createPerspectiveMatrix(0.1f, 1000.f);
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
glClearColor(0.0f, 0.1f, 0.3f, 1.0f);
|
||||||
|
glUseProgram(programTexture);
|
||||||
|
|
||||||
|
// Drawing skybox
|
||||||
|
Skybox::drawSkybox(programSkybox, cameraMatrix, perspectiveMatrix, cubemapTexture);
|
||||||
|
|
||||||
|
glUniform3f(glGetUniformLocation(programTexture, "lightPos"), 0, 0, 0);
|
||||||
|
|
||||||
|
// update transforms from physics simulation
|
||||||
|
updateTransforms();
|
||||||
|
|
||||||
|
// render models
|
||||||
|
drawObjectTexture(planeContext, glm::translate(glm::vec3(0, 0, 0)), groundTexture);
|
||||||
|
drawObjectTexture(shipContext, glm::translate(glm::vec3(0,3,0)), shipTexture); // boxModelMatrix was updated in updateTransforms()
|
||||||
|
drawObjectTexture(boosterContext, glm::translate(glm::vec3(0, 3, 0)), shipTexture);
|
||||||
|
drawObjectTexture(platformContext, glm::rotate(glm::radians(90.f), glm::vec3(0.f, 1.f, 0.f)), stoneTexture);
|
||||||
|
drawObjectTexture(craneContext, glm::rotate(glm::radians(90.f), glm::vec3(0.f, 1.f, 0.f)), redTex);
|
||||||
|
drawObjectColor(lampContext, glm::translate(glm::vec3(lightPos)) * glm::rotate(glm::radians(90.f), glm::vec3(0.f, 1.f, 0.f)), glm::vec3(1, 1, 1));
|
||||||
|
glutSwapBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
srand((unsigned int)time(0));
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
programColor = shaderLoader.CreateProgram("shaders/shader_color.vert", "shaders/shader_color.frag");
|
||||||
|
programTexture = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");
|
||||||
|
programSkybox = shaderLoader.CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
|
||||||
|
|
||||||
|
cubemapTexture = Skybox::loadCubemap(faces);
|
||||||
|
initRenderables();
|
||||||
|
initPhysicsScene();
|
||||||
|
}
|
||||||
|
|
||||||
|
void shutdown()
|
||||||
|
{
|
||||||
|
shaderLoader.DeleteProgram(programColor);
|
||||||
|
shaderLoader.DeleteProgram(programTexture);
|
||||||
|
|
||||||
|
planeContext.initFromOBJ(planeModel);
|
||||||
|
boxContext.initFromOBJ(boxModel);
|
||||||
|
shipContext.initFromOBJ(shipModel);
|
||||||
|
boosterContext.initFromOBJ(boosterModel);
|
||||||
|
platformContext.initFromOBJ(platformModel);
|
||||||
|
craneContext.initFromOBJ(craneModel);
|
||||||
|
lampContext.initFromOBJ(lampModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void idle()
|
||||||
|
{
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char ** argv)
|
||||||
|
{
|
||||||
|
glutInit(&argc, argv);
|
||||||
|
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
|
||||||
|
glutInitWindowPosition(200, 200);
|
||||||
|
glutInitWindowSize(600, 600);
|
||||||
|
glutCreateWindow("Projekt");
|
||||||
|
glewInit();
|
||||||
|
|
||||||
|
init();
|
||||||
|
glutKeyboardFunc(keyboard);
|
||||||
|
glutPassiveMotionFunc(mouse);
|
||||||
|
glutDisplayFunc(renderScene);
|
||||||
|
glutIdleFunc(idle);
|
||||||
|
|
||||||
|
glutMainLoop();
|
||||||
|
|
||||||
|
shutdown();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -11,22 +11,48 @@
|
|||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
#include "Physics.h"
|
#include "Physics.h"
|
||||||
|
#include "Skybox.h"
|
||||||
|
|
||||||
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
|
#include "stb_image.h"
|
||||||
|
|
||||||
Core::Shader_Loader shaderLoader;
|
Core::Shader_Loader shaderLoader;
|
||||||
GLuint programColor;
|
GLuint programColor;
|
||||||
GLuint programTexture;
|
GLuint programTexture;
|
||||||
|
GLuint programSkybox;
|
||||||
|
GLuint cubemapTexture;
|
||||||
|
GLuint skyboxVAO, skyboxVBO;
|
||||||
|
|
||||||
obj::Model planeModel, spaceshipModel, boosterModel;
|
obj::Model planeModel;
|
||||||
Core::RenderContext planeContext, spaceshipContext, boosterContext;
|
obj::Model boxModel;
|
||||||
GLuint boxTexture, groundTexture;
|
obj::Model shipModel;
|
||||||
|
obj::Model boosterModel;
|
||||||
|
obj::Model platformModel;
|
||||||
|
obj::Model craneModel;
|
||||||
|
obj::Model lampModel;
|
||||||
|
glm::mat4 boxModelMatrix;
|
||||||
|
Core::RenderContext planeContext, boxContext, shipContext, boosterContext, platformContext, craneContext, lampContext;
|
||||||
|
GLuint boxTexture, groundTexture, shipTexture, stoneTexture, redTex, yellowTex;
|
||||||
|
|
||||||
glm::vec3 cameraPos = glm::vec3(0, 5, 40);
|
glm::vec3 cameraPos = glm::vec3(-40, 5, 0);
|
||||||
glm::vec3 cameraDir;
|
glm::vec3 cameraDir;
|
||||||
glm::vec3 cameraSide;
|
glm::vec3 cameraSide;
|
||||||
float cameraAngle = 0;
|
float cameraAngle = 0;
|
||||||
glm::mat4 cameraMatrix, perspectiveMatrix;
|
glm::mat4 cameraMatrix, perspectiveMatrix;
|
||||||
|
|
||||||
glm::vec3 lightDir = glm::normalize(glm::vec3(0.5, -1, -0.5));
|
glm::vec3 lightDir = glm::normalize(glm::vec3(0.5, -1, -0.5));
|
||||||
|
glm::vec3 lightPos = glm::vec3(-15.75, 2, 0);
|
||||||
|
|
||||||
|
// skybox
|
||||||
|
std::vector<std::string> faces
|
||||||
|
{
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
"textures/skybox/stars.jpeg",
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Initalization of physical scene (PhysX)
|
// Initalization of physical scene (PhysX)
|
||||||
@ -58,17 +84,29 @@ std::vector<Renderable*> renderables;
|
|||||||
void initRenderables()
|
void initRenderables()
|
||||||
{
|
{
|
||||||
// load models
|
// load models
|
||||||
planeModel = obj::loadModelFromFile("models/plane.obj");
|
planeModel = obj::loadModelFromFile("models/plane2.obj");
|
||||||
spaceshipModel = obj::loadModelFromFile("models/ship.obj");
|
boxModel = obj::loadModelFromFile("models/box.obj");
|
||||||
|
shipModel = obj::loadModelFromFile("models/ship.obj");
|
||||||
boosterModel = obj::loadModelFromFile("models/booster.obj");
|
boosterModel = obj::loadModelFromFile("models/booster.obj");
|
||||||
|
platformModel = obj::loadModelFromFile("models/platform4.obj");
|
||||||
|
craneModel = obj::loadModelFromFile("models/crane.obj");
|
||||||
|
lampModel = obj::loadModelFromFile("models/lamp2.obj");
|
||||||
|
|
||||||
planeContext.initFromOBJ(planeModel);
|
planeContext.initFromOBJ(planeModel);
|
||||||
spaceshipContext.initFromOBJ(spaceshipModel);
|
boxContext.initFromOBJ(boxModel);
|
||||||
|
shipContext.initFromOBJ(shipModel);
|
||||||
boosterContext.initFromOBJ(boosterModel);
|
boosterContext.initFromOBJ(boosterModel);
|
||||||
|
platformContext.initFromOBJ(platformModel);
|
||||||
|
craneContext.initFromOBJ(craneModel);
|
||||||
|
lampContext.initFromOBJ(lampModel);
|
||||||
|
|
||||||
// load textures
|
// load textures
|
||||||
groundTexture = Core::LoadTexture("textures/sand.jpg");
|
groundTexture = Core::LoadTexture("textures/sand.jpg");
|
||||||
boxTexture = Core::LoadTexture("textures/a.jpg");
|
boxTexture = Core::LoadTexture("textures/a.jpg");
|
||||||
|
shipTexture = Core::LoadTexture("textures/ship.png");
|
||||||
|
stoneTexture = Core::LoadTexture("textures/stone.png");
|
||||||
|
redTex = Core::LoadTexture("textures/redTex.png");
|
||||||
|
yellowTex = Core::LoadTexture("textures/yellowTex.jpg");
|
||||||
|
|
||||||
// This time we organize all the renderables in a list
|
// This time we organize all the renderables in a list
|
||||||
// of basic properties (model, transform, texture),
|
// of basic properties (model, transform, texture),
|
||||||
@ -83,13 +121,29 @@ void initRenderables()
|
|||||||
|
|
||||||
Renderable* booster = new Renderable();
|
Renderable* booster = new Renderable();
|
||||||
booster->context = &boosterContext;
|
booster->context = &boosterContext;
|
||||||
booster->textureId = boxTexture;
|
booster->textureId = shipTexture;
|
||||||
renderables.emplace_back(booster);
|
renderables.emplace_back(booster);
|
||||||
|
|
||||||
Renderable* spaceship = new Renderable();
|
Renderable* spaceship = new Renderable();
|
||||||
spaceship->context = &spaceshipContext;
|
spaceship->context = &shipContext;
|
||||||
spaceship->textureId = boxTexture;
|
spaceship->textureId = shipTexture;
|
||||||
renderables.emplace_back(spaceship);
|
renderables.emplace_back(spaceship);
|
||||||
|
|
||||||
|
Renderable* platform = new Renderable();
|
||||||
|
platform->context = &platformContext;
|
||||||
|
platform->textureId = stoneTexture;
|
||||||
|
renderables.emplace_back(platform);
|
||||||
|
|
||||||
|
Renderable* crane = new Renderable();
|
||||||
|
crane->context = &craneContext;
|
||||||
|
crane->textureId = redTex;
|
||||||
|
renderables.emplace_back(crane);
|
||||||
|
|
||||||
|
Renderable* lamp = new Renderable();
|
||||||
|
lamp->context = &lampContext;
|
||||||
|
lamp->textureId = yellowTex;
|
||||||
|
renderables.emplace_back(lamp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initPhysicsScene()
|
void initPhysicsScene()
|
||||||
@ -182,7 +236,7 @@ void mouse(int x, int y)
|
|||||||
|
|
||||||
glm::mat4 createCameraMatrix()
|
glm::mat4 createCameraMatrix()
|
||||||
{
|
{
|
||||||
cameraDir = glm::normalize(glm::vec3(cosf(cameraAngle - glm::radians(90.0f)), 0, sinf(cameraAngle - glm::radians(90.0f))));
|
cameraDir = glm::normalize(glm::vec3(cosf(cameraAngle ), 0, sinf(cameraAngle )));
|
||||||
glm::vec3 up = glm::vec3(0, 1, 0);
|
glm::vec3 up = glm::vec3(0, 1, 0);
|
||||||
cameraSide = glm::cross(cameraDir, up);
|
cameraSide = glm::cross(cameraDir, up);
|
||||||
|
|
||||||
@ -200,6 +254,7 @@ void drawObjectColor(Core::RenderContext* context, glm::mat4 modelMatrix, glm::v
|
|||||||
|
|
||||||
glUniform3f(glGetUniformLocation(program, "objectColor"), color.x, color.y, color.z);
|
glUniform3f(glGetUniformLocation(program, "objectColor"), color.x, color.y, color.z);
|
||||||
glUniform3f(glGetUniformLocation(program, "lightDir"), lightDir.x, lightDir.y, lightDir.z);
|
glUniform3f(glGetUniformLocation(program, "lightDir"), lightDir.x, lightDir.y, lightDir.z);
|
||||||
|
glUniform3f(glGetUniformLocation(program, "lightPos"), lightPos.x, lightPos.y, lightPos.z);
|
||||||
|
|
||||||
glm::mat4 transformation = perspectiveMatrix * cameraMatrix * modelMatrix;
|
glm::mat4 transformation = perspectiveMatrix * cameraMatrix * modelMatrix;
|
||||||
glUniformMatrix4fv(glGetUniformLocation(program, "modelViewProjectionMatrix"), 1, GL_FALSE, (float*)&transformation);
|
glUniformMatrix4fv(glGetUniformLocation(program, "modelViewProjectionMatrix"), 1, GL_FALSE, (float*)&transformation);
|
||||||
@ -217,6 +272,7 @@ void drawObjectTexture(Core::RenderContext * context, glm::mat4 modelMatrix, GLu
|
|||||||
glUseProgram(program);
|
glUseProgram(program);
|
||||||
|
|
||||||
glUniform3f(glGetUniformLocation(program, "lightDir"), lightDir.x, lightDir.y, lightDir.z);
|
glUniform3f(glGetUniformLocation(program, "lightDir"), lightDir.x, lightDir.y, lightDir.z);
|
||||||
|
glUniform3f(glGetUniformLocation(program, "lightPos"), lightPos.x, lightPos.y, lightPos.z);
|
||||||
Core::SetActiveTexture(textureId, "textureSampler", program, 0);
|
Core::SetActiveTexture(textureId, "textureSampler", program, 0);
|
||||||
|
|
||||||
glm::mat4 transformation = perspectiveMatrix * cameraMatrix * modelMatrix;
|
glm::mat4 transformation = perspectiveMatrix * cameraMatrix * modelMatrix;
|
||||||
@ -247,11 +303,13 @@ void renderScene()
|
|||||||
|
|
||||||
// Update of camera and perspective matrices
|
// Update of camera and perspective matrices
|
||||||
cameraMatrix = createCameraMatrix();
|
cameraMatrix = createCameraMatrix();
|
||||||
perspectiveMatrix = Core::createPerspectiveMatrix();
|
perspectiveMatrix = Core::createPerspectiveMatrix(0.1f, 1000.f);
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
glClearColor(0.0f, 0.1f, 0.3f, 1.0f);
|
glClearColor(0.0f, 0.1f, 0.3f, 1.0f);
|
||||||
|
|
||||||
|
Skybox::drawSkybox(programSkybox, cameraMatrix, perspectiveMatrix, cubemapTexture);
|
||||||
|
|
||||||
// update transforms from physics simulation
|
// update transforms from physics simulation
|
||||||
updateTransforms();
|
updateTransforms();
|
||||||
|
|
||||||
@ -282,6 +340,9 @@ void init()
|
|||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
programColor = shaderLoader.CreateProgram("shaders/shader_color.vert", "shaders/shader_color.frag");
|
programColor = shaderLoader.CreateProgram("shaders/shader_color.vert", "shaders/shader_color.frag");
|
||||||
programTexture = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");
|
programTexture = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");
|
||||||
|
programSkybox = shaderLoader.CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
|
||||||
|
|
||||||
|
cubemapTexture = Skybox::loadCubemap(faces);
|
||||||
|
|
||||||
initRenderables();
|
initRenderables();
|
||||||
initPhysicsScene();
|
initPhysicsScene();
|
||||||
@ -292,6 +353,14 @@ void shutdown()
|
|||||||
{
|
{
|
||||||
shaderLoader.DeleteProgram(programColor);
|
shaderLoader.DeleteProgram(programColor);
|
||||||
shaderLoader.DeleteProgram(programTexture);
|
shaderLoader.DeleteProgram(programTexture);
|
||||||
|
|
||||||
|
planeContext.initFromOBJ(planeModel);
|
||||||
|
boxContext.initFromOBJ(boxModel);
|
||||||
|
shipContext.initFromOBJ(shipModel);
|
||||||
|
boosterContext.initFromOBJ(boosterModel);
|
||||||
|
platformContext.initFromOBJ(platformModel);
|
||||||
|
craneContext.initFromOBJ(craneModel);
|
||||||
|
lampContext.initFromOBJ(lampModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void idle()
|
void idle()
|
||||||
@ -305,7 +374,7 @@ int main(int argc, char ** argv)
|
|||||||
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
|
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
|
||||||
glutInitWindowPosition(200, 200);
|
glutInitWindowPosition(200, 200);
|
||||||
glutInitWindowSize(600, 600);
|
glutInitWindowSize(600, 600);
|
||||||
glutCreateWindow("OpenGL + PhysX");
|
glutCreateWindow("Projekt GRK");
|
||||||
glewInit();
|
glewInit();
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
4395
src/stb_image.c
Normal file
269
src/stb_image.h
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
#ifndef STBI_INCLUDE_STB_IMAGE_H
|
||||||
|
#define STBI_INCLUDE_STB_IMAGE_H
|
||||||
|
|
||||||
|
// To get a header file for this, either cut and paste the header,
|
||||||
|
// or create stb_image.h, #define STBI_HEADER_FILE_ONLY, and
|
||||||
|
// then include stb_image.c from it.
|
||||||
|
|
||||||
|
//// begin header file ////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Limitations:
|
||||||
|
// - no jpeg progressive support
|
||||||
|
// - non-HDR formats support 8-bit samples only (jpeg, png)
|
||||||
|
// - no delayed line count (jpeg) -- IJG doesn't support either
|
||||||
|
// - no 1-bit BMP
|
||||||
|
// - GIF always returns *comp=4
|
||||||
|
//
|
||||||
|
// Basic usage (see HDR discussion below):
|
||||||
|
// int x,y,n;
|
||||||
|
// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
|
||||||
|
// // ... process data if not NULL ...
|
||||||
|
// // ... x = width, y = height, n = # 8-bit components per pixel ...
|
||||||
|
// // ... replace '0' with '1'..'4' to force that many components per pixel
|
||||||
|
// // ... but 'n' will always be the number that it would have been if you said 0
|
||||||
|
// stbi_image_free(data)
|
||||||
|
//
|
||||||
|
// Standard parameters:
|
||||||
|
// int *x -- outputs image width in pixels
|
||||||
|
// int *y -- outputs image height in pixels
|
||||||
|
// int *comp -- outputs # of image components in image file
|
||||||
|
// int req_comp -- if non-zero, # of image components requested in result
|
||||||
|
//
|
||||||
|
// The return value from an image loader is an 'unsigned char *' which points
|
||||||
|
// to the pixel data. The pixel data consists of *y scanlines of *x pixels,
|
||||||
|
// with each pixel consisting of N interleaved 8-bit components; the first
|
||||||
|
// pixel pointed to is top-left-most in the image. There is no padding between
|
||||||
|
// image scanlines or between pixels, regardless of format. The number of
|
||||||
|
// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise.
|
||||||
|
// If req_comp is non-zero, *comp has the number of components that _would_
|
||||||
|
// have been output otherwise. E.g. if you set req_comp to 4, you will always
|
||||||
|
// get RGBA output, but you can check *comp to easily see if it's opaque.
|
||||||
|
//
|
||||||
|
// An output image with N components has the following components interleaved
|
||||||
|
// in this order in each pixel:
|
||||||
|
//
|
||||||
|
// N=#comp components
|
||||||
|
// 1 grey
|
||||||
|
// 2 grey, alpha
|
||||||
|
// 3 red, green, blue
|
||||||
|
// 4 red, green, blue, alpha
|
||||||
|
//
|
||||||
|
// If image loading fails for any reason, the return value will be NULL,
|
||||||
|
// and *x, *y, *comp will be unchanged. The function stbi_failure_reason()
|
||||||
|
// can be queried for an extremely brief, end-user unfriendly explanation
|
||||||
|
// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid
|
||||||
|
// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly
|
||||||
|
// more user-friendly ones.
|
||||||
|
//
|
||||||
|
// Paletted PNG, BMP, GIF, and PIC images are automatically depalettized.
|
||||||
|
//
|
||||||
|
// ===========================================================================
|
||||||
|
//
|
||||||
|
// iPhone PNG support:
|
||||||
|
//
|
||||||
|
// By default we convert iphone-formatted PNGs back to RGB; nominally they
|
||||||
|
// would silently load as BGR, except the existing code should have just
|
||||||
|
// failed on such iPhone PNGs. But you can disable this conversion by
|
||||||
|
// by calling stbi_convert_iphone_png_to_rgb(0), in which case
|
||||||
|
// you will always just get the native iphone "format" through.
|
||||||
|
//
|
||||||
|
// Call stbi_set_unpremultiply_on_load(1) as well to force a divide per
|
||||||
|
// pixel to remove any premultiplied alpha *only* if the image file explicitly
|
||||||
|
// says there's premultiplied data (currently only happens in iPhone images,
|
||||||
|
// and only if iPhone convert-to-rgb processing is on).
|
||||||
|
//
|
||||||
|
// ===========================================================================
|
||||||
|
//
|
||||||
|
// HDR image support (disable by defining STBI_NO_HDR)
|
||||||
|
//
|
||||||
|
// stb_image now supports loading HDR images in general, and currently
|
||||||
|
// the Radiance .HDR file format, although the support is provided
|
||||||
|
// generically. You can still load any file through the existing interface;
|
||||||
|
// if you attempt to load an HDR file, it will be automatically remapped to
|
||||||
|
// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;
|
||||||
|
// both of these constants can be reconfigured through this interface:
|
||||||
|
//
|
||||||
|
// stbi_hdr_to_ldr_gamma(2.2f);
|
||||||
|
// stbi_hdr_to_ldr_scale(1.0f);
|
||||||
|
//
|
||||||
|
// (note, do not use _inverse_ constants; stbi_image will invert them
|
||||||
|
// appropriately).
|
||||||
|
//
|
||||||
|
// Additionally, there is a new, parallel interface for loading files as
|
||||||
|
// (linear) floats to preserve the full dynamic range:
|
||||||
|
//
|
||||||
|
// float *data = stbi_loadf(filename, &x, &y, &n, 0);
|
||||||
|
//
|
||||||
|
// If you load LDR images through this interface, those images will
|
||||||
|
// be promoted to floating point values, run through the inverse of
|
||||||
|
// constants corresponding to the above:
|
||||||
|
//
|
||||||
|
// stbi_ldr_to_hdr_scale(1.0f);
|
||||||
|
// stbi_ldr_to_hdr_gamma(2.2f);
|
||||||
|
//
|
||||||
|
// Finally, given a filename (or an open file or memory block--see header
|
||||||
|
// file for details) containing image data, you can query for the "most
|
||||||
|
// appropriate" interface to use (that is, whether the image is HDR or
|
||||||
|
// not), using:
|
||||||
|
//
|
||||||
|
// stbi_is_hdr(char *filename);
|
||||||
|
//
|
||||||
|
// ===========================================================================
|
||||||
|
//
|
||||||
|
// I/O callbacks
|
||||||
|
//
|
||||||
|
// I/O callbacks allow you to read from arbitrary sources, like packaged
|
||||||
|
// files or some other source. Data read from callbacks are processed
|
||||||
|
// through a small internal buffer (currently 128 bytes) to try to reduce
|
||||||
|
// overhead.
|
||||||
|
//
|
||||||
|
// The three functions you must define are "read" (reads some bytes of data),
|
||||||
|
// "skip" (skips some bytes of data), "eof" (reports if the stream is at the end).
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef STBI_NO_STDIO
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER >= 0x1400
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS // suppress bogus warnings about fopen()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define STBI_VERSION 1
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
STBI_default = 0, // only used for req_comp
|
||||||
|
|
||||||
|
STBI_grey = 1,
|
||||||
|
STBI_grey_alpha = 2,
|
||||||
|
STBI_rgb = 3,
|
||||||
|
STBI_rgb_alpha = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef unsigned char stbi_uc;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PRIMARY API - works on images of any type
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// load image by filename, open file, or memory buffer
|
||||||
|
//
|
||||||
|
|
||||||
|
extern stbi_uc* stbi_load_from_memory(stbi_uc const* buffer, int len, int* x, int* y, int* comp, int req_comp);
|
||||||
|
|
||||||
|
#ifndef STBI_NO_STDIO
|
||||||
|
extern stbi_uc* stbi_load(char const* filename, int* x, int* y, int* comp, int req_comp);
|
||||||
|
extern stbi_uc* stbi_load_from_file(FILE* f, int* x, int* y, int* comp, int req_comp);
|
||||||
|
// for stbi_load_from_file, file pointer is left pointing immediately after image
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int (*read) (void* user, char* data, int size); // fill 'data' with 'size' bytes. return number of bytes actually read
|
||||||
|
void (*skip) (void* user, unsigned n); // skip the next 'n' bytes
|
||||||
|
int (*eof) (void* user); // returns nonzero if we are at end of file/data
|
||||||
|
} stbi_io_callbacks;
|
||||||
|
|
||||||
|
extern stbi_uc* stbi_load_from_callbacks(stbi_io_callbacks const* clbk, void* user, int* x, int* y, int* comp, int req_comp);
|
||||||
|
|
||||||
|
#ifndef STBI_NO_HDR
|
||||||
|
extern float* stbi_loadf_from_memory(stbi_uc const* buffer, int len, int* x, int* y, int* comp, int req_comp);
|
||||||
|
|
||||||
|
#ifndef STBI_NO_STDIO
|
||||||
|
extern float* stbi_loadf(char const* filename, int* x, int* y, int* comp, int req_comp);
|
||||||
|
extern float* stbi_loadf_from_file(FILE* f, int* x, int* y, int* comp, int req_comp);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern float* stbi_loadf_from_callbacks(stbi_io_callbacks const* clbk, void* user, int* x, int* y, int* comp, int req_comp);
|
||||||
|
|
||||||
|
extern void stbi_hdr_to_ldr_gamma(float gamma);
|
||||||
|
extern void stbi_hdr_to_ldr_scale(float scale);
|
||||||
|
|
||||||
|
extern void stbi_ldr_to_hdr_gamma(float gamma);
|
||||||
|
extern void stbi_ldr_to_hdr_scale(float scale);
|
||||||
|
#endif // STBI_NO_HDR
|
||||||
|
|
||||||
|
// stbi_is_hdr is always defined
|
||||||
|
extern int stbi_is_hdr_from_callbacks(stbi_io_callbacks const* clbk, void* user);
|
||||||
|
extern int stbi_is_hdr_from_memory(stbi_uc const* buffer, int len);
|
||||||
|
#ifndef STBI_NO_STDIO
|
||||||
|
extern int stbi_is_hdr(char const* filename);
|
||||||
|
extern int stbi_is_hdr_from_file(FILE* f);
|
||||||
|
#endif // STBI_NO_STDIO
|
||||||
|
|
||||||
|
|
||||||
|
// get a VERY brief reason for failure
|
||||||
|
// NOT THREADSAFE
|
||||||
|
extern const char* stbi_failure_reason(void);
|
||||||
|
|
||||||
|
// free the loaded image -- this is just free()
|
||||||
|
extern void stbi_image_free(void* retval_from_stbi_load);
|
||||||
|
|
||||||
|
// get image dimensions & components without fully decoding
|
||||||
|
extern int stbi_info_from_memory(stbi_uc const* buffer, int len, int* x, int* y, int* comp);
|
||||||
|
extern int stbi_info_from_callbacks(stbi_io_callbacks const* clbk, void* user, int* x, int* y, int* comp);
|
||||||
|
|
||||||
|
#ifndef STBI_NO_STDIO
|
||||||
|
extern int stbi_info(char const* filename, int* x, int* y, int* comp);
|
||||||
|
extern int stbi_info_from_file(FILE* f, int* x, int* y, int* comp);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// for image formats that explicitly notate that they have premultiplied alpha,
|
||||||
|
// we just return the colors as stored in the file. set this flag to force
|
||||||
|
// unpremultiplication. results are undefined if the unpremultiply overflow.
|
||||||
|
extern void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply);
|
||||||
|
|
||||||
|
// indicate whether we should process iphone images back to canonical format,
|
||||||
|
// or just pass them through "as-is"
|
||||||
|
extern void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert);
|
||||||
|
|
||||||
|
|
||||||
|
// ZLIB client - used by PNG, available for other purposes
|
||||||
|
|
||||||
|
extern char* stbi_zlib_decode_malloc_guesssize(const char* buffer, int len, int initial_size, int* outlen);
|
||||||
|
extern char* stbi_zlib_decode_malloc(const char* buffer, int len, int* outlen);
|
||||||
|
extern int stbi_zlib_decode_buffer(char* obuffer, int olen, const char* ibuffer, int ilen);
|
||||||
|
|
||||||
|
extern char* stbi_zlib_decode_noheader_malloc(const char* buffer, int len, int* outlen);
|
||||||
|
extern int stbi_zlib_decode_noheader_buffer(char* obuffer, int olen, const char* ibuffer, int ilen);
|
||||||
|
|
||||||
|
|
||||||
|
// define faster low-level operations (typically SIMD support)
|
||||||
|
#ifdef STBI_SIMD
|
||||||
|
typedef void (*stbi_idct_8x8)(stbi_uc* out, int out_stride, short data[64], unsigned short* dequantize);
|
||||||
|
// compute an integer IDCT on "input"
|
||||||
|
// input[x] = data[x] * dequantize[x]
|
||||||
|
// write results to 'out': 64 samples, each run of 8 spaced by 'out_stride'
|
||||||
|
// CLAMP results to 0..255
|
||||||
|
typedef void (*stbi_YCbCr_to_RGB_run)(stbi_uc* output, stbi_uc const* y, stbi_uc const* cb, stbi_uc const* cr, int count, int step);
|
||||||
|
// compute a conversion from YCbCr to RGB
|
||||||
|
// 'count' pixels
|
||||||
|
// write pixels to 'output'; each pixel is 'step' bytes (either 3 or 4; if 4, write '255' as 4th), order R,G,B
|
||||||
|
// y: Y input channel
|
||||||
|
// cb: Cb input channel; scale/biased to be 0..255
|
||||||
|
// cr: Cr input channel; scale/biased to be 0..255
|
||||||
|
|
||||||
|
extern void stbi_install_idct(stbi_idct_8x8 func);
|
||||||
|
extern void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func);
|
||||||
|
#endif // STBI_SIMD
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// end header file /////////////////////////////////////////////////////
|
||||||
|
#endif // STBI_INCLUDE_STB_IMAGE_H
|
445
src/stbi_image_write.c
Normal file
@ -0,0 +1,445 @@
|
|||||||
|
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||||
|
|
||||||
|
#include "stbi_image_write.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef STB_IMAGE_WRITE_IMPLEMENTATION
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
typedef unsigned int stbiw_uint32;
|
||||||
|
typedef int stb_image_write_test[sizeof(stbiw_uint32)==4 ? 1 : -1];
|
||||||
|
|
||||||
|
static void writefv(FILE *f, const char *fmt, va_list v)
|
||||||
|
{
|
||||||
|
while (*fmt) {
|
||||||
|
switch (*fmt++) {
|
||||||
|
case ' ': break;
|
||||||
|
case '1': { unsigned char x = (unsigned char) va_arg(v, int); fputc(x,f); break; }
|
||||||
|
case '2': { int x = va_arg(v,int); unsigned char b[2];
|
||||||
|
b[0] = (unsigned char) x; b[1] = (unsigned char) (x>>8);
|
||||||
|
fwrite(b,2,1,f); break; }
|
||||||
|
case '4': { stbiw_uint32 x = va_arg(v,int); unsigned char b[4];
|
||||||
|
b[0]=(unsigned char)x; b[1]=(unsigned char)(x>>8);
|
||||||
|
b[2]=(unsigned char)(x>>16); b[3]=(unsigned char)(x>>24);
|
||||||
|
fwrite(b,4,1,f); break; }
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void write3(FILE *f, unsigned char a, unsigned char b, unsigned char c)
|
||||||
|
{
|
||||||
|
unsigned char arr[3];
|
||||||
|
arr[0] = a, arr[1] = b, arr[2] = c;
|
||||||
|
fwrite(arr, 3, 1, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void write_pixels(FILE *f, int rgb_dir, int vdir, int x, int y, int comp, void *data, int write_alpha, int scanline_pad)
|
||||||
|
{
|
||||||
|
unsigned char bg[3] = { 255, 0, 255}, px[3];
|
||||||
|
stbiw_uint32 zero = 0;
|
||||||
|
int i,j,k, j_end;
|
||||||
|
|
||||||
|
if (y <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (vdir < 0)
|
||||||
|
j_end = -1, j = y-1;
|
||||||
|
else
|
||||||
|
j_end = y, j = 0;
|
||||||
|
|
||||||
|
for (; j != j_end; j += vdir) {
|
||||||
|
for (i=0; i < x; ++i) {
|
||||||
|
unsigned char *d = (unsigned char *) data + (j*x+i)*comp;
|
||||||
|
if (write_alpha < 0)
|
||||||
|
fwrite(&d[comp-1], 1, 1, f);
|
||||||
|
switch (comp) {
|
||||||
|
case 1:
|
||||||
|
case 2: write3(f, d[0],d[0],d[0]);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if (!write_alpha) {
|
||||||
|
// composite against pink background
|
||||||
|
for (k=0; k < 3; ++k)
|
||||||
|
px[k] = bg[k] + ((d[k] - bg[k]) * d[3])/255;
|
||||||
|
write3(f, px[1-rgb_dir],px[1],px[1+rgb_dir]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
case 3:
|
||||||
|
write3(f, d[1-rgb_dir],d[1],d[1+rgb_dir]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (write_alpha > 0)
|
||||||
|
fwrite(&d[comp-1], 1, 1, f);
|
||||||
|
}
|
||||||
|
fwrite(&zero,scanline_pad,1,f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int outfile(char const *filename, int rgb_dir, int vdir, int x, int y, int comp, void *data, int alpha, int pad, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
if (y < 0 || x < 0) return 0;
|
||||||
|
f = fopen(filename, "wb");
|
||||||
|
if (f) {
|
||||||
|
va_list v;
|
||||||
|
va_start(v, fmt);
|
||||||
|
writefv(f, fmt, v);
|
||||||
|
va_end(v);
|
||||||
|
write_pixels(f,rgb_dir,vdir,x,y,comp,data,alpha,pad);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
return f != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data)
|
||||||
|
{
|
||||||
|
int pad = (-x*3) & 3;
|
||||||
|
return outfile(filename,-1,-1,x,y,comp,(void *) data,0,pad,
|
||||||
|
"11 4 22 4" "4 44 22 444444",
|
||||||
|
'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
|
||||||
|
40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
|
||||||
|
}
|
||||||
|
|
||||||
|
int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)
|
||||||
|
{
|
||||||
|
int has_alpha = !(comp & 1);
|
||||||
|
return outfile(filename, -1,-1, x, y, comp, (void *) data, has_alpha, 0,
|
||||||
|
"111 221 2222 11", 0,0,2, 0,0,0, 0,0,x,y, 24+8*has_alpha, 8*has_alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
// stretchy buffer; stbi__sbpush() == vector<>::push_back() -- stbi__sbcount() == vector<>::size()
|
||||||
|
#define stbi__sbraw(a) ((int *) (a) - 2)
|
||||||
|
#define stbi__sbm(a) stbi__sbraw(a)[0]
|
||||||
|
#define stbi__sbn(a) stbi__sbraw(a)[1]
|
||||||
|
|
||||||
|
#define stbi__sbneedgrow(a,n) ((a)==0 || stbi__sbn(a)+n >= stbi__sbm(a))
|
||||||
|
#define stbi__sbmaybegrow(a,n) (stbi__sbneedgrow(a,(n)) ? stbi__sbgrow(a,n) : 0)
|
||||||
|
#define stbi__sbgrow(a,n) stbi__sbgrowf((void **) &(a), (n), sizeof(*(a)))
|
||||||
|
|
||||||
|
#define stbi__sbpush(a, v) (stbi__sbmaybegrow(a,1), (a)[stbi__sbn(a)++] = (v))
|
||||||
|
#define stbi__sbcount(a) ((a) ? stbi__sbn(a) : 0)
|
||||||
|
#define stbi__sbfree(a) ((a) ? free(stbi__sbraw(a)),0 : 0)
|
||||||
|
|
||||||
|
static void *stbi__sbgrowf(void **arr, int increment, int itemsize)
|
||||||
|
{
|
||||||
|
int m = *arr ? 2*stbi__sbm(*arr)+increment : increment+1;
|
||||||
|
void *p = realloc(*arr ? stbi__sbraw(*arr) : 0, itemsize * m + sizeof(int)*2);
|
||||||
|
assert(p);
|
||||||
|
if (p) {
|
||||||
|
if (!*arr) ((int *) p)[1] = 0;
|
||||||
|
*arr = (void *) ((int *) p + 2);
|
||||||
|
stbi__sbm(*arr) = m;
|
||||||
|
}
|
||||||
|
return *arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char *stbi__zlib_flushf(unsigned char *data, unsigned int *bitbuffer, int *bitcount)
|
||||||
|
{
|
||||||
|
while (*bitcount >= 8) {
|
||||||
|
stbi__sbpush(data, (unsigned char) *bitbuffer);
|
||||||
|
*bitbuffer >>= 8;
|
||||||
|
*bitcount -= 8;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int stbi__zlib_bitrev(int code, int codebits)
|
||||||
|
{
|
||||||
|
int res=0;
|
||||||
|
while (codebits--) {
|
||||||
|
res = (res << 1) | (code & 1);
|
||||||
|
code >>= 1;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int stbi__zlib_countm(unsigned char *a, unsigned char *b, int limit)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0; i < limit && i < 258; ++i)
|
||||||
|
if (a[i] != b[i]) break;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int stbi__zhash(unsigned char *data)
|
||||||
|
{
|
||||||
|
stbiw_uint32 hash = data[0] + (data[1] << 8) + (data[2] << 16);
|
||||||
|
hash ^= hash << 3;
|
||||||
|
hash += hash >> 5;
|
||||||
|
hash ^= hash << 4;
|
||||||
|
hash += hash >> 17;
|
||||||
|
hash ^= hash << 25;
|
||||||
|
hash += hash >> 6;
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define stbi__zlib_flush() (out = stbi__zlib_flushf(out, &bitbuf, &bitcount))
|
||||||
|
#define stbi__zlib_add(code,codebits) \
|
||||||
|
(bitbuf |= (code) << bitcount, bitcount += (codebits), stbi__zlib_flush())
|
||||||
|
#define stbi__zlib_huffa(b,c) stbi__zlib_add(stbi__zlib_bitrev(b,c),c)
|
||||||
|
// default huffman tables
|
||||||
|
#define stbi__zlib_huff1(n) stbi__zlib_huffa(0x30 + (n), 8)
|
||||||
|
#define stbi__zlib_huff2(n) stbi__zlib_huffa(0x190 + (n)-144, 9)
|
||||||
|
#define stbi__zlib_huff3(n) stbi__zlib_huffa(0 + (n)-256,7)
|
||||||
|
#define stbi__zlib_huff4(n) stbi__zlib_huffa(0xc0 + (n)-280,8)
|
||||||
|
#define stbi__zlib_huff(n) ((n) <= 143 ? stbi__zlib_huff1(n) : (n) <= 255 ? stbi__zlib_huff2(n) : (n) <= 279 ? stbi__zlib_huff3(n) : stbi__zlib_huff4(n))
|
||||||
|
#define stbi__zlib_huffb(n) ((n) <= 143 ? stbi__zlib_huff1(n) : stbi__zlib_huff2(n))
|
||||||
|
|
||||||
|
#define stbi__ZHASH 16384
|
||||||
|
|
||||||
|
unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_len, int quality)
|
||||||
|
{
|
||||||
|
static unsigned short lengthc[] = { 3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258, 259 };
|
||||||
|
static unsigned char lengtheb[]= { 0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 };
|
||||||
|
static unsigned short distc[] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 32768 };
|
||||||
|
static unsigned char disteb[] = { 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13 };
|
||||||
|
unsigned int bitbuf=0;
|
||||||
|
int i,j, bitcount=0;
|
||||||
|
unsigned char *out = NULL;
|
||||||
|
unsigned char **hash_table[stbi__ZHASH]; // 64KB on the stack!
|
||||||
|
if (quality < 5) quality = 5;
|
||||||
|
|
||||||
|
stbi__sbpush(out, 0x78); // DEFLATE 32K window
|
||||||
|
stbi__sbpush(out, 0x5e); // FLEVEL = 1
|
||||||
|
stbi__zlib_add(1,1); // BFINAL = 1
|
||||||
|
stbi__zlib_add(1,2); // BTYPE = 1 -- fixed huffman
|
||||||
|
|
||||||
|
for (i=0; i < stbi__ZHASH; ++i)
|
||||||
|
hash_table[i] = NULL;
|
||||||
|
|
||||||
|
i=0;
|
||||||
|
while (i < data_len-3) {
|
||||||
|
// hash next 3 bytes of data to be compressed
|
||||||
|
int h = stbi__zhash(data+i)&(stbi__ZHASH-1), best=3;
|
||||||
|
unsigned char *bestloc = 0;
|
||||||
|
unsigned char **hlist = hash_table[h];
|
||||||
|
int n = stbi__sbcount(hlist);
|
||||||
|
for (j=0; j < n; ++j) {
|
||||||
|
if (hlist[j]-data > i-32768) { // if entry lies within window
|
||||||
|
int d = stbi__zlib_countm(hlist[j], data+i, data_len-i);
|
||||||
|
if (d >= best) best=d,bestloc=hlist[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// when hash table entry is too long, delete half the entries
|
||||||
|
if (hash_table[h] && stbi__sbn(hash_table[h]) == 2*quality) {
|
||||||
|
memcpy(hash_table[h], hash_table[h]+quality, sizeof(hash_table[h][0])*quality);
|
||||||
|
stbi__sbn(hash_table[h]) = quality;
|
||||||
|
}
|
||||||
|
stbi__sbpush(hash_table[h],data+i);
|
||||||
|
|
||||||
|
if (bestloc) {
|
||||||
|
// "lazy matching" - check match at *next* byte, and if it's better, do cur byte as literal
|
||||||
|
h = stbi__zhash(data+i+1)&(stbi__ZHASH-1);
|
||||||
|
hlist = hash_table[h];
|
||||||
|
n = stbi__sbcount(hlist);
|
||||||
|
for (j=0; j < n; ++j) {
|
||||||
|
if (hlist[j]-data > i-32767) {
|
||||||
|
int e = stbi__zlib_countm(hlist[j], data+i+1, data_len-i-1);
|
||||||
|
if (e > best) { // if next match is better, bail on current match
|
||||||
|
bestloc = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bestloc) {
|
||||||
|
int d = data+i - bestloc; // distance back
|
||||||
|
assert(d <= 32767 && best <= 258);
|
||||||
|
for (j=0; best > lengthc[j+1]-1; ++j);
|
||||||
|
stbi__zlib_huff(j+257);
|
||||||
|
if (lengtheb[j]) stbi__zlib_add(best - lengthc[j], lengtheb[j]);
|
||||||
|
for (j=0; d > distc[j+1]-1; ++j);
|
||||||
|
stbi__zlib_add(stbi__zlib_bitrev(j,5),5);
|
||||||
|
if (disteb[j]) stbi__zlib_add(d - distc[j], disteb[j]);
|
||||||
|
i += best;
|
||||||
|
} else {
|
||||||
|
stbi__zlib_huffb(data[i]);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// write out final bytes
|
||||||
|
for (;i < data_len; ++i)
|
||||||
|
stbi__zlib_huffb(data[i]);
|
||||||
|
stbi__zlib_huff(256); // end of block
|
||||||
|
// pad with 0 bits to byte boundary
|
||||||
|
while (bitcount)
|
||||||
|
stbi__zlib_add(0,1);
|
||||||
|
|
||||||
|
for (i=0; i < stbi__ZHASH; ++i)
|
||||||
|
(void) stbi__sbfree(hash_table[i]);
|
||||||
|
|
||||||
|
{
|
||||||
|
// compute adler32 on input
|
||||||
|
unsigned int i=0, s1=1, s2=0, blocklen = data_len % 5552;
|
||||||
|
int j=0;
|
||||||
|
while (j < data_len) {
|
||||||
|
for (i=0; i < blocklen; ++i) s1 += data[j+i], s2 += s1;
|
||||||
|
s1 %= 65521, s2 %= 65521;
|
||||||
|
j += blocklen;
|
||||||
|
blocklen = 5552;
|
||||||
|
}
|
||||||
|
stbi__sbpush(out, (unsigned char) (s2 >> 8));
|
||||||
|
stbi__sbpush(out, (unsigned char) s2);
|
||||||
|
stbi__sbpush(out, (unsigned char) (s1 >> 8));
|
||||||
|
stbi__sbpush(out, (unsigned char) s1);
|
||||||
|
}
|
||||||
|
*out_len = stbi__sbn(out);
|
||||||
|
// make returned pointer freeable
|
||||||
|
memmove(stbi__sbraw(out), out, *out_len);
|
||||||
|
return (unsigned char *) stbi__sbraw(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int stbi__crc32(unsigned char *buffer, int len)
|
||||||
|
{
|
||||||
|
static unsigned int crc_table[256];
|
||||||
|
unsigned int crc = ~0u;
|
||||||
|
int i,j;
|
||||||
|
if (crc_table[1] == 0)
|
||||||
|
for(i=0; i < 256; i++)
|
||||||
|
for (crc_table[i]=i, j=0; j < 8; ++j)
|
||||||
|
crc_table[i] = (crc_table[i] >> 1) ^ (crc_table[i] & 1 ? 0xedb88320 : 0);
|
||||||
|
for (i=0; i < len; ++i)
|
||||||
|
crc = (crc >> 8) ^ crc_table[buffer[i] ^ (crc & 0xff)];
|
||||||
|
return ~crc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define stbi__wpng4(o,a,b,c,d) ((o)[0]=(unsigned char)(a),(o)[1]=(unsigned char)(b),(o)[2]=(unsigned char)(c),(o)[3]=(unsigned char)(d),(o)+=4)
|
||||||
|
#define stbi__wp32(data,v) stbi__wpng4(data, (v)>>24,(v)>>16,(v)>>8,(v));
|
||||||
|
#define stbi__wptag(data,s) stbi__wpng4(data, s[0],s[1],s[2],s[3])
|
||||||
|
|
||||||
|
static void stbi__wpcrc(unsigned char **data, int len)
|
||||||
|
{
|
||||||
|
unsigned int crc = stbi__crc32(*data - len - 4, len+4);
|
||||||
|
stbi__wp32(*data, crc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char stbi__paeth(int a, int b, int c)
|
||||||
|
{
|
||||||
|
int p = a + b - c, pa = abs(p-a), pb = abs(p-b), pc = abs(p-c);
|
||||||
|
if (pa <= pb && pa <= pc) return (unsigned char) a;
|
||||||
|
if (pb <= pc) return (unsigned char) b;
|
||||||
|
return (unsigned char) c;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char *stbi_write_png_to_mem(unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len)
|
||||||
|
{
|
||||||
|
int ctype[5] = { -1, 0, 4, 2, 6 };
|
||||||
|
unsigned char sig[8] = { 137,80,78,71,13,10,26,10 };
|
||||||
|
unsigned char *out,*o, *filt, *zlib;
|
||||||
|
signed char *line_buffer;
|
||||||
|
int i,j,k,p,zlen;
|
||||||
|
|
||||||
|
if (stride_bytes == 0)
|
||||||
|
stride_bytes = x * n;
|
||||||
|
|
||||||
|
filt = (unsigned char *) malloc((x*n+1) * y); if (!filt) return 0;
|
||||||
|
line_buffer = (signed char *) malloc(x * n); if (!line_buffer) { free(filt); return 0; }
|
||||||
|
for (j=0; j < y; ++j) {
|
||||||
|
static int mapping[] = { 0,1,2,3,4 };
|
||||||
|
static int firstmap[] = { 0,1,0,5,6 };
|
||||||
|
int *mymap = j ? mapping : firstmap;
|
||||||
|
int best = 0, bestval = 0x7fffffff;
|
||||||
|
for (p=0; p < 2; ++p) {
|
||||||
|
for (k= p?best:0; k < 5; ++k) {
|
||||||
|
int type = mymap[k],est=0;
|
||||||
|
unsigned char *z = pixels + stride_bytes*j;
|
||||||
|
for (i=0; i < n; ++i)
|
||||||
|
switch (type) {
|
||||||
|
case 0: line_buffer[i] = z[i]; break;
|
||||||
|
case 1: line_buffer[i] = z[i]; break;
|
||||||
|
case 2: line_buffer[i] = z[i] - z[i-stride_bytes]; break;
|
||||||
|
case 3: line_buffer[i] = z[i] - (z[i-stride_bytes]>>1); break;
|
||||||
|
case 4: line_buffer[i] = (signed char) (z[i] - stbi__paeth(0,z[i-stride_bytes],0)); break;
|
||||||
|
case 5: line_buffer[i] = z[i]; break;
|
||||||
|
case 6: line_buffer[i] = z[i]; break;
|
||||||
|
}
|
||||||
|
for (i=n; i < x*n; ++i) {
|
||||||
|
switch (type) {
|
||||||
|
case 0: line_buffer[i] = z[i]; break;
|
||||||
|
case 1: line_buffer[i] = z[i] - z[i-n]; break;
|
||||||
|
case 2: line_buffer[i] = z[i] - z[i-stride_bytes]; break;
|
||||||
|
case 3: line_buffer[i] = z[i] - ((z[i-n] + z[i-stride_bytes])>>1); break;
|
||||||
|
case 4: line_buffer[i] = z[i] - stbi__paeth(z[i-n], z[i-stride_bytes], z[i-stride_bytes-n]); break;
|
||||||
|
case 5: line_buffer[i] = z[i] - (z[i-n]>>1); break;
|
||||||
|
case 6: line_buffer[i] = z[i] - stbi__paeth(z[i-n], 0,0); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (p) break;
|
||||||
|
for (i=0; i < x*n; ++i)
|
||||||
|
est += abs((signed char) line_buffer[i]);
|
||||||
|
if (est < bestval) { bestval = est; best = k; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// when we get here, best contains the filter type, and line_buffer contains the data
|
||||||
|
filt[j*(x*n+1)] = (unsigned char) best;
|
||||||
|
memcpy(filt+j*(x*n+1)+1, line_buffer, x*n);
|
||||||
|
}
|
||||||
|
free(line_buffer);
|
||||||
|
zlib = stbi_zlib_compress(filt, y*( x*n+1), &zlen, 8); // increase 8 to get smaller but use more memory
|
||||||
|
free(filt);
|
||||||
|
if (!zlib) return 0;
|
||||||
|
|
||||||
|
// each tag requires 12 bytes of overhead
|
||||||
|
out = (unsigned char *) malloc(8 + 12+13 + 12+zlen + 12);
|
||||||
|
if (!out) return 0;
|
||||||
|
*out_len = 8 + 12+13 + 12+zlen + 12;
|
||||||
|
|
||||||
|
o=out;
|
||||||
|
memcpy(o,sig,8); o+= 8;
|
||||||
|
stbi__wp32(o, 13); // header length
|
||||||
|
stbi__wptag(o, "IHDR");
|
||||||
|
stbi__wp32(o, x);
|
||||||
|
stbi__wp32(o, y);
|
||||||
|
*o++ = 8;
|
||||||
|
*o++ = (unsigned char) ctype[n];
|
||||||
|
*o++ = 0;
|
||||||
|
*o++ = 0;
|
||||||
|
*o++ = 0;
|
||||||
|
stbi__wpcrc(&o,13);
|
||||||
|
|
||||||
|
stbi__wp32(o, zlen);
|
||||||
|
stbi__wptag(o, "IDAT");
|
||||||
|
memcpy(o, zlib, zlen); o += zlen; free(zlib);
|
||||||
|
stbi__wpcrc(&o, zlen);
|
||||||
|
|
||||||
|
stbi__wp32(o,0);
|
||||||
|
stbi__wptag(o, "IEND");
|
||||||
|
stbi__wpcrc(&o,0);
|
||||||
|
|
||||||
|
assert(o == out + *out_len);
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
int stbi_write_png(char const *filename, int x, int y, int comp, const void *data, int stride_bytes)
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
int len;
|
||||||
|
unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len);
|
||||||
|
if (!png) return 0;
|
||||||
|
f = fopen(filename, "wb");
|
||||||
|
if (!f) { free(png); return 0; }
|
||||||
|
fwrite(png, 1, len, f);
|
||||||
|
fclose(f);
|
||||||
|
free(png);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif // STB_IMAGE_WRITE_IMPLEMENTATION
|
||||||
|
|
||||||
|
/* Revision history
|
||||||
|
0.92 (2010-08-01)
|
||||||
|
casts to unsigned char to fix warnings
|
||||||
|
0.91 (2010-07-17)
|
||||||
|
first public release
|
||||||
|
0.90 first internal release
|
||||||
|
*/
|
54
src/stbi_image_write.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/* stbiw-0.92 - public domain - http://nothings.org/stb/stb_image_write.h
|
||||||
|
writes out PNG/BMP/TGA images to C stdio - Sean Barrett 2010
|
||||||
|
no warranty implied; use at your own risk
|
||||||
|
Before including,
|
||||||
|
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||||
|
in the file that you want to have the implementation.
|
||||||
|
ABOUT:
|
||||||
|
This header file is a library for writing images to C stdio. It could be
|
||||||
|
adapted to write to memory or a general streaming interface; let me know.
|
||||||
|
The PNG output is not optimal; it is 20-50% larger than the file
|
||||||
|
written by a decent optimizing implementation. This library is designed
|
||||||
|
for source code compactness and simplicitly, not optimal image file size
|
||||||
|
or run-time performance.
|
||||||
|
USAGE:
|
||||||
|
There are three functions, one for each image file format:
|
||||||
|
int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes);
|
||||||
|
int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data);
|
||||||
|
int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data);
|
||||||
|
Each function returns 0 on failure and non-0 on success.
|
||||||
|
The functions create an image file defined by the parameters. The image
|
||||||
|
is a rectangle of pixels stored from left-to-right, top-to-bottom.
|
||||||
|
Each pixel contains 'comp' channels of data stored interleaved with 8-bits
|
||||||
|
per channel, in the following order: 1=Y, 2=YA, 3=RGB, 4=RGBA. (Y is
|
||||||
|
monochrome color.) The rectangle is 'w' pixels wide and 'h' pixels tall.
|
||||||
|
The *data pointer points to the first byte of the top-left-most pixel.
|
||||||
|
For PNG, "stride_in_bytes" is the distance in bytes from the first byte of
|
||||||
|
a row of pixels to the first byte of the next row of pixels.
|
||||||
|
PNG creates output files with the same number of components as the input.
|
||||||
|
The BMP and TGA formats expand Y to RGB in the file format. BMP does not
|
||||||
|
output alpha.
|
||||||
|
PNG supports writing rectangles of data even when the bytes storing rows of
|
||||||
|
data are not consecutive in memory (e.g. sub-rectangles of a larger image),
|
||||||
|
by supplying the stride between the beginning of adjacent rows. The other
|
||||||
|
formats do not. (Thus you cannot write a native-format BMP through the BMP
|
||||||
|
writer, both because it is in BGR order and because it may have padding
|
||||||
|
at the end of the line.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDE_STB_IMAGE_WRITE_H
|
||||||
|
#define INCLUDE_STB_IMAGE_WRITE_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes);
|
||||||
|
extern int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data);
|
||||||
|
extern int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif//INCLUDE_STB_IMAGE_WRITE_H
|
BIN
textures/0016034_reflection-dark-grey-texture_600.jpeg
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
textures/redTex.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
textures/redTex.png
Normal file
After Width: | Height: | Size: 159 KiB |
BIN
textures/ship.png
Normal file
After Width: | Height: | Size: 371 KiB |
BIN
textures/skybox/stars.jpeg
Normal file
After Width: | Height: | Size: 871 KiB |
BIN
textures/skybox/stars2.jpg
Normal file
After Width: | Height: | Size: 214 KiB |
BIN
textures/stone.png
Normal file
After Width: | Height: | Size: 202 KiB |
BIN
textures/yellowTex.jpg
Normal file
After Width: | Height: | Size: 45 KiB |