int integer number ganze Zahl |
int a, b, c = 5; // Declaration a = 2; b = a + c; a++; // + 1 |
float floating point number Zahl mit Kommastellen |
float red, green, blue = 0.7; red = 0.2; green = red; |
char character Buchstaben |
char *wort = "hallo", *name = "adam"; |
enum enumeration Aufzählung |
enum position {FRONT, LEFT, BEHIND, RIGHT}; position this, nextpos = LEFT; this = BEHIND; |
SbVec3f Scene basic Vector with 3 floats |
SbVec3f axis, vec(1.0, 2.0, 3.0); axis.setValue(1.0, 0.0, 0.0); |
addChild() |
root->addChild(mytrans); root->addChild(mymaterial); root->addChild(mycube); |
insertChild() |
root->addChild(mycube); root->insertChild(mytrans, 0); |
if |
if (nextpos == LEFT) { vec.setValue(-1.2, 0, 0); ... } else if (nextpos == RIGHT) { vec.setValue( 1.2, 0, 0); ... } else { ... } |
switch ... case |
switch(nextpos) { case LEFT: vec.setValue(-1.2, 0, 0); ... break; case RIGHT: vec.setValue( 1.2, 0, 0); ... break; case FRONT: case BEHIND; break; } |
for |
for (int i = 0; i<7 ; i++) { SoCube mycube = new SoCube; ... root->addChild(mycube); } |