public GroundPlane(Texture texture, int tileU, int tileV, Vector3f pointA, Vector3f pointB, Vector3f pointC, Vector3f pointD) { this.texture = texture; this.tileU = tileU; this.tileV = tileV; this.pointA = pointA; this.pointB = pointB; this.pointC = pointC; this.pointD = pointD; Vector3f vectorA = pointA.diff(pointB); Vector3f vectorB = pointA.diff(pointD); normal = vectorA.Cross(vectorB); normal.Normalize(); }
private void generateLight(Vector3f lightPos, Color4f dL) { for (int x = 0; x < width; x++) { for (int z = 0; z < depth; z++) { Vector3f L = lightPos.diff(vertrices[x + z*width].position); L.Normalize(); float ip = L * vertrices[x + z*width].position;//L.multiply(listNormals[i, j].posA); if (ip < 0) ip = 0; Color4f vc = new Color4f(0.5f, 1.0f, 1.0f, 1.0f); if (vertrices[x + z*width].color == null) vertrices[x + z*width].color = new Color4f(0.5f, 1.0f, 1.0f, 1.0f); Color4f dv = vertrices[x + z*width].color; vc.r = ip * dL.r * dv.r; vc.g = ip * dL.g * dv.g; vc.b = ip * dL.b * dv.b; vertrices[x + z*width].color = vc; } } }