Post by Mike hartwig on Jan 2, 2010 19:28:29 GMT -5
Hello,
At first, sorry for my very bad englisch
This code is a example to create(Draw) a simple 3D grid with Irrlicht.
The 3D Grid is black - But,you can edit this easy. (As a small help) Draw the Method a red and a blue line for the axes X and Z.
Code:
#region Create3DGrid
/// <summary>
/// Method to create a 3D Grid.
/// </summary>
public void Create3DGrid()
{
int PositionAnfang1 = 0;
int PositionAnfang2 = 0;
int PositionAnfang3 = 0;
int PositionAnfang4 = 0;
for (int IntAnzahl = 1; IntAnzahl < 30; IntAnzahl++)
{
// Draw Line
VDriver.Draw3DLine(new Line3D(new Vector3D(PositionAnfang1, 0, 0), new Vector3D(PositionAnfang1, 0, 1400)), IrrlichtNETCP.Color.TransparentBlack);
VDriver.Draw3DLine(new Line3D(new Vector3D(0, 0, PositionAnfang1), new Vector3D(1400, 0, PositionAnfang1)), IrrlichtNETCP.Color.TransparentBlack);
PositionAnfang1 += 50;
// Draw Line
VDriver.Draw3DLine(new Line3D(new Vector3D(PositionAnfang2, 0, 0), new Vector3D(PositionAnfang2, 0, -1400)), IrrlichtNETCP.Color.TransparentBlack);
VDriver.Draw3DLine(new Line3D(new Vector3D(0, 0, PositionAnfang2), new Vector3D(-1400, 0, PositionAnfang2)), IrrlichtNETCP.Color.TransparentBlack);
PositionAnfang2 -= 50;
// Draw Line
VDriver.Draw3DLine(new Line3D(new Vector3D(PositionAnfang3, 0, 0), new Vector3D(PositionAnfang3, 0, -1400)), IrrlichtNETCP.Color.TransparentBlack);
VDriver.Draw3DLine(new Line3D(new Vector3D(0, 0, PositionAnfang3), new Vector3D(-1400, 0, PositionAnfang3)), IrrlichtNETCP.Color.TransparentBlack);
PositionAnfang3 += 50;
// Draw Line
VDriver.Draw3DLine(new Line3D(new Vector3D(PositionAnfang4, 0, 0), new Vector3D(PositionAnfang4, 0, 1400)), IrrlichtNETCP.Color.TransparentBlack);
VDriver.Draw3DLine(new Line3D(new Vector3D(0, 0, PositionAnfang4), new Vector3D(1400, 0, PositionAnfang4)), IrrlichtNETCP.Color.TransparentBlack);
PositionAnfang4 -= 50;
}
VDriver.Draw3DLine(new Line3D(new Vector3D(0, 0, 0), new Vector3D(0, 0, 1400)), IrrlichtNETCP.Color.Blue);
VDriver.Draw3DLine(new Line3D(new Vector3D(0, 0, 0), new Vector3D(0, 0, -1400)), IrrlichtNETCP.Color.Blue);
VDriver.Draw3DLine(new Line3D(new Vector3D(0, 0, 0), new Vector3D(1400, 0, 0)), IrrlichtNETCP.Color.TransparentRed);
VDriver.Draw3DLine(new Line3D(new Vector3D(0, 0, 0), new Vector3D(-1400, 0, 0)), IrrlichtNETCP.Color.TransparentRed);
}
#endregion Create3DGrid
then, you can draw with "SceneManager"
Code:
while (IDevice.Run())
{
VDriver.BeginScene(true, true, new IrrlichtNETCP.Color());
SManager.DrawAll();
Create3DGrid();
VDriver.EndScene();
}
original posting here:
irrlichtnetcp.sourceforge.net/phpBB2/viewtopic.php?t=1146