Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package zx.opengles.meshes;
- /**
- * Created by student on 23.11.2017.
- */
- public class TexturedPyramidMesh extends BaseMesh {
- public TexturedPyramidMesh(){
- final float[] positionData = {
- // Przednia ściana
- -1.0f, -1.0f, 1.0f,
- 1.0f, -1.0f, 1.0f,
- 0.0f, 1.0f, 0.0f,
- // Prawa ściana
- 1.0f, -1.0f, 1.0f,
- 1.0f, -1.0f, -1.0f,
- 0.0f, 1.0f, 0.0f,
- // Tylna ściana
- 1.0f, -1.0f, -1.0f,
- -1.0f, -1.0f, -1.0f,
- 0.0f, 1.0f, 0.0f,
- // Lewa ściana
- -1.0f, -1.0f, -1.0f,
- -1.0f, -1.0f, 1.0f,
- 0.0f, 1.0f, 0.0f,
- // Dolna ściana
- 1.0f, -1.0f, -1.0f,
- 1.0f, -1.0f, 1.0f,
- -1.0f, -1.0f, -1.0f,
- 1.0f, -1.0f, 1.0f,
- -1.0f, -1.0f, 1.0f,
- -1.0f, -1.0f, -1.0f
- };
- // Współrzędne tekstury są takie same dla wszystkich ścian.
- final float[] texCoordData = {
- 0.0f, 0.0f,
- 1.0f, 0.0f,
- 0.5f, 1.0f,
- 0.0f, 0.0f,
- 1.0f, 0.0f,
- 0.5f, 1.0f,
- 0.0f, 0.0f,
- 1.0f, 0.0f,
- 0.5f, 1.0f,
- 0.0f, 0.0f,
- 1.0f, 0.0f,
- 0.5f, 1.0f,
- 0.0f, 0.0f,
- 1.0f, 0.0f,
- 0.5f, 1.0f,
- 0.0f, 0.0f,
- 0.0f, 1.0f,
- 1.0f, 0.0f,
- 0.0f, 1.0f,
- 1.0f, 1.0f,
- 1.0f, 0.0f
- };
- final float[] normalData = {
- // Przednia ściana
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- // Prawa ściana
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- // Tylna ściana
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- // Lewa ściana
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- // Górna ściana
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- // Dolna ściana
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f
- };
- numberOfVertices = 18;
- positionBuffer = createBuffer(positionData);
- texCoordsBuffer = createBuffer(texCoordData);
- normalBuffer = createBuffer(normalData);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement