[ Video ]
[ About ]
海外ドラマを見ていたらビビっと来たので、過去に作ったやつをリメイク。カラフルになるはずが弄ってたらモノクロになってしもた…
[ Source ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#pragma once #include "ofMain.h" class ofApp : public ofBaseApp { public: void setup(); void update(); void draw(); void keyPressed(int key) {}; void keyReleased(int key) {}; void mouseMoved(int x, int y) {}; void mouseDragged(int x, int y, int button) {}; void mousePressed(int x, int y, int button) {}; void mouseReleased(int x, int y, int button) {}; void windowResized(int w, int h) {}; void dragEvent(ofDragInfo dragInfo) {}; void gotMessage(ofMessage msg) {}; // Make Member ofEasyCam cam; // Make Method void draw_shit_world(ofPoint point, int rect_len); }; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(60); ofBackground(39); ofSetWindowTitle("Insta"); ofEnableDepthTest(); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { this->cam.begin(); ofRotateX(180); int rect_len = ofGetWidth() > ofGetHeight() ? ofGetWidth() : ofGetHeight(); for (int z = 0; z < 2048; z += 64) { ofRotate(ofGetFrameNum() * 0.03); this->draw_shit_world(ofPoint(0, 0, z), rect_len); } this->cam.end(); } //-------------------------------------------------------------- void ofApp::draw_shit_world(ofPoint point, int rect_len) { ofPushMatrix(); ofTranslate(point); int radius = rect_len * 0.5; ofColor color = ofColor(239); ofSetColor(color, point.z < 1024 ? ofMap(point.z, 0, 1024, 32, 255) : 255); vector<ofPoint> vertices; vector<ofPoint> mini_vertices; for (int deg = 0; deg < 360; deg++) { int x = radius * cos(deg * DEG_TO_RAD); int y = radius * sin(deg * DEG_TO_RAD); int z = point.z; float noise_value = ofMap(ofNoise(x * 0.01, y * 0.01, z * 0.05, ofGetFrameNum() * 0.005), 0, 1, 0.5, 1); x = radius * noise_value * cos(deg * DEG_TO_RAD); y = radius * noise_value * sin(deg * DEG_TO_RAD); vertices.push_back(ofPoint(x, y)); x *= 0.95; y *= 0.95; mini_vertices.push_back(ofPoint(x, y)); } ofBeginShape(); ofVertex(-rect_len, -rect_len); ofVertex(rect_len, -rect_len); ofVertex(rect_len, rect_len); ofVertex(-rect_len, rect_len); ofNextContour(true); ofVertices(vertices); ofEndShape(true); color = ofColor(39); ofSetColor(color); ofBeginShape(); ofVertices(vertices); ofNextContour(); ofVertices(mini_vertices); ofEndShape(true); ofPopMatrix(); } //-------------------------------------------------------------- int main() { ofSetupOpenGL(720, 720, OF_WINDOW); ofRunApp(new ofApp()); } |