Last active
July 25, 2020 09:03
-
-
Save wowotek/baa299891feb7455a08aa2293a2fdccd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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