can render models with scale and translation and color now.
This commit is contained in:
parent
123e0aaa46
commit
1ad020dbd4
7 changed files with 1096 additions and 20 deletions
1
data/mesh/planet.scad
Normal file
1
data/mesh/planet.scad
Normal file
|
@ -0,0 +1 @@
|
|||
sphere(1, $fn=128);
|
982
data/mesh/planet_12.stl
Normal file
982
data/mesh/planet_12.stl
Normal file
|
@ -0,0 +1,982 @@
|
|||
solid OpenSCAD_Model
|
||||
facet normal 0.495572 0.132788 0.858356
|
||||
outer loop
|
||||
vertex 0.707107 0 0.707107
|
||||
vertex 0.612372 0.353553 0.707107
|
||||
vertex 0.258819 0 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.495572 0.132788 0.858356
|
||||
outer loop
|
||||
vertex 0.612372 0.353553 0.707107
|
||||
vertex 0.224144 0.12941 0.965926
|
||||
vertex 0.258819 0 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.362784 0.362784 0.858356
|
||||
outer loop
|
||||
vertex 0.612372 0.353553 0.707107
|
||||
vertex 0.353553 0.612372 0.707107
|
||||
vertex 0.224144 0.12941 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.362784 0.362784 0.858356
|
||||
outer loop
|
||||
vertex 0.353553 0.612372 0.707107
|
||||
vertex 0.12941 0.224144 0.965926
|
||||
vertex 0.224144 0.12941 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.132788 0.495572 0.858356
|
||||
outer loop
|
||||
vertex 0.353553 0.612372 0.707107
|
||||
vertex 4.32978e-17 0.707107 0.707107
|
||||
vertex 0.12941 0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.132788 0.495572 0.858356
|
||||
outer loop
|
||||
vertex 4.32978e-17 0.707107 0.707107
|
||||
vertex 1.58481e-17 0.258819 0.965926
|
||||
vertex 0.12941 0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.132788 0.495572 0.858356
|
||||
outer loop
|
||||
vertex 4.32978e-17 0.707107 0.707107
|
||||
vertex -0.353553 0.612372 0.707107
|
||||
vertex 1.58481e-17 0.258819 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.132788 0.495572 0.858356
|
||||
outer loop
|
||||
vertex -0.353553 0.612372 0.707107
|
||||
vertex -0.12941 0.224144 0.965926
|
||||
vertex 1.58481e-17 0.258819 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.362784 0.362784 0.858356
|
||||
outer loop
|
||||
vertex -0.353553 0.612372 0.707107
|
||||
vertex -0.612372 0.353553 0.707107
|
||||
vertex -0.12941 0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.362784 0.362784 0.858356
|
||||
outer loop
|
||||
vertex -0.612372 0.353553 0.707107
|
||||
vertex -0.224144 0.12941 0.965926
|
||||
vertex -0.12941 0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.495572 0.132788 0.858356
|
||||
outer loop
|
||||
vertex -0.612372 0.353553 0.707107
|
||||
vertex -0.707107 8.65956e-17 0.707107
|
||||
vertex -0.224144 0.12941 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.495572 0.132788 0.858356
|
||||
outer loop
|
||||
vertex -0.707107 8.65956e-17 0.707107
|
||||
vertex -0.258819 3.16962e-17 0.965926
|
||||
vertex -0.224144 0.12941 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.495572 -0.132788 0.858356
|
||||
outer loop
|
||||
vertex -0.707107 8.65956e-17 0.707107
|
||||
vertex -0.612372 -0.353553 0.707107
|
||||
vertex -0.258819 3.16962e-17 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.495572 -0.132788 0.858356
|
||||
outer loop
|
||||
vertex -0.612372 -0.353553 0.707107
|
||||
vertex -0.224144 -0.12941 0.965926
|
||||
vertex -0.258819 3.16962e-17 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.362784 -0.362784 0.858356
|
||||
outer loop
|
||||
vertex -0.612372 -0.353553 0.707107
|
||||
vertex -0.353553 -0.612372 0.707107
|
||||
vertex -0.224144 -0.12941 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.362784 -0.362784 0.858356
|
||||
outer loop
|
||||
vertex -0.353553 -0.612372 0.707107
|
||||
vertex -0.12941 -0.224144 0.965926
|
||||
vertex -0.224144 -0.12941 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.132788 -0.495572 0.858356
|
||||
outer loop
|
||||
vertex -0.353553 -0.612372 0.707107
|
||||
vertex -1.29893e-16 -0.707107 0.707107
|
||||
vertex -0.12941 -0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.132788 -0.495572 0.858356
|
||||
outer loop
|
||||
vertex -1.29893e-16 -0.707107 0.707107
|
||||
vertex -4.75443e-17 -0.258819 0.965926
|
||||
vertex -0.12941 -0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.132788 -0.495572 0.858356
|
||||
outer loop
|
||||
vertex -1.29893e-16 -0.707107 0.707107
|
||||
vertex 0.353553 -0.612372 0.707107
|
||||
vertex -4.75443e-17 -0.258819 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.132788 -0.495572 0.858356
|
||||
outer loop
|
||||
vertex 0.353553 -0.612372 0.707107
|
||||
vertex 0.12941 -0.224144 0.965926
|
||||
vertex -4.75443e-17 -0.258819 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.362784 -0.362784 0.858356
|
||||
outer loop
|
||||
vertex 0.353553 -0.612372 0.707107
|
||||
vertex 0.612372 -0.353553 0.707107
|
||||
vertex 0.12941 -0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.362784 -0.362784 0.858356
|
||||
outer loop
|
||||
vertex 0.612372 -0.353553 0.707107
|
||||
vertex 0.224144 -0.12941 0.965926
|
||||
vertex 0.12941 -0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.495572 -0.132788 0.858356
|
||||
outer loop
|
||||
vertex 0.612372 -0.353553 0.707107
|
||||
vertex 0.707107 0 0.707107
|
||||
vertex 0.224144 -0.12941 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.495572 -0.132788 0.858356
|
||||
outer loop
|
||||
vertex 0.707107 0 0.707107
|
||||
vertex 0.258819 0 0.965926
|
||||
vertex 0.224144 -0.12941 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.84361 0.226045 0.487058
|
||||
outer loop
|
||||
vertex 0.965926 0 0.258819
|
||||
vertex 0.836516 0.482963 0.258819
|
||||
vertex 0.707107 0 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.84361 0.226045 0.487058
|
||||
outer loop
|
||||
vertex 0.836516 0.482963 0.258819
|
||||
vertex 0.612372 0.353553 0.707107
|
||||
vertex 0.707107 0 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.617565 0.617565 0.487058
|
||||
outer loop
|
||||
vertex 0.836516 0.482963 0.258819
|
||||
vertex 0.482963 0.836516 0.258819
|
||||
vertex 0.612372 0.353553 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.617565 0.617565 0.487058
|
||||
outer loop
|
||||
vertex 0.482963 0.836516 0.258819
|
||||
vertex 0.353553 0.612372 0.707107
|
||||
vertex 0.612372 0.353553 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.226045 0.84361 0.487058
|
||||
outer loop
|
||||
vertex 0.482963 0.836516 0.258819
|
||||
vertex 5.91459e-17 0.965926 0.258819
|
||||
vertex 0.353553 0.612372 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.226045 0.84361 0.487058
|
||||
outer loop
|
||||
vertex 5.91459e-17 0.965926 0.258819
|
||||
vertex 4.32978e-17 0.707107 0.707107
|
||||
vertex 0.353553 0.612372 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.226045 0.84361 0.487058
|
||||
outer loop
|
||||
vertex 5.91459e-17 0.965926 0.258819
|
||||
vertex -0.482963 0.836516 0.258819
|
||||
vertex 4.32978e-17 0.707107 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.226045 0.84361 0.487058
|
||||
outer loop
|
||||
vertex -0.482963 0.836516 0.258819
|
||||
vertex -0.353553 0.612372 0.707107
|
||||
vertex 4.32978e-17 0.707107 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.617565 0.617565 0.487058
|
||||
outer loop
|
||||
vertex -0.482963 0.836516 0.258819
|
||||
vertex -0.836516 0.482963 0.258819
|
||||
vertex -0.353553 0.612372 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.617565 0.617565 0.487058
|
||||
outer loop
|
||||
vertex -0.836516 0.482963 0.258819
|
||||
vertex -0.612372 0.353553 0.707107
|
||||
vertex -0.353553 0.612372 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.84361 0.226045 0.487058
|
||||
outer loop
|
||||
vertex -0.836516 0.482963 0.258819
|
||||
vertex -0.965926 1.18292e-16 0.258819
|
||||
vertex -0.612372 0.353553 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.84361 0.226045 0.487058
|
||||
outer loop
|
||||
vertex -0.965926 1.18292e-16 0.258819
|
||||
vertex -0.707107 8.65956e-17 0.707107
|
||||
vertex -0.612372 0.353553 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.84361 -0.226045 0.487058
|
||||
outer loop
|
||||
vertex -0.965926 1.18292e-16 0.258819
|
||||
vertex -0.836516 -0.482963 0.258819
|
||||
vertex -0.707107 8.65956e-17 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.84361 -0.226045 0.487058
|
||||
outer loop
|
||||
vertex -0.836516 -0.482963 0.258819
|
||||
vertex -0.612372 -0.353553 0.707107
|
||||
vertex -0.707107 8.65956e-17 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.617565 -0.617565 0.487058
|
||||
outer loop
|
||||
vertex -0.836516 -0.482963 0.258819
|
||||
vertex -0.482963 -0.836516 0.258819
|
||||
vertex -0.612372 -0.353553 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.617565 -0.617565 0.487058
|
||||
outer loop
|
||||
vertex -0.482963 -0.836516 0.258819
|
||||
vertex -0.353553 -0.612372 0.707107
|
||||
vertex -0.612372 -0.353553 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.226045 -0.84361 0.487058
|
||||
outer loop
|
||||
vertex -0.482963 -0.836516 0.258819
|
||||
vertex -1.77438e-16 -0.965926 0.258819
|
||||
vertex -0.353553 -0.612372 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.226045 -0.84361 0.487058
|
||||
outer loop
|
||||
vertex -1.77438e-16 -0.965926 0.258819
|
||||
vertex -1.29893e-16 -0.707107 0.707107
|
||||
vertex -0.353553 -0.612372 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.226045 -0.84361 0.487058
|
||||
outer loop
|
||||
vertex -1.77438e-16 -0.965926 0.258819
|
||||
vertex 0.482963 -0.836516 0.258819
|
||||
vertex -1.29893e-16 -0.707107 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.226045 -0.84361 0.487058
|
||||
outer loop
|
||||
vertex 0.482963 -0.836516 0.258819
|
||||
vertex 0.353553 -0.612372 0.707107
|
||||
vertex -1.29893e-16 -0.707107 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.617565 -0.617565 0.487058
|
||||
outer loop
|
||||
vertex 0.482963 -0.836516 0.258819
|
||||
vertex 0.836516 -0.482963 0.258819
|
||||
vertex 0.353553 -0.612372 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.617565 -0.617565 0.487058
|
||||
outer loop
|
||||
vertex 0.836516 -0.482963 0.258819
|
||||
vertex 0.612372 -0.353553 0.707107
|
||||
vertex 0.353553 -0.612372 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.84361 -0.226045 0.487058
|
||||
outer loop
|
||||
vertex 0.836516 -0.482963 0.258819
|
||||
vertex 0.965926 0 0.258819
|
||||
vertex 0.612372 -0.353553 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.84361 -0.226045 0.487058
|
||||
outer loop
|
||||
vertex 0.965926 0 0.258819
|
||||
vertex 0.707107 0 0.707107
|
||||
vertex 0.612372 -0.353553 0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.965926 0.258819 -0
|
||||
outer loop
|
||||
vertex 0.965926 0 -0.258819
|
||||
vertex 0.836516 0.482963 -0.258819
|
||||
vertex 0.965926 0 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.965926 0.258819 -0
|
||||
outer loop
|
||||
vertex 0.836516 0.482963 -0.258819
|
||||
vertex 0.836516 0.482963 0.258819
|
||||
vertex 0.965926 0 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.707107 0.707107 -0
|
||||
outer loop
|
||||
vertex 0.836516 0.482963 -0.258819
|
||||
vertex 0.482963 0.836516 -0.258819
|
||||
vertex 0.836516 0.482963 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.707107 0.707107 -0
|
||||
outer loop
|
||||
vertex 0.482963 0.836516 -0.258819
|
||||
vertex 0.482963 0.836516 0.258819
|
||||
vertex 0.836516 0.482963 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.258819 0.965926 -0
|
||||
outer loop
|
||||
vertex 0.482963 0.836516 -0.258819
|
||||
vertex 5.91459e-17 0.965926 -0.258819
|
||||
vertex 0.482963 0.836516 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.258819 0.965926 -0
|
||||
outer loop
|
||||
vertex 5.91459e-17 0.965926 -0.258819
|
||||
vertex 5.91459e-17 0.965926 0.258819
|
||||
vertex 0.482963 0.836516 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.258819 0.965926 0
|
||||
outer loop
|
||||
vertex 5.91459e-17 0.965926 -0.258819
|
||||
vertex -0.482963 0.836516 -0.258819
|
||||
vertex 5.91459e-17 0.965926 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.258819 0.965926 0
|
||||
outer loop
|
||||
vertex -0.482963 0.836516 -0.258819
|
||||
vertex -0.482963 0.836516 0.258819
|
||||
vertex 5.91459e-17 0.965926 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.707107 0.707107 0
|
||||
outer loop
|
||||
vertex -0.482963 0.836516 -0.258819
|
||||
vertex -0.836516 0.482963 -0.258819
|
||||
vertex -0.482963 0.836516 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.707107 0.707107 0
|
||||
outer loop
|
||||
vertex -0.836516 0.482963 -0.258819
|
||||
vertex -0.836516 0.482963 0.258819
|
||||
vertex -0.482963 0.836516 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.965926 0.258819 0
|
||||
outer loop
|
||||
vertex -0.836516 0.482963 -0.258819
|
||||
vertex -0.965926 1.18292e-16 -0.258819
|
||||
vertex -0.836516 0.482963 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.965926 0.258819 0
|
||||
outer loop
|
||||
vertex -0.965926 1.18292e-16 -0.258819
|
||||
vertex -0.965926 1.18292e-16 0.258819
|
||||
vertex -0.836516 0.482963 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.965926 -0.258819 0
|
||||
outer loop
|
||||
vertex -0.965926 1.18292e-16 -0.258819
|
||||
vertex -0.836516 -0.482963 -0.258819
|
||||
vertex -0.965926 1.18292e-16 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.965926 -0.258819 0
|
||||
outer loop
|
||||
vertex -0.836516 -0.482963 -0.258819
|
||||
vertex -0.836516 -0.482963 0.258819
|
||||
vertex -0.965926 1.18292e-16 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.707107 -0.707107 0
|
||||
outer loop
|
||||
vertex -0.836516 -0.482963 -0.258819
|
||||
vertex -0.482963 -0.836516 -0.258819
|
||||
vertex -0.836516 -0.482963 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.707107 -0.707107 0
|
||||
outer loop
|
||||
vertex -0.482963 -0.836516 -0.258819
|
||||
vertex -0.482963 -0.836516 0.258819
|
||||
vertex -0.836516 -0.482963 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.258819 -0.965926 0
|
||||
outer loop
|
||||
vertex -0.482963 -0.836516 -0.258819
|
||||
vertex -1.77438e-16 -0.965926 -0.258819
|
||||
vertex -0.482963 -0.836516 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.258819 -0.965926 0
|
||||
outer loop
|
||||
vertex -1.77438e-16 -0.965926 -0.258819
|
||||
vertex -1.77438e-16 -0.965926 0.258819
|
||||
vertex -0.482963 -0.836516 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.258819 -0.965926 0
|
||||
outer loop
|
||||
vertex -1.77438e-16 -0.965926 -0.258819
|
||||
vertex 0.482963 -0.836516 -0.258819
|
||||
vertex -1.77438e-16 -0.965926 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.258819 -0.965926 0
|
||||
outer loop
|
||||
vertex 0.482963 -0.836516 -0.258819
|
||||
vertex 0.482963 -0.836516 0.258819
|
||||
vertex -1.77438e-16 -0.965926 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.707107 -0.707107 0
|
||||
outer loop
|
||||
vertex 0.482963 -0.836516 -0.258819
|
||||
vertex 0.836516 -0.482963 -0.258819
|
||||
vertex 0.482963 -0.836516 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.707107 -0.707107 0
|
||||
outer loop
|
||||
vertex 0.836516 -0.482963 -0.258819
|
||||
vertex 0.836516 -0.482963 0.258819
|
||||
vertex 0.482963 -0.836516 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.965926 -0.258819 0
|
||||
outer loop
|
||||
vertex 0.836516 -0.482963 -0.258819
|
||||
vertex 0.965926 0 -0.258819
|
||||
vertex 0.836516 -0.482963 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.965926 -0.258819 0
|
||||
outer loop
|
||||
vertex 0.965926 0 -0.258819
|
||||
vertex 0.965926 0 0.258819
|
||||
vertex 0.836516 -0.482963 0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.84361 0.226045 -0.487058
|
||||
outer loop
|
||||
vertex 0.707107 0 -0.707107
|
||||
vertex 0.612372 0.353553 -0.707107
|
||||
vertex 0.965926 0 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.84361 0.226045 -0.487058
|
||||
outer loop
|
||||
vertex 0.612372 0.353553 -0.707107
|
||||
vertex 0.836516 0.482963 -0.258819
|
||||
vertex 0.965926 0 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.617565 0.617565 -0.487058
|
||||
outer loop
|
||||
vertex 0.612372 0.353553 -0.707107
|
||||
vertex 0.353553 0.612372 -0.707107
|
||||
vertex 0.836516 0.482963 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.617565 0.617565 -0.487058
|
||||
outer loop
|
||||
vertex 0.353553 0.612372 -0.707107
|
||||
vertex 0.482963 0.836516 -0.258819
|
||||
vertex 0.836516 0.482963 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.226045 0.84361 -0.487058
|
||||
outer loop
|
||||
vertex 0.353553 0.612372 -0.707107
|
||||
vertex 4.32978e-17 0.707107 -0.707107
|
||||
vertex 0.482963 0.836516 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.226045 0.84361 -0.487058
|
||||
outer loop
|
||||
vertex 4.32978e-17 0.707107 -0.707107
|
||||
vertex 5.91459e-17 0.965926 -0.258819
|
||||
vertex 0.482963 0.836516 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.226045 0.84361 -0.487058
|
||||
outer loop
|
||||
vertex 4.32978e-17 0.707107 -0.707107
|
||||
vertex -0.353553 0.612372 -0.707107
|
||||
vertex 5.91459e-17 0.965926 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.226045 0.84361 -0.487058
|
||||
outer loop
|
||||
vertex -0.353553 0.612372 -0.707107
|
||||
vertex -0.482963 0.836516 -0.258819
|
||||
vertex 5.91459e-17 0.965926 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.617565 0.617565 -0.487058
|
||||
outer loop
|
||||
vertex -0.353553 0.612372 -0.707107
|
||||
vertex -0.612372 0.353553 -0.707107
|
||||
vertex -0.482963 0.836516 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.617565 0.617565 -0.487058
|
||||
outer loop
|
||||
vertex -0.612372 0.353553 -0.707107
|
||||
vertex -0.836516 0.482963 -0.258819
|
||||
vertex -0.482963 0.836516 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.84361 0.226045 -0.487058
|
||||
outer loop
|
||||
vertex -0.612372 0.353553 -0.707107
|
||||
vertex -0.707107 8.65956e-17 -0.707107
|
||||
vertex -0.836516 0.482963 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.84361 0.226045 -0.487058
|
||||
outer loop
|
||||
vertex -0.707107 8.65956e-17 -0.707107
|
||||
vertex -0.965926 1.18292e-16 -0.258819
|
||||
vertex -0.836516 0.482963 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.84361 -0.226045 -0.487058
|
||||
outer loop
|
||||
vertex -0.707107 8.65956e-17 -0.707107
|
||||
vertex -0.612372 -0.353553 -0.707107
|
||||
vertex -0.965926 1.18292e-16 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.84361 -0.226045 -0.487058
|
||||
outer loop
|
||||
vertex -0.612372 -0.353553 -0.707107
|
||||
vertex -0.836516 -0.482963 -0.258819
|
||||
vertex -0.965926 1.18292e-16 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.617565 -0.617565 -0.487058
|
||||
outer loop
|
||||
vertex -0.612372 -0.353553 -0.707107
|
||||
vertex -0.353553 -0.612372 -0.707107
|
||||
vertex -0.836516 -0.482963 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.617565 -0.617565 -0.487058
|
||||
outer loop
|
||||
vertex -0.353553 -0.612372 -0.707107
|
||||
vertex -0.482963 -0.836516 -0.258819
|
||||
vertex -0.836516 -0.482963 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.226045 -0.84361 -0.487058
|
||||
outer loop
|
||||
vertex -0.353553 -0.612372 -0.707107
|
||||
vertex -1.29893e-16 -0.707107 -0.707107
|
||||
vertex -0.482963 -0.836516 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.226045 -0.84361 -0.487058
|
||||
outer loop
|
||||
vertex -1.29893e-16 -0.707107 -0.707107
|
||||
vertex -1.77438e-16 -0.965926 -0.258819
|
||||
vertex -0.482963 -0.836516 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.226045 -0.84361 -0.487058
|
||||
outer loop
|
||||
vertex -1.29893e-16 -0.707107 -0.707107
|
||||
vertex 0.353553 -0.612372 -0.707107
|
||||
vertex -1.77438e-16 -0.965926 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.226045 -0.84361 -0.487058
|
||||
outer loop
|
||||
vertex 0.353553 -0.612372 -0.707107
|
||||
vertex 0.482963 -0.836516 -0.258819
|
||||
vertex -1.77438e-16 -0.965926 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.617565 -0.617565 -0.487058
|
||||
outer loop
|
||||
vertex 0.353553 -0.612372 -0.707107
|
||||
vertex 0.612372 -0.353553 -0.707107
|
||||
vertex 0.482963 -0.836516 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.617565 -0.617565 -0.487058
|
||||
outer loop
|
||||
vertex 0.612372 -0.353553 -0.707107
|
||||
vertex 0.836516 -0.482963 -0.258819
|
||||
vertex 0.482963 -0.836516 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.84361 -0.226045 -0.487058
|
||||
outer loop
|
||||
vertex 0.612372 -0.353553 -0.707107
|
||||
vertex 0.707107 0 -0.707107
|
||||
vertex 0.836516 -0.482963 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.84361 -0.226045 -0.487058
|
||||
outer loop
|
||||
vertex 0.707107 0 -0.707107
|
||||
vertex 0.965926 0 -0.258819
|
||||
vertex 0.836516 -0.482963 -0.258819
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.495572 0.132788 -0.858356
|
||||
outer loop
|
||||
vertex 0.258819 0 -0.965926
|
||||
vertex 0.224144 0.12941 -0.965926
|
||||
vertex 0.707107 0 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.495572 0.132788 -0.858356
|
||||
outer loop
|
||||
vertex 0.224144 0.12941 -0.965926
|
||||
vertex 0.612372 0.353553 -0.707107
|
||||
vertex 0.707107 0 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.362784 0.362784 -0.858356
|
||||
outer loop
|
||||
vertex 0.224144 0.12941 -0.965926
|
||||
vertex 0.12941 0.224144 -0.965926
|
||||
vertex 0.612372 0.353553 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.362784 0.362784 -0.858356
|
||||
outer loop
|
||||
vertex 0.12941 0.224144 -0.965926
|
||||
vertex 0.353553 0.612372 -0.707107
|
||||
vertex 0.612372 0.353553 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.132788 0.495572 -0.858356
|
||||
outer loop
|
||||
vertex 0.12941 0.224144 -0.965926
|
||||
vertex 1.58481e-17 0.258819 -0.965926
|
||||
vertex 0.353553 0.612372 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.132788 0.495572 -0.858356
|
||||
outer loop
|
||||
vertex 1.58481e-17 0.258819 -0.965926
|
||||
vertex 4.32978e-17 0.707107 -0.707107
|
||||
vertex 0.353553 0.612372 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.132788 0.495572 -0.858356
|
||||
outer loop
|
||||
vertex 1.58481e-17 0.258819 -0.965926
|
||||
vertex -0.12941 0.224144 -0.965926
|
||||
vertex 4.32978e-17 0.707107 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.132788 0.495572 -0.858356
|
||||
outer loop
|
||||
vertex -0.12941 0.224144 -0.965926
|
||||
vertex -0.353553 0.612372 -0.707107
|
||||
vertex 4.32978e-17 0.707107 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.362784 0.362784 -0.858356
|
||||
outer loop
|
||||
vertex -0.12941 0.224144 -0.965926
|
||||
vertex -0.224144 0.12941 -0.965926
|
||||
vertex -0.353553 0.612372 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.362784 0.362784 -0.858356
|
||||
outer loop
|
||||
vertex -0.224144 0.12941 -0.965926
|
||||
vertex -0.612372 0.353553 -0.707107
|
||||
vertex -0.353553 0.612372 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.495572 0.132788 -0.858356
|
||||
outer loop
|
||||
vertex -0.224144 0.12941 -0.965926
|
||||
vertex -0.258819 3.16962e-17 -0.965926
|
||||
vertex -0.612372 0.353553 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.495572 0.132788 -0.858356
|
||||
outer loop
|
||||
vertex -0.258819 3.16962e-17 -0.965926
|
||||
vertex -0.707107 8.65956e-17 -0.707107
|
||||
vertex -0.612372 0.353553 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.495572 -0.132788 -0.858356
|
||||
outer loop
|
||||
vertex -0.258819 3.16962e-17 -0.965926
|
||||
vertex -0.224144 -0.12941 -0.965926
|
||||
vertex -0.707107 8.65956e-17 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.495572 -0.132788 -0.858356
|
||||
outer loop
|
||||
vertex -0.224144 -0.12941 -0.965926
|
||||
vertex -0.612372 -0.353553 -0.707107
|
||||
vertex -0.707107 8.65956e-17 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.362784 -0.362784 -0.858356
|
||||
outer loop
|
||||
vertex -0.224144 -0.12941 -0.965926
|
||||
vertex -0.12941 -0.224144 -0.965926
|
||||
vertex -0.612372 -0.353553 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.362784 -0.362784 -0.858356
|
||||
outer loop
|
||||
vertex -0.12941 -0.224144 -0.965926
|
||||
vertex -0.353553 -0.612372 -0.707107
|
||||
vertex -0.612372 -0.353553 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.132788 -0.495572 -0.858356
|
||||
outer loop
|
||||
vertex -0.12941 -0.224144 -0.965926
|
||||
vertex -4.75443e-17 -0.258819 -0.965926
|
||||
vertex -0.353553 -0.612372 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.132788 -0.495572 -0.858356
|
||||
outer loop
|
||||
vertex -4.75443e-17 -0.258819 -0.965926
|
||||
vertex -1.29893e-16 -0.707107 -0.707107
|
||||
vertex -0.353553 -0.612372 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.132788 -0.495572 -0.858356
|
||||
outer loop
|
||||
vertex -4.75443e-17 -0.258819 -0.965926
|
||||
vertex 0.12941 -0.224144 -0.965926
|
||||
vertex -1.29893e-16 -0.707107 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.132788 -0.495572 -0.858356
|
||||
outer loop
|
||||
vertex 0.12941 -0.224144 -0.965926
|
||||
vertex 0.353553 -0.612372 -0.707107
|
||||
vertex -1.29893e-16 -0.707107 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.362784 -0.362784 -0.858356
|
||||
outer loop
|
||||
vertex 0.12941 -0.224144 -0.965926
|
||||
vertex 0.224144 -0.12941 -0.965926
|
||||
vertex 0.353553 -0.612372 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.362784 -0.362784 -0.858356
|
||||
outer loop
|
||||
vertex 0.224144 -0.12941 -0.965926
|
||||
vertex 0.612372 -0.353553 -0.707107
|
||||
vertex 0.353553 -0.612372 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.495572 -0.132788 -0.858356
|
||||
outer loop
|
||||
vertex 0.224144 -0.12941 -0.965926
|
||||
vertex 0.258819 0 -0.965926
|
||||
vertex 0.612372 -0.353553 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.495572 -0.132788 -0.858356
|
||||
outer loop
|
||||
vertex 0.258819 0 -0.965926
|
||||
vertex 0.707107 0 -0.707107
|
||||
vertex 0.612372 -0.353553 -0.707107
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 1
|
||||
outer loop
|
||||
vertex 0.224144 0.12941 0.965926
|
||||
vertex 0.224144 -0.12941 0.965926
|
||||
vertex 0.258819 0 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 1
|
||||
outer loop
|
||||
vertex 0.12941 0.224144 0.965926
|
||||
vertex 0.224144 -0.12941 0.965926
|
||||
vertex 0.224144 0.12941 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 1
|
||||
outer loop
|
||||
vertex 0.12941 0.224144 0.965926
|
||||
vertex 0.12941 -0.224144 0.965926
|
||||
vertex 0.224144 -0.12941 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 1
|
||||
outer loop
|
||||
vertex 1.58481e-17 0.258819 0.965926
|
||||
vertex 0.12941 -0.224144 0.965926
|
||||
vertex 0.12941 0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 1
|
||||
outer loop
|
||||
vertex 1.58481e-17 0.258819 0.965926
|
||||
vertex -4.75443e-17 -0.258819 0.965926
|
||||
vertex 0.12941 -0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 1
|
||||
outer loop
|
||||
vertex -0.12941 0.224144 0.965926
|
||||
vertex -4.75443e-17 -0.258819 0.965926
|
||||
vertex 1.58481e-17 0.258819 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 1
|
||||
outer loop
|
||||
vertex -0.12941 0.224144 0.965926
|
||||
vertex -0.12941 -0.224144 0.965926
|
||||
vertex -4.75443e-17 -0.258819 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 1
|
||||
outer loop
|
||||
vertex -0.224144 0.12941 0.965926
|
||||
vertex -0.12941 -0.224144 0.965926
|
||||
vertex -0.12941 0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 1
|
||||
outer loop
|
||||
vertex -0.224144 0.12941 0.965926
|
||||
vertex -0.224144 -0.12941 0.965926
|
||||
vertex -0.12941 -0.224144 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -0 1
|
||||
outer loop
|
||||
vertex -0.224144 -0.12941 0.965926
|
||||
vertex -0.224144 0.12941 0.965926
|
||||
vertex -0.258819 3.16962e-17 0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 0.224144 -0.12941 -0.965926
|
||||
vertex 0.224144 0.12941 -0.965926
|
||||
vertex 0.258819 0 -0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 0.12941 -0.224144 -0.965926
|
||||
vertex 0.224144 0.12941 -0.965926
|
||||
vertex 0.224144 -0.12941 -0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 0.12941 -0.224144 -0.965926
|
||||
vertex 0.12941 0.224144 -0.965926
|
||||
vertex 0.224144 0.12941 -0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 0.12941 -0.224144 -0.965926
|
||||
vertex 1.58481e-17 0.258819 -0.965926
|
||||
vertex 0.12941 0.224144 -0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex -4.75443e-17 -0.258819 -0.965926
|
||||
vertex 1.58481e-17 0.258819 -0.965926
|
||||
vertex 0.12941 -0.224144 -0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex -0.12941 -0.224144 -0.965926
|
||||
vertex 1.58481e-17 0.258819 -0.965926
|
||||
vertex -4.75443e-17 -0.258819 -0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex -0.12941 -0.224144 -0.965926
|
||||
vertex -0.12941 0.224144 -0.965926
|
||||
vertex 1.58481e-17 0.258819 -0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex -0.224144 -0.12941 -0.965926
|
||||
vertex -0.12941 0.224144 -0.965926
|
||||
vertex -0.12941 -0.224144 -0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex -0.224144 -0.12941 -0.965926
|
||||
vertex -0.224144 0.12941 -0.965926
|
||||
vertex -0.12941 0.224144 -0.965926
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -0 -1
|
||||
outer loop
|
||||
vertex -0.224144 0.12941 -0.965926
|
||||
vertex -0.224144 -0.12941 -0.965926
|
||||
vertex -0.258819 3.16962e-17 -0.965926
|
||||
endloop
|
||||
endfacet
|
||||
endsolid OpenSCAD_Model
|
|
@ -26,8 +26,6 @@ class GameWindow : public endofthejedi::GLWindow {
|
|||
|
||||
protected:
|
||||
void init() override {
|
||||
std::cout<<"init" << std::endl;
|
||||
|
||||
glClearColor(0.5f, 0.6f, 0.7f, 1.0f);
|
||||
resize();
|
||||
|
||||
|
|
|
@ -61,7 +61,18 @@ namespace endofthejedi {
|
|||
return (bool)result;
|
||||
}
|
||||
|
||||
void Shader::bind() { glUseProgram(m_program); }
|
||||
void Shader::bind()
|
||||
{
|
||||
if (m_program == 0) {
|
||||
std::cerr << "error: invalid to bind invalid program (0)! "
|
||||
"use unbind() if that was your purpose!" << std::endl;
|
||||
|
||||
exit(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
glUseProgram(m_program);
|
||||
}
|
||||
|
||||
void Shader::unbind() { glUseProgram(0); }
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ class PolygonModel {
|
|||
std::cerr<<"[polygonmodel] warning: try to upload model data "
|
||||
<< "to OpenGL but no data is loaded!" << std::endl;
|
||||
|
||||
exit(-1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -126,6 +127,7 @@ class PolygonModel {
|
|||
std::cout<<"[polygonmodel] warning: try to bind model vbo "
|
||||
<< "which was not uploaded to OpenGL!" << std::endl;
|
||||
|
||||
exit(-1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -152,6 +154,7 @@ class PolygonModel {
|
|||
{
|
||||
if (!m_binding_active || !m_loaded_to_opengl) {
|
||||
std::cout<<"[polygonmodel] warning: try to render model without bind()" << std::endl;
|
||||
exit(-1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,30 +2,33 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include "glm/gtc/type_ptr.hpp"
|
||||
|
||||
#include "polygon_model.hpp"
|
||||
|
||||
namespace endofthejedi {
|
||||
void RendererPolygon3d::setup()
|
||||
{
|
||||
std::cout<<"setup 3d" << std::endl;
|
||||
std::cout<<"setup polygon 3d" << std::endl;
|
||||
|
||||
m_atomicBomb = new PolygonModel("../data/mesh/small_atomic_bomb.stl");
|
||||
//m_atomicBomb = new PolygonModel("../data/mesh/quad_screen_coords.stl");
|
||||
m_atomicBomb->import();
|
||||
m_atomicBomb->uploadToOpenGl();
|
||||
//m_missileModel = new PolygonModel("../data/mesh/quad_screen_coords.stl");
|
||||
|
||||
m_models.push_back(m_atomicBomb);
|
||||
addModel("../data/mesh/small_atomic_bomb.stl", &m_missileModel);
|
||||
//addModel("../data/mesh/planet_128.stl", &m_planetModel);
|
||||
addModel("../data/mesh/planet_12.stl", &m_planetModel);
|
||||
|
||||
std::string vss =
|
||||
std::string vss_simple =
|
||||
"#version 120\n"
|
||||
"varying vec3 vertex;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = gl_Vertex;\n"
|
||||
" vertex = gl_Vertex.xyz;\n"
|
||||
" vertex = gl_Position.xyz;\n"
|
||||
"}\n"
|
||||
;
|
||||
|
||||
std::string fss =
|
||||
std::string fss_simple =
|
||||
"#version 120\n"
|
||||
"varying vec3 vertex;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
|
@ -34,19 +37,52 @@ namespace endofthejedi {
|
|||
"}\n"
|
||||
;
|
||||
|
||||
std::string vss_game_objects =
|
||||
"#version 120\n"
|
||||
"uniform vec3 position;\n"
|
||||
"uniform float scale;\n"
|
||||
"varying vec3 vertex;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec3 p = scale*gl_Vertex.xyz;\n"
|
||||
" p += position;\n"
|
||||
" gl_Position = vec4(p, gl_Vertex.w);\n"
|
||||
" vertex = p;\n"
|
||||
"}\n"
|
||||
;
|
||||
|
||||
std::string fss_game_objects =
|
||||
"#version 120\n"
|
||||
"varying vec3 vertex;\n"
|
||||
"uniform vec3 color;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
//" gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
|
||||
//" gl_FragColor = vec4(0.5+0.5*vertex.xyz, 1.0);\n"
|
||||
" gl_FragColor = vec4(color, 1.0);\n"
|
||||
"}\n"
|
||||
;
|
||||
|
||||
m_shader.init();
|
||||
m_shader.load(vss.c_str(), GL_VERTEX_SHADER);
|
||||
m_shader.load(fss.c_str(), GL_FRAGMENT_SHADER);
|
||||
|
||||
#if 0
|
||||
(void) vss_game_objects;
|
||||
(void) fss_game_objects;
|
||||
m_shader.load(vss_simple.c_str(), GL_VERTEX_SHADER);
|
||||
m_shader.load(fss_simple.c_str(), GL_FRAGMENT_SHADER);
|
||||
#else
|
||||
(void) vss_simple;
|
||||
(void) fss_simple;
|
||||
m_shader.load(vss_game_objects.c_str(), GL_VERTEX_SHADER);
|
||||
m_shader.load(fss_game_objects.c_str(), GL_FRAGMENT_SHADER);
|
||||
#endif
|
||||
}
|
||||
|
||||
void RendererPolygon3d::render(const game::State *state)
|
||||
{
|
||||
m_shader.bind();
|
||||
|
||||
(void) state;
|
||||
|
||||
m_atomicBomb->bind();
|
||||
m_atomicBomb->render();
|
||||
renderPlanets(state);
|
||||
|
||||
//glColor3f(1.0, 0.0, 0.0);
|
||||
//glBegin(GL_QUADS);
|
||||
|
@ -55,7 +91,44 @@ namespace endofthejedi {
|
|||
//glVertex2f(1.0f, 1.0f);
|
||||
//glVertex2f(-1.0f, 1.0f);
|
||||
//glEnd();
|
||||
}
|
||||
|
||||
//std::cout<<"render 3d" << std::endl;
|
||||
void RendererPolygon3d::renderPlanets(const game::State *state)
|
||||
{
|
||||
m_planetModel->bind();
|
||||
|
||||
for (const game::Planet *planet : state->planets) {
|
||||
glm::vec3 c = glm::vec3(0.7, 0.2, 0.1);
|
||||
const auto &p = planet->position;
|
||||
|
||||
glUniform3f(m_shader.location("position"), p.x, p.y, 0.0);
|
||||
glUniform3f(m_shader.location("color"), c.x, c.y, c.z);
|
||||
glUniform1f(m_shader.location("scale"), planet->radius);
|
||||
|
||||
m_planetModel->render();
|
||||
}
|
||||
}
|
||||
|
||||
void RendererPolygon3d::renderMissiles(const game::State *state)
|
||||
{
|
||||
(void) state;
|
||||
//m_missileModel->bind();
|
||||
// TODO
|
||||
//m_missileModel->render();
|
||||
}
|
||||
|
||||
void RendererPolygon3d::addModel(const std::string &filename, PolygonModel **dest)
|
||||
{
|
||||
std::cout<<"adding a model: " << filename << std::endl;
|
||||
|
||||
*dest = new PolygonModel(filename);
|
||||
if (!(*dest)->import()) {
|
||||
std::cout<<"error: failed to load needed model!!!" << std::endl << std::endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
(*dest)->uploadToOpenGl();
|
||||
|
||||
m_models.push_back(*dest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,20 @@ namespace endofthejedi {
|
|||
void setup();
|
||||
void render(const game::State *state) override;
|
||||
|
||||
private:
|
||||
void renderPlanets(const game::State *state);
|
||||
void renderMissiles(const game::State *state);
|
||||
//void renderShips(const game::State *state);
|
||||
|
||||
void addModel(const std::string &filename, PolygonModel **dest);
|
||||
|
||||
private:
|
||||
// all models are also here (for easy reloading etc.)
|
||||
std::vector<PolygonModel*> m_models;
|
||||
|
||||
// and with a specific variable name here
|
||||
PolygonModel *m_atomicBomb;
|
||||
PolygonModel *m_missileModel;
|
||||
PolygonModel *m_planetModel;
|
||||
|
||||
// for rendering everything
|
||||
Shader m_shader;
|
||||
|
|
Loading…
Reference in a new issue