This commit is contained in:
Vadim Lopatin 2016-04-25 09:59:15 +03:00
parent 7a6a9b1ab6
commit b912b6ba83
3 changed files with 14 additions and 11 deletions

View File

@ -89,21 +89,23 @@ public:
3 2
*/
immutable float inv = -1.0f;
// pos, normal, color, tx
static const float[VERTEX_COMPONENTS * 4] face_vertices_north =
[
-0.5, 0.5, -0.5, 0.0, 0.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
0.5, 0.5, -0.5, 0.0, 0.0, -1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
-0.5, -0.5, -0.5, 0.0, 0.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
0.5, -0.5, -0.5, 0.0, 0.0, -1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0,
-0.5, 0.5, -0.5, 0.0, 0.0, -1.0*inv, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
0.5, 0.5, -0.5, 0.0, 0.0, -1.0*inv, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
-0.5, -0.5, -0.5, 0.0, 0.0, -1.0*inv, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
0.5, -0.5, -0.5, 0.0, 0.0, -1.0*inv, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0,
];
static const float[VERTEX_COMPONENTS * 4] face_vertices_south =
[
-0.5, -0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0,
0.5, -0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
-0.5, 0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
0.5, 0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
-0.5, -0.5, 0.5, 0.0, 0.0, 1.0*inv, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0,
0.5, -0.5, 0.5, 0.0, 0.0, 1.0*inv, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
-0.5, 0.5, 0.5, 0.0, 0.0, 1.0*inv, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
0.5, 0.5, 0.5, 0.0, 0.0, 1.0*inv, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
];
static const float[VERTEX_COMPONENTS * 4] face_vertices_west =

View File

@ -86,7 +86,7 @@ class UiWidget : VerticalLayout, CellVisitor {
dirLightNode.translateX(2);
dirLightNode.translateY(3);
dirLightNode.translateZ(0);
dirLightNode.light = Light.createPoint(vec3(2, 2, 2), 15); //Light.createDirectional(vec3(1, 0.5, 0.5));
dirLightNode.light = Light.createPoint(vec3(12, 12, 12), 25); //Light.createDirectional(vec3(1, 0.5, 0.5));
dirLightNode.light.enabled = true;
_scene.addChild(dirLightNode);
@ -134,8 +134,9 @@ class UiWidget : VerticalLayout, CellVisitor {
updateMinerMesh();
Material minerMaterial = new Material(EffectId("textured.vert", "textured.frag", null), "blocks");
minerMaterial.ambientColor = vec3(0.2,0.2,0.2);
minerMaterial.ambientColor = vec3(0.05,0.05,0.05);
minerMaterial.textureLinear = false;
minerMaterial.specular = true;
Model minerDrawable = new Model(minerMaterial, _minerMesh);
Node3d minerNode = new Node3d("miner", minerDrawable);
_scene.addChild(minerNode);

View File

@ -1240,7 +1240,7 @@ class GLObject(GLObjectTypes type, GLuint target = 0) {
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, linear ? GL_LINEAR : GL_NEAREST);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, linear ?
(!mipmap ? GL_LINEAR : GL_LINEAR_MIPMAP_LINEAR) :
(!mipmap ? GL_NEAREST : GL_LINEAR_MIPMAP_LINEAR)); //GL_NEAREST_MIPMAP_NEAREST
(!mipmap ? GL_NEAREST : GL_NEAREST_MIPMAP_NEAREST)); //GL_NEAREST_MIPMAP_NEAREST
checkError("filtering - glTexParameteri");
if(clamp) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);