diff options
| author | Ray <[email protected]> | 2017-10-20 14:09:09 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2017-10-20 14:09:09 +0200 |
| commit | 7447deed40f1deabee659155a30b2d6aa454dafd (patch) | |
| tree | b63cb5b7bc1d850eff4697b2d1d04478ab800ae9 /examples/web/models/models_mesh_picking.c | |
| parent | 1ad4b20e003468434b4e72317c26d04eb8f239ee (diff) | |
| download | raylib.com-7447deed40f1deabee659155a30b2d6aa454dafd.tar.gz raylib.com-7447deed40f1deabee659155a30b2d6aa454dafd.zip | |
Updated examples for web
Diffstat (limited to 'examples/web/models/models_mesh_picking.c')
| -rw-r--r-- | examples/web/models/models_mesh_picking.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/examples/web/models/models_mesh_picking.c b/examples/web/models/models_mesh_picking.c index 332fa20..d659e2d 100644 --- a/examples/web/models/models_mesh_picking.c +++ b/examples/web/models/models_mesh_picking.c @@ -70,9 +70,9 @@ int main() camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target) camera.fovy = 45.0f; // Camera field-of-view Y - tower = LoadModel("resources/tower.obj"); // Load OBJ model - texture = LoadTexture("resources/tower.png"); // Load model texture - tower.material.texDiffuse = texture; // Set model diffuse texture + tower = LoadModel("resources/tower.obj"); // Load OBJ model + texture = LoadTexture("resources/tower.png"); // Load model texture + tower.material.maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture towerBBox = CalculateBoundingBox(tower.mesh); @@ -143,7 +143,7 @@ void UpdateDrawFrame(void) cursorColor = PURPLE; hitObjectName = "Triangle"; - bary = VectorBarycenter(nearestHit.hitPosition, ta, tb, tc); + bary = Vector3Barycenter(nearestHit.position, ta, tb, tc); hitTriangle = true; } else hitTriangle = false; @@ -190,15 +190,15 @@ void UpdateDrawFrame(void) // If we hit something, draw the cursor at the hit point if (nearestHit.hit) { - DrawCube(nearestHit.hitPosition, 0.5, 0.5, 0.5, cursorColor); - DrawCubeWires(nearestHit.hitPosition, 0.5, 0.5, 0.5, YELLOW); + DrawCube(nearestHit.position, 0.5, 0.5, 0.5, cursorColor); + DrawCubeWires(nearestHit.position, 0.5, 0.5, 0.5, YELLOW); Vector3 normalEnd; - normalEnd.x = nearestHit.hitPosition.x + nearestHit.hitNormal.x; - normalEnd.y = nearestHit.hitPosition.y + nearestHit.hitNormal.y; - normalEnd.z = nearestHit.hitPosition.z + nearestHit.hitNormal.z; + normalEnd.x = nearestHit.position.x + nearestHit.normal.x; + normalEnd.y = nearestHit.position.y + nearestHit.normal.y; + normalEnd.z = nearestHit.position.z + nearestHit.normal.z; - DrawLine3D(nearestHit.hitPosition, normalEnd, YELLOW); + DrawLine3D(nearestHit.position, normalEnd, YELLOW); } DrawRay(ray, MAROON); @@ -217,14 +217,14 @@ void UpdateDrawFrame(void) DrawText(FormatText("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK); DrawText(FormatText("Hit Pos: %3.2f %3.2f %3.2f", - nearestHit.hitPosition.x, - nearestHit.hitPosition.y, - nearestHit.hitPosition.z), 10, ypos + 15, 10, BLACK); + nearestHit.position.x, + nearestHit.position.y, + nearestHit.position.z), 10, ypos + 15, 10, BLACK); DrawText(FormatText("Hit Norm: %3.2f %3.2f %3.2f", - nearestHit.hitNormal.x, - nearestHit.hitNormal.y, - nearestHit.hitNormal.z), 10, ypos + 30, 10, BLACK); + nearestHit.normal.x, + nearestHit.normal.y, + nearestHit.normal.z), 10, ypos + 30, 10, BLACK); if (hitTriangle) DrawText(FormatText("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK); } |
