(Irr3DObj)
IrrLib 1.X
(Irr3DObj) — This is a smart pointer class that is used when you want to put a 3D object to the screen.
Description
N/A (Irr3DObj)
(
)
N/A
Parameters
None
Return Values
N/A
Examples
Example #1 This is a live example showing a ball bounce between 2 squares.
#include <iostream> #include "IrrLib.h" #include <irrlicht.h> using namespace std; using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; int main(){ IrrLib Irrlicht(5, 640, 480, 16, false, true, false); Irr3DObjColor col1; Irr3DObjColor col2; int vel = 1; int nHits; //int nTimes = 0; //Color 1 col1.a = 255; col1.r = 0; col1.g = 255; col1.b = 5; //color 2 col2.a = 255; col2.r = 0; col2.g = 255; col2.b = 255; //Pos 1 Irr3DPos pos1; Irr3DPos pos2, pos3; pos3.x = -200; pos3.y = 0; pos3.z = 0; pos2.x = 200; pos2.y = 0; pos2.z = 0; pos1.x = 0; pos1.y = 0; pos1.z = 0; Irr3DObj obj1; obj1->setColor(col1); obj1->setMesh("sphere.3ds"); Irr3DObj obj2, obj3; obj3->setMesh("cube.3ds"); obj2->setMesh("cube.3ds"); obj2->setColor(col2); obj3->setColor(col2); obj1->addToScene(); obj2->addToScene(); obj3->addToScene(); Irrlicht.AddFPSCam(); obj2->Move(pos2); obj3->Move(pos3); while (Irrlicht.DeviceIsRunning()) if (Irrlicht.IsActiveWindow()) { pos1.x = pos1.x + vel; obj1->Move(pos1); nHits = CheckForCollision(obj1,obj2); if (nHits > 0) { vel = vel * -1; } nHits = CheckForCollision(obj1,obj3); if (nHits > 0) { vel = vel * -1; } Irrlicht.BeginScene(Irrlicht.Color.RED); Irrlicht.DrawAll(); Irrlicht.EndScene(); nHits = 0; } Irrlicht.EndIrrlicht(); return 0; }
You can find the meshes used in this example here.
Notes
| Function | Description | Parameters | Notes |
| Move | Moves the object around | Irr3DPos | |
| addToScene | Adds the object to the scene | None | |
| setMesh | Sets the mesh of the object | irr::core::stringc | This is a string telling IrrLib what mesh file to use |
| setColor | Sets the color of the mesh | Irr3DObjColor |
User Contributed Notes
(Irr3DObj)
(Irr3DObj)
