Skip to content

Instantly share code, notes, and snippets.

@wowotek
Last active July 25, 2020 09:03
Show Gist options
  • Save wowotek/baa299891feb7455a08aa2293a2fdccd to your computer and use it in GitHub Desktop.
Save wowotek/baa299891feb7455a08aa2293a2fdccd to your computer and use it in GitHub Desktop.
// vector / koordinat 3 dimensi
typedef struct t_vec3d{
float x, y, z;
} Vec3D
// struct untuk transform
typedef struct t_transform_matrix {
Vec3D rotation;
Vec3D translation;
Vec3D scale;
} TransformMatrix
class Object {
Vec3D position; // Posisi
TransformMatrix transform; // Koordinat Transformasi
public:
void gambar();
void translate(){ // Translate
glPushMatrix...;
glTranslate...
glPopMatrix...;
}
void rotate(){ // Rotate
glPushMatrix...;
glRotate...
glPopMatrix...;
}
void scale(){ // Scale
glPushMatrix...;
glScale
glPopMatrix...;
}
}
class Pohon: Object {
public:
void gambar(){ // Gambar disini
// Gambar Pohon disini
}
}
class Gedung: Object {
public:
void gambar(){ // Gambar disini
// Gambar Gedung
}
}
class Rumah: Object {
public:
void gambar(){ // Gambar disini
// Gambar Rumah
}
}
class Jembatan: Object {
public:
void gambar(){ // Gambar disini
// Gambar Jembatan
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment