diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 96374c4..0000000 --- a/.gitignore +++ /dev/null @@ -1,43 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear on external disk -.Spotlight-V100 -.Trashes - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk diff --git a/bin/Debug/kanji.exe b/bin/Debug/kanji.exe new file mode 100644 index 0000000..781da94 Binary files /dev/null and b/bin/Debug/kanji.exe differ diff --git a/kanji.cbp b/kanji.cbp new file mode 100644 index 0000000..c50d047 --- /dev/null +++ b/kanji.cbp @@ -0,0 +1,52 @@ + + + + + + diff --git a/kanji.cpp b/kanji.cpp new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/kanji.cpp @@ -0,0 +1 @@ + diff --git a/kanji.depend b/kanji.depend new file mode 100644 index 0000000..add506e --- /dev/null +++ b/kanji.depend @@ -0,0 +1,17 @@ +# depslib dependency file v1.0 +1447670124 source:d:\uni\okg\uprajneniq\kanji\main.cpp + + +1447674426 d:\programs\glfw-2.7.bin.win32\include\gl\glfw.h + + + + + +1447929786 source:d:\okg\okg\uprajneniq\kanji\main.cpp + + +1447946549 source:d:\okg\uprajneniq\kanji\main.cpp + + + diff --git a/kanji.layout b/kanji.layout new file mode 100644 index 0000000..be5066d --- /dev/null +++ b/kanji.layout @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..ee0a222 --- /dev/null +++ b/main.cpp @@ -0,0 +1,216 @@ +#include + +#include +using namespace std; + + +const float originalBrush = 0.4, + brush = originalBrush/2, + depth = 5*originalBrush; + + +void drawHorizontal(float x, float y, float z, float length) +{ + length *= brush; + //glColor3ub(0, 255, 0); //top + glBegin(GL_POLYGON); + glNormal3f(0.0, +1.0, 0.0); + glVertex3f(x-length, y+depth, z+brush); + glVertex3f(x+length, y+depth, z+brush); + glVertex3f(x+length, y+depth, z-brush); + glVertex3f(x-length, y+depth, z-brush); + glEnd(); + + //glColor3ub(0, 255, 0); //bottom + glBegin(GL_POLYGON); + glNormal3f(0.0, -1.0, 0.0); + glVertex3f(x-length, y-depth, z+brush); + glVertex3f(x+length, y-depth, z+brush); + glVertex3f(x+length, y-depth, z-brush); + glVertex3f(x-length, y-depth, z-brush); + glEnd(); + + //glColor3ub(0, 0, 255); //left + glBegin(GL_POLYGON); + glNormal3f(-1.0, 0.0, 0.0); + glVertex3f(x-length, y+depth, z+brush); + glVertex3f(x-length, y-depth, z+brush); + glVertex3f(x-length, y-depth, z-brush); + glVertex3f(x-length, y+depth, z-brush); + glEnd(); + + //glColor3ub(255, 255, 0); //right + glBegin(GL_POLYGON); + glNormal3f(+1.0, 0.0, 0.0); + glVertex3f(x+length, y+depth, z+brush); + glVertex3f(x+length, y-depth, z+brush); + glVertex3f(x+length, y-depth, z-brush); + glVertex3f(x+length, y+depth, z-brush); + glEnd(); + + //glColor3ub(255, 0, 255); //front + glBegin(GL_POLYGON); + glNormal3f(0.0, 0.0, +1.0); + glVertex3f(x-length, y+depth, z+brush); + glVertex3f(x+length, y+depth, z+brush); + glVertex3f(x+length, y-depth, z+brush); + glVertex3f(x-length, y-depth, z+brush); + glEnd(); + + //glColor3ub(0, 255, 255); //back + glBegin(GL_POLYGON); + glNormal3f(0.0, 0.0, -1.0); + glVertex3f(x-length, y+depth, z-brush); + glVertex3f(x+length, y+depth, z-brush); + glVertex3f(x+length, y-depth, z-brush); + glVertex3f(x-length, y-depth, z-brush); + glEnd(); +} + +void drawVertical(float x, float y, float z, float length) +{ + length *= brush; + + //glColor3ub(255, 0, 0); //top + glBegin(GL_POLYGON); + glNormal3f(0.0, +1.0, 0.0); + glVertex3f(x-brush, y+depth, z+length); + glVertex3f(x+brush, y+depth, z+length); + glVertex3f(x+brush, y+depth, z-length); + glVertex3f(x-brush, y+depth, z-length); + glEnd(); + + //glColor3ub(0, 255, 0); //bottom + glBegin(GL_POLYGON); + glNormal3f(0.0, -1.0, 0.0); + glVertex3f(x-brush, y-depth, z+length); + glVertex3f(x+brush, y-depth, z+length); + glVertex3f(x+brush, y-depth, z-length); + glVertex3f(x-brush, y-depth, z-length); + glEnd(); + + //glColor3ub(0, 0, 255); //left + glBegin(GL_POLYGON); + glNormal3f(-1.0, 0.0, 0.0); + glVertex3f(x-brush, y+depth, z+length); + glVertex3f(x-brush, y-depth, z+length); + glVertex3f(x-brush, y-depth, z-length); + glVertex3f(x-brush, y+depth, z-length); + glEnd(); + + //glColor3ub(255, 255, 0); //right + glBegin(GL_POLYGON); + glNormal3f(+1.0, 0.0, 0.0); + glVertex3f(x+brush, y+depth, z+length); + glVertex3f(x+brush, y-depth, z+length); + glVertex3f(x+brush, y-depth, z-length); + glVertex3f(x+brush, y+depth, z-length); + glEnd(); + + //glColor3ub(255, 0, 255); //front + glBegin(GL_POLYGON); + glNormal3f(0.0, 0.0, +1.0); + glVertex3f(x-brush, y+depth, z+length); + glVertex3f(x+brush, y+depth, z+length); + glVertex3f(x+brush, y-depth, z+length); + glVertex3f(x-brush, y-depth, z+length); + glEnd(); + + //glColor3ub(0, 255, 255); //back + glBegin(GL_POLYGON); + glNormal3f(0.0, 0.0, -1.0); + glVertex3f(x-brush, y+depth, z-length); + glVertex3f(x+brush, y+depth, z-length); + glVertex3f(x+brush, y-depth, z-length); + glVertex3f(x-brush, y-depth, z-length); + glEnd(); +} + +void drawLeftPart(float x, float y, float z) +{ + drawVertical( x - 2.3*originalBrush + brush, y, z, 7.2); + drawHorizontal(x, y, z + 3.6*originalBrush - brush, 2.6); + drawVertical( x + 2.3*originalBrush - brush, y, z+0.6*originalBrush, 6.0); + drawHorizontal(x, y, z + 1.2*originalBrush - brush, 2.6); + drawHorizontal(x, y, z - 2.4*originalBrush + brush, 2.6); +} + +void drawRightPart(float x, float y, float z) +{ + drawVertical( x - 2.85*originalBrush + brush, y, z + 0.35*originalBrush, 5.6); + drawHorizontal(x, y, z + 3.15*originalBrush - brush, 3.7); + drawVertical( x + 2.85*originalBrush - brush, y, z, 6.3); + drawHorizontal(x, y, z + 0.85*originalBrush - brush, 3.7); + drawHorizontal(x, y, z - 2.45*originalBrush + brush, 3.7); +} + +void drawBottomPart(float x, float y, float z) +{ + drawVertical( x - 4*originalBrush - brush, y, z, 2); + drawHorizontal(x, y, z + 1*originalBrush + brush, 10); + drawVertical( x + 4*originalBrush + brush, y, z, 2); + drawVertical( x - 1*originalBrush - brush, y, z, 2); + drawVertical( x + 1*originalBrush + brush, y, z, 2); + drawHorizontal(x, y, z - 1*originalBrush - brush, 13); +} + + +void init() +{ + int width, height; + + glfwInit(); + if( !glfwOpenWindow( 640, 480, 0, 0, 0, 0, 8, 0, GLFW_WINDOW ) ) return; + + glfwGetWindowSize( &width, &height ); + height = height > 0 ? height : 1; + + glViewport( 0, 0, width, height ); + glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); + + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + gluPerspective( 65.0f, (GLfloat)width/(GLfloat)height, 1.0f, 100.0f ); + + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + gluLookAt(0.0f, -10.0f, 0.0f, + 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f ); +} + +int main() +{ + bool running = 1; + + /* glfwInit(); + + if(!glfwOpenWindow(512, 512, 0, 0, 0, 0, 8, 0, GLFW_WINDOW)) + { + glfwTerminate(); + return 0; + } +*/ + init(); + glfwSetWindowTitle("Kanji"); + + glEnable( GL_DEPTH_TEST ); + glEnable( GL_LIGHTING ); + glEnable( GL_COLOR_MATERIAL ); + glEnable( GL_LIGHT0 ); + + while(running) + { + glClear(GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT); + glRotatef( 0.005, 0.4, -0.2, 0.7); + glRotatef( 0.04, 0.6, -0.2, 0.7); + + drawLeftPart(-3.4*originalBrush, 0 , 1.5*originalBrush); + drawRightPart(3.5*originalBrush,0,2.5*originalBrush); + drawBottomPart(0,0,-5*originalBrush); + glfwSwapBuffers(); + running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED); + } + glfwTerminate(); + return 0; +} diff --git a/obj/Debug/main.o b/obj/Debug/main.o new file mode 100644 index 0000000..e05abfa Binary files /dev/null and b/obj/Debug/main.o differ