diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..23d0eaa --- /dev/null +++ b/.classpath @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..d44d783 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Assignment3 \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..01c6089 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..9411eec --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.project b/.project new file mode 100644 index 0000000..cd8215f --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Assignment3 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/2021.jpg b/2021.jpg new file mode 100644 index 0000000..8ef85b6 Binary files /dev/null and b/2021.jpg differ diff --git a/Assignment3.iml b/Assignment3.iml new file mode 100644 index 0000000..5beb944 --- /dev/null +++ b/Assignment3.iml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LWJGL/AppleJavaExtensions.jar b/LWJGL/AppleJavaExtensions.jar new file mode 100644 index 0000000..160d62b Binary files /dev/null and b/LWJGL/AppleJavaExtensions.jar differ diff --git a/LWJGL/asm-debug-all.jar b/LWJGL/asm-debug-all.jar new file mode 100644 index 0000000..d5aa15e Binary files /dev/null and b/LWJGL/asm-debug-all.jar differ diff --git a/LWJGL/jinput.jar b/LWJGL/jinput.jar new file mode 100644 index 0000000..7c2b6b0 Binary files /dev/null and b/LWJGL/jinput.jar differ diff --git a/LWJGL/laf-plugin-7.2.1.jar b/LWJGL/laf-plugin-7.2.1.jar new file mode 100644 index 0000000..82b0252 Binary files /dev/null and b/LWJGL/laf-plugin-7.2.1.jar differ diff --git a/LWJGL/laf-widget-7.2.1.jar b/LWJGL/laf-widget-7.2.1.jar new file mode 100644 index 0000000..0371eb1 Binary files /dev/null and b/LWJGL/laf-widget-7.2.1.jar differ diff --git a/LWJGL/log4j-api-2.0-beta9.jar b/LWJGL/log4j-api-2.0-beta9.jar new file mode 100644 index 0000000..051b6d2 Binary files /dev/null and b/LWJGL/log4j-api-2.0-beta9.jar differ diff --git a/LWJGL/lwjgl-debug.jar b/LWJGL/lwjgl-debug.jar new file mode 100644 index 0000000..feb3d22 Binary files /dev/null and b/LWJGL/lwjgl-debug.jar differ diff --git a/LWJGL/lwjgl.jar b/LWJGL/lwjgl.jar new file mode 100644 index 0000000..82294e1 Binary files /dev/null and b/LWJGL/lwjgl.jar differ diff --git a/LWJGL/lwjgl_test.jar b/LWJGL/lwjgl_test.jar new file mode 100644 index 0000000..708bf1d Binary files /dev/null and b/LWJGL/lwjgl_test.jar differ diff --git a/LWJGL/lwjgl_util.jar b/LWJGL/lwjgl_util.jar new file mode 100644 index 0000000..97911ab Binary files /dev/null and b/LWJGL/lwjgl_util.jar differ diff --git a/LWJGL/lwjgl_util_applet.jar b/LWJGL/lwjgl_util_applet.jar new file mode 100644 index 0000000..f6ba4b7 Binary files /dev/null and b/LWJGL/lwjgl_util_applet.jar differ diff --git a/LWJGL/lzma.jar b/LWJGL/lzma.jar new file mode 100644 index 0000000..d383dc0 Binary files /dev/null and b/LWJGL/lzma.jar differ diff --git a/LWJGL/slick-util.jar b/LWJGL/slick-util.jar new file mode 100644 index 0000000..10b552a Binary files /dev/null and b/LWJGL/slick-util.jar differ diff --git a/LWJGL/substance-7.2.1.jar b/LWJGL/substance-7.2.1.jar new file mode 100644 index 0000000..20428dd Binary files /dev/null and b/LWJGL/substance-7.2.1.jar differ diff --git a/LWJGL/trident-7.2.1.jar b/LWJGL/trident-7.2.1.jar new file mode 100644 index 0000000..54fb614 Binary files /dev/null and b/LWJGL/trident-7.2.1.jar differ diff --git a/bin/GraphicsObjects/Arcball.class b/bin/GraphicsObjects/Arcball.class new file mode 100644 index 0000000..1fa1fde Binary files /dev/null and b/bin/GraphicsObjects/Arcball.class differ diff --git a/bin/GraphicsObjects/Point4f.class b/bin/GraphicsObjects/Point4f.class new file mode 100644 index 0000000..607119b Binary files /dev/null and b/bin/GraphicsObjects/Point4f.class differ diff --git a/bin/GraphicsObjects/Utils.class b/bin/GraphicsObjects/Utils.class new file mode 100644 index 0000000..c4ca330 Binary files /dev/null and b/bin/GraphicsObjects/Utils.class differ diff --git a/bin/GraphicsObjects/Vector4f.class b/bin/GraphicsObjects/Vector4f.class new file mode 100644 index 0000000..f124ed7 Binary files /dev/null and b/bin/GraphicsObjects/Vector4f.class differ diff --git a/bin/GraphicsObjects/quat.class b/bin/GraphicsObjects/quat.class new file mode 100644 index 0000000..0ab9924 Binary files /dev/null and b/bin/GraphicsObjects/quat.class differ diff --git a/bin/META-INF/MANIFEST.MF b/bin/META-INF/MANIFEST.MF new file mode 100644 index 0000000..c2184f5 --- /dev/null +++ b/bin/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: MainWindow + diff --git a/bin/MainWindow.class b/bin/MainWindow.class new file mode 100644 index 0000000..19fd697 Binary files /dev/null and b/bin/MainWindow.class differ diff --git a/bin/objects3D/Cube.class b/bin/objects3D/Cube.class new file mode 100644 index 0000000..27f8711 Binary files /dev/null and b/bin/objects3D/Cube.class differ diff --git a/bin/objects3D/Cylinder.class b/bin/objects3D/Cylinder.class new file mode 100644 index 0000000..ec78548 Binary files /dev/null and b/bin/objects3D/Cylinder.class differ diff --git a/bin/objects3D/Grid.class b/bin/objects3D/Grid.class new file mode 100644 index 0000000..c2ac57a Binary files /dev/null and b/bin/objects3D/Grid.class differ diff --git a/bin/objects3D/Human.class b/bin/objects3D/Human.class new file mode 100644 index 0000000..8a04469 Binary files /dev/null and b/bin/objects3D/Human.class differ diff --git a/bin/objects3D/Sphere.class b/bin/objects3D/Sphere.class new file mode 100644 index 0000000..a430557 Binary files /dev/null and b/bin/objects3D/Sphere.class differ diff --git a/bin/objects3D/TexCube.class b/bin/objects3D/TexCube.class new file mode 100644 index 0000000..be796d9 Binary files /dev/null and b/bin/objects3D/TexCube.class differ diff --git a/bin/objects3D/TexSphere.class b/bin/objects3D/TexSphere.class new file mode 100644 index 0000000..a78e3e3 Binary files /dev/null and b/bin/objects3D/TexSphere.class differ diff --git a/classes/artifacts/Assignment3_jar/Assignment3.jar b/classes/artifacts/Assignment3_jar/Assignment3.jar new file mode 100644 index 0000000..1c4881d Binary files /dev/null and b/classes/artifacts/Assignment3_jar/Assignment3.jar differ diff --git a/classes/artifacts/Assignment3_jar/jinput-dx8.dll b/classes/artifacts/Assignment3_jar/jinput-dx8.dll new file mode 100644 index 0000000..6d27ad5 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/jinput-dx8.dll differ diff --git a/classes/artifacts/Assignment3_jar/jinput-dx8_64.dll b/classes/artifacts/Assignment3_jar/jinput-dx8_64.dll new file mode 100644 index 0000000..6730589 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/jinput-dx8_64.dll differ diff --git a/classes/artifacts/Assignment3_jar/jinput-raw.dll b/classes/artifacts/Assignment3_jar/jinput-raw.dll new file mode 100644 index 0000000..ce1d162 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/jinput-raw.dll differ diff --git a/classes/artifacts/Assignment3_jar/jinput-raw_64.dll b/classes/artifacts/Assignment3_jar/jinput-raw_64.dll new file mode 100644 index 0000000..3d2b3ad Binary files /dev/null and b/classes/artifacts/Assignment3_jar/jinput-raw_64.dll differ diff --git a/classes/artifacts/Assignment3_jar/libjinput-osx.dylib b/classes/artifacts/Assignment3_jar/libjinput-osx.dylib new file mode 100644 index 0000000..59a3eab Binary files /dev/null and b/classes/artifacts/Assignment3_jar/libjinput-osx.dylib differ diff --git a/classes/artifacts/Assignment3_jar/liblwjgl.dylib b/classes/artifacts/Assignment3_jar/liblwjgl.dylib new file mode 100644 index 0000000..a6083b9 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/liblwjgl.dylib differ diff --git a/classes/artifacts/Assignment3_jar/lwjgl.dll b/classes/artifacts/Assignment3_jar/lwjgl.dll new file mode 100644 index 0000000..e6c97d9 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/lwjgl.dll differ diff --git a/classes/artifacts/Assignment3_jar/lwjgl64.dll b/classes/artifacts/Assignment3_jar/lwjgl64.dll new file mode 100644 index 0000000..2c8b93e Binary files /dev/null and b/classes/artifacts/Assignment3_jar/lwjgl64.dll differ diff --git a/classes/artifacts/Assignment3_jar/lwjglx-debug-1.0.0.jar b/classes/artifacts/Assignment3_jar/lwjglx-debug-1.0.0.jar new file mode 100644 index 0000000..86b6082 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/lwjglx-debug-1.0.0.jar differ diff --git a/classes/artifacts/Assignment3_jar/openal.dylib b/classes/artifacts/Assignment3_jar/openal.dylib new file mode 100644 index 0000000..3c6d0f7 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/openal.dylib differ diff --git a/classes/artifacts/Assignment3_jar/res/awesomeface.png b/classes/artifacts/Assignment3_jar/res/awesomeface.png new file mode 100644 index 0000000..a092947 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/res/awesomeface.png differ diff --git a/classes/artifacts/Assignment3_jar/res/default_cobble.png b/classes/artifacts/Assignment3_jar/res/default_cobble.png new file mode 100644 index 0000000..239bdd2 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/res/default_cobble.png differ diff --git a/classes/artifacts/Assignment3_jar/res/default_dirt.png b/classes/artifacts/Assignment3_jar/res/default_dirt.png new file mode 100644 index 0000000..07a991a Binary files /dev/null and b/classes/artifacts/Assignment3_jar/res/default_dirt.png differ diff --git a/classes/artifacts/Assignment3_jar/res/default_lava.png b/classes/artifacts/Assignment3_jar/res/default_lava.png new file mode 100644 index 0000000..bbf92fd Binary files /dev/null and b/classes/artifacts/Assignment3_jar/res/default_lava.png differ diff --git a/classes/artifacts/Assignment3_jar/res/default_stone.png b/classes/artifacts/Assignment3_jar/res/default_stone.png new file mode 100644 index 0000000..1d65a8b Binary files /dev/null and b/classes/artifacts/Assignment3_jar/res/default_stone.png differ diff --git a/classes/artifacts/Assignment3_jar/res/earthspace.png b/classes/artifacts/Assignment3_jar/res/earthspace.png new file mode 100644 index 0000000..d074572 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/res/earthspace.png differ diff --git a/classes/artifacts/Assignment3_jar/res/farming_wheat_8.png b/classes/artifacts/Assignment3_jar/res/farming_wheat_8.png new file mode 100644 index 0000000..723c023 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/res/farming_wheat_8.png differ diff --git a/classes/artifacts/Assignment3_jar/res/tnt_side.png b/classes/artifacts/Assignment3_jar/res/tnt_side.png new file mode 100644 index 0000000..9ea3705 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/res/tnt_side.png differ diff --git a/classes/artifacts/Assignment3_jar/res/wool_pink.png b/classes/artifacts/Assignment3_jar/res/wool_pink.png new file mode 100644 index 0000000..fc1a0e5 Binary files /dev/null and b/classes/artifacts/Assignment3_jar/res/wool_pink.png differ diff --git a/classes/artifacts/Assignment3_jar/run.cap b/classes/artifacts/Assignment3_jar/run.cap new file mode 100644 index 0000000..bcabae9 --- /dev/null +++ b/classes/artifacts/Assignment3_jar/run.cap @@ -0,0 +1,27 @@ +{ + "rdocCaptureSettings": 1, + "settings": { + "autoStart": false, + "commandLine": "-jar Assignment3.jar", + "environment": [ + ], + "executable": "/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/bin/java", + "inject": false, + "numQueuedFrames": 0, + "options": { + "allowFullscreen": true, + "allowVSync": true, + "apiValidation": false, + "captureAllCmdLists": false, + "captureCallstacks": false, + "captureCallstacksOnlyDraws": false, + "debugOutputMute": true, + "delayForDebugger": 0, + "hookIntoChildren": false, + "refAllResources": false, + "verifyBufferAccess": false + }, + "queuedFrameCap": 0, + "workingDir": "/Users/yuyangwang/Desktop/Programs_In_BDIC/Stage 3 Semester 1/Computer Graphic/Computer_Graphic_Assignemnt_3/classes/artifacts/Assignment3_jar" + } +} diff --git a/hs_err_pid87864.log b/hs_err_pid87864.log new file mode 100644 index 0000000..2a8d231 --- /dev/null +++ b/hs_err_pid87864.log @@ -0,0 +1,612 @@ +# +# A fatal error has been detected by the Java Runtime Environment: +# +# SIGSEGV (0xb) at pc=0x00007fff202c44af, pid=87864, tid=0x0000000000000f03 +# +# JRE version: Java(TM) SE Runtime Environment (8.0_271-b09) (build 1.8.0_271-b09) +# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.271-b09 mixed mode bsd-amd64 compressed oops) +# Problematic frame: +# C [libobjc.A.dylib+0x84af] objc_release+0x1f +# +# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again +# +# If you would like to submit a bug report, please visit: +# http://bugreport.java.com/bugreport/crash.jsp +# The crash happened outside the Java Virtual Machine in native code. +# See problematic frame for where to report the bug. +# + +--------------- T H R E A D --------------- + +Current thread (0x00007f9be6809000): JavaThread "main" [_thread_in_native, id=3843, stack(0x000070000727d000,0x000070000737d000)] + +siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000020 + +Registers: +RAX=0x0000000000000000, RBX=0x0000000000000001, RCX=0x0000000000000000, RDX=0x0000000000000009 +RSP=0x000070000737c4a8, RBP=0x000070000737c4e0, RSI=0x00007f9be8440890, RDI=0x00007f9be654fba0 +R8 =0x00007f9bea92a8c8, R9 =0x0000000000000000, R10=0x00007f9be6548ae0, R11=0x00007fff22cefb3a +R12=0x00007f9be654fba0, R13=0xa3a3a3a3a3a3a3a3, R14=0x00007f9be6826078, R15=0x00007f9be6826000 +RIP=0x00007fff202c44af, EFLAGS=0x0000000000010246, ERR=0x0000000000000004 + TRAPNO=0x000000000000000e + +Top of Stack: (sp=0x000070000737c4a8) +0x000070000737c4a8: 00007fff202e220f c5b95a3319340000 +0x000070000737c4b8: 00007f9be6826000 00007f9be6728860 +0x000070000737c4c8: 000000011296a308 00007fff7bb1bfbf +0x000070000737c4d8: 00007f9be68091f8 000070000737c500 +0x000070000737c4e8: 00007fff202c4e30 c5b95a3319340051 +0x000070000737c4f8: 00007f9be6826078 000070000737c520 +0x000070000737c508: 00007fff204dea66 c5b95a3319340051 +0x000070000737c518: 00007f9be6728860 000070000737c560 +0x000070000737c528: 00007fff2126a123 00007fff873360d8 +0x000070000737c538: 0000000000000000 00007f9be84444e0 +0x000070000737c548: c5b95a3319340051 00007f9be84404b0 +0x000070000737c558: 00007f9be8428a30 000070000737c590 +0x000070000737c568: 0000000137f0ecce 000000011296a310 +0x000070000737c578: 0000000000000000 000070000737c618 +0x000070000737c588: 00007f9be6809000 000070000737c5f0 +0x000070000737c598: 000000011e8186c7 000000076b7e7910 +0x000070000737c5a8: 000000011e8183e2 000070000737c5b0 +0x000070000737c5b8: 000000011296a308 000070000737c618 +0x000070000737c5c8: 000000011296a870 0000000000000000 +0x000070000737c5d8: 000000011296a310 0000000000000000 +0x000070000737c5e8: 000070000737c610 000070000737c660 +0x000070000737c5f8: 000000011e8082bd 000000076b8d4c68 +0x000070000737c608: 000000011e811d18 000000076b8e9398 +0x000070000737c618: 000000076b7e7910 000070000737c620 +0x000070000737c628: 000000011296a20f 000070000737c690 +0x000070000737c638: 000000011296a870 0000000000000000 +0x000070000737c648: 000000011296a280 000070000737c610 +0x000070000737c658: 000070000737c680 000070000737c6e8 +0x000070000737c668: 000000011e808302 0000000000000000 +0x000070000737c678: 000000076b7e7910 000000076b8e9398 +0x000070000737c688: 000000076b7e7858 000000076b8d4cf8 +0x000070000737c698: 0000000000000001 000000076b8d4d08 + +Instructions: (pc=0x00007fff202c44af) +0x00007fff202c448f: 90 48 85 ff 74 76 89 f8 83 e0 01 48 85 c0 75 6c +0x00007fff202c449f: 48 8b 07 48 b9 f8 ff ff ff ff 7f 00 00 48 21 c1 +0x00007fff202c44af: 48 8b 51 20 f6 c2 04 74 54 a8 01 74 6f 48 b9 00 +0x00007fff202c44bf: 00 00 00 00 00 80 00 48 ba 00 00 00 00 00 00 00 + +Register to memory mapping: + +RAX=0x0000000000000000 is an unknown value +RBX=0x0000000000000001 is an unknown value +RCX=0x0000000000000000 is an unknown value +RDX=0x0000000000000009 is an unknown value +RSP=0x000070000737c4a8 is pointing into the stack for thread: 0x00007f9be6809000 +RBP=0x000070000737c4e0 is pointing into the stack for thread: 0x00007f9be6809000 +RSI=0x00007f9be8440890 is an unknown value +RDI=0x00007f9be654fba0 is an unknown value +R8 =0x00007f9bea92a8c8 is an unknown value +R9 =0x0000000000000000 is an unknown value +R10=0x00007f9be6548ae0 is an unknown value +R11=0x00007fff22cefb3a: -[NSResponder release]+0 in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit at 0x00007fff22ce4000 +R12=0x00007f9be654fba0 is an unknown value +R13=0xa3a3a3a3a3a3a3a3 is an unknown value +R14=0x00007f9be6826078 is an unknown value +R15=0x00007f9be6826000 is an unknown value + + +Stack: [0x000070000727d000,0x000070000737d000], sp=0x000070000737c4a8, free space=1021k +Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) +C [libobjc.A.dylib+0x84af] objc_release+0x1f +C [libobjc.A.dylib+0x8e30] objc_autoreleasePoolPop+0xa1 +C [CoreFoundation+0x42a66] _CFAutoreleasePoolPop+0x16 +C [Foundation+0x1f123] -[NSAutoreleasePool release]+0x83 +C [liblwjgl.dylib+0x16cce] Java_org_lwjgl_opengl_MacOSXContextImplementation_setView+0x10e +j org.lwjgl.opengl.MacOSXContextImplementation.setView(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V+0 +j org.lwjgl.opengl.MacOSXContextImplementation.makeCurrent(Lorg/lwjgl/opengl/PeerInfo;Ljava/nio/ByteBuffer;)V+7 +j org.lwjgl.opengl.ContextGL.makeCurrent()V+46 +j org.lwjgl.opengl.DrawableGL.makeCurrent()V+14 +j org.lwjgl.opengl.Display.makeCurrent()V+3 +j org.lwjgl.opengl.Display.makeCurrentAndSetSwapInterval()V+0 +j org.lwjgl.opengl.Display.create(Lorg/lwjgl/opengl/PixelFormat;Lorg/lwjgl/opengl/Drawable;Lorg/lwjgl/opengl/ContextAttribs;)V+108 +j org.lwjgl.opengl.Display.create(Lorg/lwjgl/opengl/PixelFormat;)V+12 +j org.lwjgl.opengl.Display.create()V+7 +j MainWindow.start()V+24 +j MainWindow.main([Ljava/lang/String;)V+9 +v ~StubRoutines::call_stub +V [libjvm.dylib+0x2d4795] JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0x771 +V [libjvm.dylib+0x30582b] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*)+0x279 +V [libjvm.dylib+0x308edb] jni_CallStaticVoidMethod+0x1f6 +C [java+0x316c] JavaMain+0x9dc +C [libsystem_pthread.dylib+0x68fc] _pthread_start+0xe0 +C [libsystem_pthread.dylib+0x2443] thread_start+0xf +C 0x0000000000000000 + +Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) +j org.lwjgl.opengl.MacOSXContextImplementation.setView(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V+0 +j org.lwjgl.opengl.MacOSXContextImplementation.makeCurrent(Lorg/lwjgl/opengl/PeerInfo;Ljava/nio/ByteBuffer;)V+7 +j org.lwjgl.opengl.ContextGL.makeCurrent()V+46 +j org.lwjgl.opengl.DrawableGL.makeCurrent()V+14 +j org.lwjgl.opengl.Display.makeCurrent()V+3 +j org.lwjgl.opengl.Display.makeCurrentAndSetSwapInterval()V+0 +j org.lwjgl.opengl.Display.create(Lorg/lwjgl/opengl/PixelFormat;Lorg/lwjgl/opengl/Drawable;Lorg/lwjgl/opengl/ContextAttribs;)V+108 +j org.lwjgl.opengl.Display.create(Lorg/lwjgl/opengl/PixelFormat;)V+12 +j org.lwjgl.opengl.Display.create()V+7 +j MainWindow.start()V+24 +j MainWindow.main([Ljava/lang/String;)V+9 +v ~StubRoutines::call_stub + +--------------- P R O C E S S --------------- + +Java Threads: ( => current thread ) + 0x00007f9be98d5800 JavaThread "Attach Listener" daemon [_thread_blocked, id=71695, stack(0x00007000098fb000,0x00007000099fb000)] + 0x00007f9bea8eb800 JavaThread "AWT-Shutdown" [_thread_blocked, id=34587, stack(0x00007000094e6000,0x00007000095e6000)] + 0x00007f9be8895000 JavaThread "AppKit Thread" daemon [_thread_in_native, id=259, stack(0x00007ffedf83d000,0x00007ffee003d000)] + 0x00007f9be6827000 JavaThread "Service Thread" daemon [_thread_blocked, id=39683, stack(0x00007000092e0000,0x00007000093e0000)] + 0x00007f9bea834000 JavaThread "C1 CompilerThread11" daemon [_thread_blocked, id=40195, stack(0x00007000091dd000,0x00007000092dd000)] + 0x00007f9be91c3000 JavaThread "C1 CompilerThread10" daemon [_thread_blocked, id=24067, stack(0x00007000090da000,0x00007000091da000)] + 0x00007f9be782c000 JavaThread "C1 CompilerThread9" daemon [_thread_blocked, id=23811, stack(0x0000700008fd7000,0x00007000090d7000)] + 0x00007f9be782b800 JavaThread "C1 CompilerThread8" daemon [_thread_blocked, id=23555, stack(0x0000700008ed4000,0x0000700008fd4000)] + 0x00007f9be782a800 JavaThread "C2 CompilerThread7" daemon [_thread_blocked, id=23299, stack(0x0000700008dd1000,0x0000700008ed1000)] + 0x00007f9be782a000 JavaThread "C2 CompilerThread6" daemon [_thread_blocked, id=22787, stack(0x0000700008cce000,0x0000700008dce000)] + 0x00007f9bea833000 JavaThread "C2 CompilerThread5" daemon [_thread_blocked, id=41731, stack(0x0000700008bcb000,0x0000700008ccb000)] + 0x00007f9be701d800 JavaThread "C2 CompilerThread4" daemon [_thread_blocked, id=42243, stack(0x0000700008ac8000,0x0000700008bc8000)] + 0x00007f9be7821000 JavaThread "C2 CompilerThread3" daemon [_thread_blocked, id=22531, stack(0x00007000089c5000,0x0000700008ac5000)] + 0x00007f9be6823000 JavaThread "C2 CompilerThread2" daemon [_thread_blocked, id=22275, stack(0x00007000088c2000,0x00007000089c2000)] + 0x00007f9be7820800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=22019, stack(0x00007000087bf000,0x00007000088bf000)] + 0x00007f9be915f800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=21763, stack(0x00007000086bc000,0x00007000087bc000)] + 0x00007f9be915d000 JavaThread "Monitor Ctrl-Break" daemon [_thread_in_native, id=15619, stack(0x00007000085b9000,0x00007000086b9000)] + 0x00007f9be901b800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=16131, stack(0x00007000084b6000,0x00007000085b6000)] + 0x00007f9be701b800 JavaThread "Finalizer" daemon [_thread_blocked, id=13571, stack(0x00007000082ad000,0x00007000083ad000)] + 0x00007f9be7019000 JavaThread "Reference Handler" daemon [_thread_blocked, id=18435, stack(0x00007000081aa000,0x00007000082aa000)] +=>0x00007f9be6809000 JavaThread "main" [_thread_in_native, id=3843, stack(0x000070000727d000,0x000070000737d000)] + +Other Threads: + 0x00007f9be7012800 VMThread [stack: 0x00007000080a7000,0x00007000081a7000] [id=18691] + 0x00007f9be982e000 WatcherThread [stack: 0x00007000093e3000,0x00007000094e3000] [id=39171] + +VM state:not at safepoint (normal execution) + +VM Mutex/Monitor currently owned by a thread: None + +heap address: 0x00000006c0000000, size: 4096 MB, Compressed Oops mode: Zero based, Oop shift amount: 3 +Narrow klass base: 0x0000000000000000, Narrow klass shift: 3 +Compressed class space size: 1073741824 Address: 0x00000007c0000000 + +Heap: + PSYoungGen total 76288K, used 17089K [0x000000076ab00000, 0x0000000770000000, 0x00000007c0000000) + eden space 65536K, 26% used [0x000000076ab00000,0x000000076bbb0610,0x000000076eb00000) + from space 10752K, 0% used [0x000000076f580000,0x000000076f580000,0x0000000770000000) + to space 10752K, 0% used [0x000000076eb00000,0x000000076eb00000,0x000000076f580000) + ParOldGen total 175104K, used 0K [0x00000006c0000000, 0x00000006cab00000, 0x000000076ab00000) + object space 175104K, 0% used [0x00000006c0000000,0x00000006c0000000,0x00000006cab00000) + Metaspace used 5995K, capacity 6194K, committed 6400K, reserved 1056768K + class space used 667K, capacity 729K, committed 768K, reserved 1048576K + +Card table byte_map: [0x0000000110e90000,0x0000000111691000] byte_map_base: 0x000000010d890000 + +Marking Bits: (ParMarkBitMap*) 0x000000011032a768 + Begin Bits: [0x000000012d800000, 0x0000000131800000) + End Bits: [0x0000000131800000, 0x0000000135800000) + +Polling page: 0x0000000110a53000 + +CodeCache: size=245760Kb used=3812Kb max_used=3813Kb free=241947Kb + bounds [0x000000011e800000, 0x000000011ebc0000, 0x000000012d800000] + total_blobs=732 nmethods=428 adapters=215 + compilation: enabled + +Compilation events (10 events): +Event: 1.725 Thread 0x00007f9be782b800 425 3 java.nio.Buffer::remaining (10 bytes) +Event: 1.725 Thread 0x00007f9bea834000 424 3 java.lang.Integer::valueOf (32 bytes) +Event: 1.725 Thread 0x00007f9be782b800 nmethod 425 0x000000011ebb9590 code [0x000000011ebb96e0, 0x000000011ebb9830] +Event: 1.725 Thread 0x00007f9be91c3000 426 3 java.lang.ClassLoader::loadClass (7 bytes) +Event: 1.726 Thread 0x00007f9bea834000 nmethod 424 0x000000011ebb8f10 code [0x000000011ebb90a0, 0x000000011ebb93f0] +Event: 1.726 Thread 0x00007f9be91c3000 nmethod 426 0x000000011ebb8b10 code [0x000000011ebb8c80, 0x000000011ebb8e88] +Event: 1.728 Thread 0x00007f9be782c000 427 3 sun.misc.Launcher$AppClassLoader::loadClass (85 bytes) +Event: 1.728 Thread 0x00007f9bea834000 428 s 3 sun.misc.URLClassPath::knownToNotExist (24 bytes) +Event: 1.728 Thread 0x00007f9bea834000 nmethod 428 0x000000011ebb8510 code [0x000000011ebb8680, 0x000000011ebb8a48] +Event: 1.728 Thread 0x00007f9be782c000 nmethod 427 0x000000011ebb7110 code [0x000000011ebb7340, 0x000000011ebb8068] + +GC Heap History (0 events): +No events + +Deoptimization events (0 events): +No events + +Classes redefined (0 events): +No events + +Internal exceptions (10 events): +Event: 0.031 Thread 0x00007f9be6809000 Exception (0x000000076ab07cc0) thrown at [/jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/hotspot/src/s +Event: 0.031 Thread 0x00007f9be6809000 Exception (0x000000076ab07fa8) thrown at [/jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/hotspot/src/share/vm/prims/jni. +Event: 0.136 Thread 0x00007f9be6809000 Exception (0x000000076ae44a68) thrown at [/jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/hotspot/src/share/vm/prims/jvm.cpp, line 1512] +Event: 0.136 Thread 0x00007f9be6809000 Exception (0x000000076ae44c78) thrown at [/jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/hotspot/src/share/vm/prims/jvm.cpp, line 1512] +Event: 0.136 Thread 0x00007f9be6809000 Exception (0x000000076ae48190) thrown at [/jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/hotspot/src/share/vm/prims/jvm.cpp, line 1512] +Event: 0.136 Thread 0x00007f9be6809000 Exception (0x000000076ae483a0) thrown at [/jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/hotspot/src/share/vm/prims/jvm.cpp, line 1512] +Event: 0.175 Thread 0x00007f9be6809000 Exception (0x000000076b35cef0) thrown at [/jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/hotspot/src/share/vm/prims/methodHandles.cpp, line 1169] +Event: 0.177 Thread 0x00007f9be6809000 Exception (0x000000076b36aee0) thrown at [/jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/hotspot/src/share/vm/prims/methodHandles.cpp, line 1169] +Event: 0.508 Thread 0x00007f9be6809000 Exception (0x000000076b558348) thrown at [/jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/hotspot/src/share/vm/prims/jni.cpp, line 710] +Event: 0.508 Thread 0x00007f9be6809000 Exception (0x000000076b558ed0) thrown at [/jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/hotspot/src/share/vm/prims/jni.cpp, line 710] + +Events (10 events): +Event: 1.726 loading class org/lwjgl/opengl/ContextImplementation +Event: 1.726 loading class org/lwjgl/opengl/ContextImplementation done +Event: 1.727 loading class org/lwjgl/opengl/MacOSXContextImplementation +Event: 1.727 loading class org/lwjgl/opengl/MacOSXContextImplementation done +Event: 1.727 loading class org/lwjgl/opengl/GLContext +Event: 1.727 loading class org/lwjgl/opengl/GLContext done +Event: 1.728 loading class java/lang/NumberFormatException +Event: 1.728 loading class java/lang/NumberFormatException done +Event: 1.729 loading class org/lwjgl/opengl/GLContext$CapabilitiesCacheEntry +Event: 1.729 loading class org/lwjgl/opengl/GLContext$CapabilitiesCacheEntry done + + +Dynamic libraries: +0x00007fff34f6e000 /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa +0x00007fff222b3000 /System/Library/Frameworks/Security.framework/Versions/A/Security +0x00007fff33176000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices +0x00007fff2a535000 /usr/lib/libz.1.dylib +0x00007fff2a5fd000 /usr/lib/libSystem.B.dylib +0x00007fff2049c000 /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x00007fff2124b000 /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation +0x00007fff202bc000 /usr/lib/libobjc.A.dylib +0x00007fff22ce4000 /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x00007fff25ba8000 /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData +0x00007fff23a30000 /System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation +0x00007fff2fc30000 /System/Library/PrivateFrameworks/RemoteViewServices.framework/Versions/A/RemoteViewServices +0x00007fff28a41000 /System/Library/PrivateFrameworks/XCTTargetBootstrap.framework/Versions/A/XCTTargetBootstrap +0x00007fff2b726000 /usr/lib/libspindump.dylib +0x00007fff23c7f000 /System/Library/Frameworks/UniformTypeIdentifiers.framework/Versions/A/UniformTypeIdentifiers +0x00007fff27245000 /usr/lib/libapp_launch_measurement.dylib +0x00007fff27248000 /System/Library/PrivateFrameworks/CoreAutoLayout.framework/Versions/A/CoreAutoLayout +0x00007fff283a8000 /System/Library/Frameworks/Metal.framework/Versions/A/Metal +0x00007fff2909e000 /usr/lib/liblangid.dylib +0x00007fff28a45000 /System/Library/PrivateFrameworks/CoreSVG.framework/Versions/A/CoreSVG +0x00007fff24cbf000 /System/Library/PrivateFrameworks/SkyLight.framework/Versions/A/SkyLight +0x00007fff25025000 /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics +0x00007fff30157000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate +0x00007fff2b164000 /System/Library/PrivateFrameworks/IconServices.framework/Versions/A/IconServices +0x00007fff2838c000 /System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface +0x00007fff26530000 /usr/lib/libDiagnosticMessagesClient.dylib +0x00007fff28a2d000 /System/Library/PrivateFrameworks/DFRFoundation.framework/Versions/A/DFRFoundation +0x00007fff2260b000 /usr/lib/libicucore.A.dylib +0x00007fff2cc6f000 /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox +0x00007fff2bef7000 /System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore +0x00007fff24c32000 /usr/lib/libMobileGestalt.dylib +0x00007fff28731000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x00007fff26c8a000 /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore +0x00007fff2fc68000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SpeechRecognition.framework/Versions/A/SpeechRecognition +0x00007fff26faa000 /System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI +0x00007fff21c21000 /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio +0x00007fff2661b000 /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration +0x00007fff2baf4000 /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport +0x00007fff2beee000 /System/Library/PrivateFrameworks/InternationalSupport.framework/Versions/A/InternationalSupport +0x00007fff24c31000 /usr/lib/libenergytrace.dylib +0x00007fff22bdb000 /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit +0x00007fff2ff9b000 /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices +0x00007fff271d7000 /System/Library/PrivateFrameworks/PerformanceAnalysis.framework/Versions/A/PerformanceAnalysis +0x00007fff6bb06000 /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL +0x00007fff2bf72000 /System/Library/PrivateFrameworks/UserActivity.framework/Versions/A/UserActivity +0x00007fff256af000 /System/Library/Frameworks/ColorSync.framework/Versions/A/ColorSync +0x00007fff28cac000 /System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage +0x00007fff21a3b000 /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText +0x00007fff28a6f000 /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO +0x00007fff2a603000 /System/Library/PrivateFrameworks/SoftLinking.framework/Versions/A/SoftLinking +0x00007fff27290000 /usr/lib/libxml2.2.dylib +0x00007fff20382000 /usr/lib/libc++.1.dylib +0x00007fff2a874000 /usr/lib/libcompression.dylib +0x00007fff2be20000 /System/Library/PrivateFrameworks/TextureIO.framework/Versions/A/TextureIO +0x00007fff2aea3000 /usr/lib/libate.dylib +0x00007fff2a5f7000 /usr/lib/system/libcache.dylib +0x00007fff2a5b3000 /usr/lib/system/libcommonCrypto.dylib +0x00007fff2a5dd000 /usr/lib/system/libcompiler_rt.dylib +0x00007fff2a5d2000 /usr/lib/system/libcopyfile.dylib +0x00007fff201ac000 /usr/lib/system/libcorecrypto.dylib +0x00007fff20277000 /usr/lib/system/libdispatch.dylib +0x00007fff2042a000 /usr/lib/system/libdyld.dylib +0x00007fff2a5ee000 /usr/lib/system/libkeymgr.dylib +0x00007fff2da06000 /usr/lib/system/liblaunch.dylib +0x00007fff2a591000 /usr/lib/system/libmacho.dylib +0x00007fff29d89000 /usr/lib/system/libquarantine.dylib +0x00007fff2a5eb000 /usr/lib/system/libremovefile.dylib +0x00007fff24c8f000 /usr/lib/system/libsystem_asl.dylib +0x00007fff2015c000 /usr/lib/system/libsystem_blocks.dylib +0x00007fff202f9000 /usr/lib/system/libsystem_c.dylib +0x00007fff2a5e5000 /usr/lib/system/libsystem_collections.dylib +0x00007fff2908f000 /usr/lib/system/libsystem_configuration.dylib +0x00007fff2837b000 /usr/lib/system/libsystem_containermanager.dylib +0x00007fff2a334000 /usr/lib/system/libsystem_coreservices.dylib +0x00007fff2286b000 /usr/lib/system/libsystem_darwin.dylib +0x00007fff2a5ef000 /usr/lib/system/libsystem_dnssd.dylib +0x00007fff202f6000 /usr/lib/system/libsystem_featureflags.dylib +0x00007fff20470000 /usr/lib/system/libsystem_info.dylib +0x00007fff2a548000 /usr/lib/system/libsystem_m.dylib +0x00007fff2024a000 /usr/lib/system/libsystem_malloc.dylib +0x00007fff24c22000 /usr/lib/system/libsystem_networkextension.dylib +0x00007fff22c8a000 /usr/lib/system/libsystem_notify.dylib +0x00007fff2fe9d000 /usr/lib/system/libsystem_product_info_filter.dylib +0x00007fff29093000 /usr/lib/system/libsystem_sandbox.dylib +0x00007fff2a5e8000 /usr/lib/system/libsystem_secinit.dylib +0x00007fff203ee000 /usr/lib/system/libsystem_kernel.dylib +0x00007fff20466000 /usr/lib/system/libsystem_platform.dylib +0x00007fff2041e000 /usr/lib/system/libsystem_pthread.dylib +0x00007fff2636c000 /usr/lib/system/libsystem_symptoms.dylib +0x00007fff20194000 /usr/lib/system/libsystem_trace.dylib +0x00007fff2a5bf000 /usr/lib/system/libunwind.dylib +0x00007fff2015e000 /usr/lib/system/libxpc.dylib +0x00007fff203d8000 /usr/lib/libc++abi.dylib +0x00007fff2a5ca000 /usr/lib/liboah.dylib +0x00007fff2ac88000 /usr/lib/liblzma.5.dylib +0x00007fff20f5f000 /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration +0x00007fff2a5ff000 /usr/lib/libfakelink.dylib +0x00007fff24783000 /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork +0x00007fff2a73f000 /usr/lib/libarchive.2.dylib +0x00007fff20fdd000 /usr/lib/libCRFSuite.dylib +0x00007fff29db0000 /usr/lib/libbsm.0.dylib +0x00007fff240fc000 /usr/lib/libnetwork.dylib +0x00007fff2a604000 /usr/lib/libpcap.A.dylib +0x00007fff26365000 /usr/lib/libdns_services.dylib +0x00007fff2aca1000 /usr/lib/libcoretls_cfhelpers.dylib +0x00007fff2a83e000 /usr/lib/libapple_nghttp2.dylib +0x00007fff2a597000 /usr/lib/system/libkxld.dylib +0x00007fff25fde000 /usr/lib/libsqlite3.dylib +0x00007fff2a317000 /System/Library/PrivateFrameworks/AppleFSCompression.framework/Versions/A/AppleFSCompression +0x00007fff29d98000 /usr/lib/libcoretls.dylib +0x00007fff2a86f000 /usr/lib/libpam.2.dylib +0x00007fff2ad9f000 /usr/lib/libxar.1.dylib +0x00007fff2909a000 /System/Library/PrivateFrameworks/AppleSystemInfo.framework/Versions/A/AppleSystemInfo +0x00007fff299da000 /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/Versions/A/IOMobileFramebuffer +0x00007fff2a327000 /usr/lib/libbz2.1.0.dylib +0x00007fff2a63c000 /usr/lib/libiconv.2.dylib +0x00007fff2a590000 /usr/lib/libcharset.1.dylib +0x00007fff27213000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents +0x00007fff22875000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore +0x00007fff26580000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata +0x00007fff2a339000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices +0x00007fff2a7b1000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit +0x00007fff262f0000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE +0x00007fff2093a000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices +0x00007fff2ac38000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices +0x00007fff27220000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList +0x00007fff29d8c000 /usr/lib/libCheckFix.dylib +0x00007fff24ca6000 /System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC +0x00007fff290a0000 /System/Library/PrivateFrameworks/CoreNLP.framework/Versions/A/CoreNLP +0x00007fff26533000 /System/Library/PrivateFrameworks/MetadataUtilities.framework/Versions/A/MetadataUtilities +0x00007fff21012000 /usr/lib/libmecabra.dylib +0x00007fff2a096000 /System/Library/Frameworks/MLCompute.framework/Versions/A/MLCompute +0x00007fff29dc1000 /usr/lib/libmecab.dylib +0x00007fff29e0b000 /usr/lib/libgermantok.dylib +0x00007fff2a819000 /usr/lib/libThaiTokenizer.dylib +0x00007fff2adda000 /usr/lib/libChineseTokenizer.dylib +0x00007fff2a86d000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/MetalPerformanceShaders +0x00007fff26622000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage +0x00007fff2ff75000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib +0x00007fff2ade5000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib +0x00007fff297f5000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib +0x00007fff20c45000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib +0x00007fff2a89a000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib +0x00007fff29e11000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra.dylib +0x00007fff2a856000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparseBLAS.dylib +0x00007fff2a894000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libQuadrature.dylib +0x00007fff2914c000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBNNS.dylib +0x00007fff20ef0000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparse.dylib +0x00007fff29028000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSCore.framework/Versions/A/MPSCore +0x00007fff2a286000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSImage.framework/Versions/A/MPSImage +0x00007fff29e27000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSNeuralNetwork.framework/Versions/A/MPSNeuralNetwork +0x00007fff2a1f8000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSMatrix.framework/Versions/A/MPSMatrix +0x00007fff2a046000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSRayIntersector.framework/Versions/A/MPSRayIntersector +0x00007fff2a22f000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSNDArray.framework/Versions/A/MPSNDArray +0x00007fff20b70000 /System/Library/PrivateFrameworks/MetalTools.framework/Versions/A/MetalTools +0x00007fff29098000 /System/Library/PrivateFrameworks/AggregateDictionary.framework/Versions/A/AggregateDictionary +0x00007fff26500000 /System/Library/PrivateFrameworks/CoreAnalytics.framework/Versions/A/CoreAnalytics +0x00007fff2a81b000 /System/Library/PrivateFrameworks/AppleSauce.framework/Versions/A/AppleSauce +0x00007fff2839e000 /System/Library/PrivateFrameworks/IOAccelerator.framework/Versions/A/IOAccelerator +0x00007fff6bafa000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreFSCache.dylib +0x00007fff215aa000 /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling +0x00007fff299c8000 /System/Library/PrivateFrameworks/CoreEmoji.framework/Versions/A/CoreEmoji +0x00007fff29145000 /System/Library/PrivateFrameworks/LinguisticData.framework/Versions/A/LinguisticData +0x00007fff20ea2000 /System/Library/PrivateFrameworks/Lexicon.framework/Versions/A/Lexicon +0x00007fff2a72d000 /usr/lib/libcmph.dylib +0x00007fff271f3000 /System/Library/Frameworks/OpenDirectory.framework/Versions/A/Frameworks/CFOpenDirectory.framework/Versions/A/CFOpenDirectory +0x00007fff271e3000 /System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory +0x00007fff2aca3000 /System/Library/PrivateFrameworks/APFS.framework/Versions/A/APFS +0x00007fff29cee000 /System/Library/Frameworks/SecurityFoundation.framework/Versions/A/SecurityFoundation +0x00007fff2adad000 /usr/lib/libutil.dylib +0x00007fff22ba0000 /System/Library/PrivateFrameworks/CoreServicesStore.framework/Versions/A/CoreServicesStore +0x00007fff29d84000 /System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement +0x00007fff2adb1000 /usr/lib/libxslt.1.dylib +0x00007fff29d7a000 /System/Library/PrivateFrameworks/BackgroundTaskManagement.framework/Versions/A/BackgroundTaskManagement +0x00007fff2bd6a000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libRadiance.dylib +0x00007fff2bd74000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib +0x00007fff2bcbe000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib +0x00007fff2bce5000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib +0x00007fff2bdc9000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libGIF.dylib +0x00007fff2ba10000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJP2.dylib +0x00007fff2b12c000 /usr/lib/libexpat.1.dylib +0x00007fff2b9c6000 /System/Library/PrivateFrameworks/AppleJPEG.framework/Versions/A/AppleJPEG +0x00007fff285d4000 /System/Library/PrivateFrameworks/FontServices.framework/libFontParser.dylib +0x00007fff262a7000 /System/Library/PrivateFrameworks/RunningBoardServices.framework/Versions/A/RunningBoardServices +0x00007fff2baf0000 /System/Library/PrivateFrameworks/WatchdogClient.framework/Versions/A/WatchdogClient +0x00007fff21693000 /System/Library/Frameworks/CoreDisplay.framework/Versions/A/CoreDisplay +0x00007fff284e9000 /System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia +0x00007fff27373000 /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo +0x00007fff2bb2b000 /System/Library/Frameworks/VideoToolbox.framework/Versions/A/VideoToolbox +0x00007fff26227000 /System/Library/PrivateFrameworks/BaseBoard.framework/Versions/A/BaseBoard +0x00007fff2b270000 /System/Library/PrivateFrameworks/PersistentConnection.framework/Versions/A/PersistentConnection +0x00007fff25fc8000 /System/Library/PrivateFrameworks/ProtocolBuffer.framework/Versions/A/ProtocolBuffer +0x00007fff2620f000 /System/Library/PrivateFrameworks/CommonUtilities.framework/Versions/A/CommonUtilities +0x00007fff2b989000 /System/Library/PrivateFrameworks/Bom.framework/Versions/A/Bom +0x00007fff2bd62000 /System/Library/PrivateFrameworks/GPUWrangler.framework/Versions/A/GPUWrangler +0x00007fff2bd45000 /System/Library/PrivateFrameworks/IOPresentment.framework/Versions/A/IOPresentment +0x00007fff2bd6e000 /System/Library/PrivateFrameworks/DSExternalDisplay.framework/Versions/A/DSExternalDisplay +0x00007fff2bdce000 /System/Library/PrivateFrameworks/CMCaptureCore.framework/Versions/A/CMCaptureCore +0x00007fff2b70c000 /System/Library/PrivateFrameworks/AppServerSupport.framework/Versions/A/AppServerSupport +0x00007fff2d7a9000 /System/Library/PrivateFrameworks/perfdata.framework/Versions/A/perfdata +0x00007fff29cdd000 /System/Library/PrivateFrameworks/AssertionServices.framework/Versions/A/AssertionServices +0x00007fff217ca000 /System/Library/PrivateFrameworks/AudioToolboxCore.framework/Versions/A/AudioToolboxCore +0x00007fff284cc000 /System/Library/PrivateFrameworks/caulk.framework/Versions/A/caulk +0x00007fff3cc55000 /System/Library/PrivateFrameworks/SystemPolicy.framework/Versions/A/SystemPolicy +0x00007fff2af3b000 /usr/lib/libIOReport.dylib +0x00007fff2cfe5000 /usr/lib/libSMC.dylib +0x00007fff2bc8a000 /usr/lib/libAudioToolboxUtility.dylib +0x00007fff3d5b2000 /usr/lib/libmis.dylib +0x00007fff6bb56000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib +0x00007fff6bb19000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGFXShared.dylib +0x00007fff6bd27000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib +0x00007fff6bb22000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLImage.dylib +0x00007fff6bb16000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCVMSPluginSupport.dylib +0x00007fff6bb01000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreVMClient.dylib +0x00007fff6d171000 /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL +0x00007fff2b299000 /System/Library/PrivateFrameworks/GraphVisualizer.framework/Versions/A/GraphVisualizer +0x00007fff2b2a8000 /System/Library/PrivateFrameworks/FaceCore.framework/Versions/A/FaceCore +0x00007fff2b6c4000 /System/Library/PrivateFrameworks/OTSVG.framework/Versions/A/OTSVG +0x00007fff26f68000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Resources/libFontRegistry.dylib +0x00007fff2b713000 /System/Library/PrivateFrameworks/FontServices.framework/libhvf.dylib +0x00007fff2b0d8000 /System/Library/PrivateFrameworks/AppleVA.framework/Versions/A/AppleVA +0x00007fff2ce2d000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS +0x00007fff2d140000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSyncLegacy.framework/Versions/A/ColorSyncLegacy +0x00007fff257a6000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices +0x00007fff2d125000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis +0x00007fff2bdd8000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore +0x00007fff2d148000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD +0x00007fff2ce1d000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis +0x00007fff2bd99000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATSUI.framework/Versions/A/ATSUI +0x00007fff2d0c5000 /usr/lib/libcups.2.dylib +0x00007fff2d135000 /System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth +0x00007fff2d7c4000 /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos +0x00007fff2d7d4000 /System/Library/Frameworks/GSS.framework/Versions/A/GSS +0x00007fff2ce9a000 /usr/lib/libresolv.9.dylib +0x00007fff2b729000 /System/Library/PrivateFrameworks/Heimdal.framework/Versions/A/Heimdal +0x00007fff3348b000 /System/Library/Frameworks/Kerberos.framework/Versions/A/Libraries/libHeimdalProxy.dylib +0x00007fff26374000 /System/Library/Frameworks/Network.framework/Versions/A/Network +0x00007fff2b145000 /usr/lib/libheimdal-asn1.dylib +0x00007fff2d825000 /System/Library/PrivateFrameworks/CommonAuth.framework/Versions/A/CommonAuth +0x00007fff273c1000 /System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport +0x00007fff2cda4000 /System/Library/PrivateFrameworks/AudioSession.framework/Versions/A/AudioSession +0x00007fff2ce0a000 /usr/lib/libAudioStatistics.dylib +0x00007fff2b1d1000 /System/Library/PrivateFrameworks/MediaExperience.framework/Versions/A/MediaExperience +0x00007fff2cc3d000 /System/Library/PrivateFrameworks/AudioSession.framework/libSessionUtility.dylib +0x00007fff2d7b5000 /usr/lib/libperfcheck.dylib +0x00007fff2d154000 /System/Library/PrivateFrameworks/AudioResourceArbitration.framework/Versions/A/AudioResourceArbitration +0x00007fff2b14f000 /System/Library/PrivateFrameworks/IconFoundation.framework/Versions/A/IconFoundation +0x00007fff2fc58000 /System/Library/PrivateFrameworks/SpeechRecognitionCore.framework/Versions/A/SpeechRecognitionCore +0x000000010fc01000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/server/libjvm.dylib +0x0000000110a0f000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/libverify.dylib +0x0000000110a20000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/libjava.dylib +0x0000000110a54000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/libinstrument.dylib +0x0000000110ac3000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/libzip.dylib +0x0000000114eb5000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/libnet.dylib +0x0000000114ed4000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/libawt.dylib +0x0000000114f74000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/libmlib_image.dylib +0x00007fff6eaa6000 /System/Library/Frameworks/JavaNativeFoundation.framework/Versions/A/JavaNativeFoundation +0x00007fff6eab2000 /System/Library/Frameworks/JavaRuntimeSupport.framework/Versions/A/JavaRuntimeSupport +0x00007fff3c99f000 /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon +0x00007fff31ac9000 /System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication +0x00007fff36436000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CommonPanels.framework/Versions/A/CommonPanels +0x00007fff32f20000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Help.framework/Versions/A/Help +0x00007fff3643a000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/ImageCapture.framework/Versions/A/ImageCapture +0x00007fff3640a000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/OpenScripting.framework/Versions/A/OpenScripting +0x00007fff36432000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Ink.framework/Versions/A/Ink +0x00007fff3c99b000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framework/Versions/A/Print +0x00007fff3642e000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SecurityHI.framework/Versions/A/SecurityHI +0x00007fff31a8d000 /System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols +0x0000000115033000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/libawt_lwawt.dylib +0x00000001150e2000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/libosxapp.dylib +0x00007fff3bfb6000 /System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling +0x00007fff22b61000 /System/Library/PrivateFrameworks/CoreServicesInternal.framework/Versions/A/CoreServicesInternal +0x00007fff30fdf000 /System/Library/Frameworks/FileProvider.framework/Versions/A/FileProvider +0x00007fff26192000 /System/Library/Frameworks/Accounts.framework/Versions/A/Accounts +0x00007fff3112f000 /System/Library/PrivateFrameworks/GenerationalStorage.framework/Versions/A/GenerationalStorage +0x00007fff309ff000 /System/Library/PrivateFrameworks/SymptomDiagnosticReporter.framework/Versions/A/SymptomDiagnosticReporter +0x00007fff23c92000 /System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv +0x00007fff22c96000 /usr/lib/libsandbox.1.dylib +0x00007fff273ec000 /System/Library/PrivateFrameworks/UserManagement.framework/Versions/A/UserManagement +0x00007fff29cba000 /System/Library/PrivateFrameworks/MobileKeyBag.framework/Versions/A/MobileKeyBag +0x00007fff3450e000 /System/Library/PrivateFrameworks/ChunkingLibrary.framework/Versions/A/ChunkingLibrary +0x00007fff2e1e8000 /System/Library/PrivateFrameworks/Sharing.framework/Versions/A/Sharing +0x00007fff32a8d000 /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Apple80211 +0x00007fff2a367000 /System/Library/PrivateFrameworks/AuthKit.framework/Versions/A/AuthKit +0x00007fff29ab8000 /System/Library/PrivateFrameworks/CoreUtils.framework/Versions/A/CoreUtils +0x00007fff299e5000 /System/Library/Frameworks/CoreWLAN.framework/Versions/A/CoreWLAN +0x00007fff2e334000 /System/Library/Frameworks/IOBluetooth.framework/Versions/A/IOBluetooth +0x00007fff32af1000 /System/Library/PrivateFrameworks/CoreWiFi.framework/Versions/A/CoreWiFi +0x00007fff2d8ab000 /System/Library/PrivateFrameworks/CorePhoneNumbers.framework/Versions/A/CorePhoneNumbers +0x00007fff30b06000 /System/Library/PrivateFrameworks/DiskManagement.framework/Versions/A/DiskManagement +0x00007fff30a1c000 /System/Library/PrivateFrameworks/AppleIDAuthSupport.framework/Versions/A/AppleIDAuthSupport +0x00007fff2d88b000 /System/Library/PrivateFrameworks/KeychainCircle.framework/Versions/A/KeychainCircle +0x00007fff30ad2000 /System/Library/PrivateFrameworks/MediaKit.framework/Versions/A/MediaKit +0x00007fff30a29000 /System/Library/Frameworks/DiscRecording.framework/Versions/A/DiscRecording +0x00007fff2b04c000 /usr/lib/libCoreStorage.dylib +0x00007fff32f2c000 /usr/lib/libcsfde.dylib +0x00007fff2e46f000 /System/Library/PrivateFrameworks/ProtectedCloudStorage.framework/Versions/A/ProtectedCloudStorage +0x00007fff32f24000 /System/Library/PrivateFrameworks/EFILogin.framework/Versions/A/EFILogin +0x00007fff3353e000 /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit +0x00007fff30999000 /System/Library/Frameworks/CoreBluetooth.framework/Versions/A/CoreBluetooth +0x00007fff2b044000 /usr/lib/libMatch.1.dylib +0x00007fff43826000 /System/Library/CoreServices/RawCamera.bundle/Contents/MacOS/RawCamera +0x00007fff2d836000 /System/Library/PrivateFrameworks/MobileAsset.framework/Versions/A/MobileAsset +0x00007fff33562000 /System/Library/PrivateFrameworks/StreamingZip.framework/Versions/A/StreamingZip +0x00007fff2bfd0000 /System/Library/Frameworks/MediaToolbox.framework/Versions/A/MediaToolbox +0x00007fff30fb1000 /System/Library/PrivateFrameworks/CoreAVCHD.framework/Versions/A/CoreAVCHD +0x00007fff30198000 /System/Library/Frameworks/MediaAccessibility.framework/Versions/A/MediaAccessibility +0x00007fff30fad000 /System/Library/PrivateFrameworks/Mangrove.framework/Versions/A/Mangrove +0x00007fff301a4000 /System/Library/PrivateFrameworks/AlgosScoreFramework.framework/Versions/A/AlgosScoreFramework +0x00007fff3199b000 /System/Library/PrivateFrameworks/AppleVPA.framework/Versions/A/AppleVPA +0x00007fff30bf2000 /System/Library/PrivateFrameworks/CoreAUC.framework/Versions/A/CoreAUC +0x00007fff41279000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/Libraries/libCGInterfaces.dylib +0x0000000116711000 /usr/lib/libobjc-trampolines.dylib +0x00007fff270eb000 /System/Library/PrivateFrameworks/ViewBridge.framework/Versions/A/ViewBridge +0x00007fff2b7ea000 /System/Library/PrivateFrameworks/login.framework/Versions/A/login +0x0000000137e97000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/libfontmanager.dylib +0x0000000137ef8000 /Users/yuyangwang/Desktop/Programs_In_BDIC/Stage 3 Semester 1/Computer Graphic/Assignment3/liblwjgl.dylib +0x000000011677e000 /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/libjawt.dylib +0x00007fff6bd32000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Resources/GLEngine.bundle/GLEngine +0x00007fff6bb93000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLProgrammability.dylib +0x00007fff5ef16000 /System/Library/Extensions/AppleIntelKBLGraphicsGLDriver.bundle/Contents/MacOS/AppleIntelKBLGraphicsGLDriver +0x00007fff4636c000 /System/Library/PrivateFrameworks/GPUSupport.framework/Versions/A/Libraries/libGPUSupportMercury.dylib +0x00000001380a1000 /System/Library/Extensions/AMDRadeonX4000GLDriver.bundle/Contents/MacOS/AMDRadeonX4000GLDriver +0x00007fff6e073000 /System/Library/Extensions/AMDRadeonX4000GLDriver.bundle/Contents/MacOS/ATIRadeonX4000SCLib.dylib +0x00007fff5e17e000 /System/Library/Extensions/AMDShared.bundle/Contents/PlugIns/libSC.dylib +0x00007fff6beb0000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Resources/GLRendererFloat.bundle/GLRendererFloat + +VM Arguments: +jvm_args: -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=62805:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 +java_command: MainWindow +java_class_path (initial): /Users/yuyangwang/Desktop/Programs_In_BDIC/Stage 3 Semester 1/Computer Graphic/Assignment3/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Co +Launcher Type: SUN_STANDARD + +Environment Variables: +JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home +PATH=/opt/MonkeyDev/bin:/Users/yuyangwang/opt/anaconda3/bin:/Users/yuyangwang/opt/anaconda3/condabin:/Users/yuyangwang/.autojump/bin:/Users/yuyangwang/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/Users/yuyangwang/flutter/bin +SHELL=/bin/zsh + +Signal Handlers: +SIGSEGV: [libjvm.dylib+0x5a0dcb], sa_mask[0]=11111111011111110111111111111111, sa_flags=SA_ONSTACK|SA_RESTART|SA_SIGINFO +SIGBUS: [libjvm.dylib+0x5a0dcb], sa_mask[0]=11111111011111110111111111111111, sa_flags=SA_RESTART|SA_SIGINFO +SIGFPE: [libjvm.dylib+0x491731], sa_mask[0]=11111111011111110111111111111111, sa_flags=SA_RESTART|SA_SIGINFO +SIGPIPE: [libjvm.dylib+0x491731], sa_mask[0]=11111111011111110111111111111111, sa_flags=SA_RESTART|SA_SIGINFO +SIGXFSZ: [libjvm.dylib+0x491731], sa_mask[0]=11111111011111110111111111111111, sa_flags=SA_RESTART|SA_SIGINFO +SIGILL: [libjvm.dylib+0x491731], sa_mask[0]=11111111011111110111111111111111, sa_flags=SA_RESTART|SA_SIGINFO +SIGUSR1: SIG_DFL, sa_mask[0]=00000000000000000000000000000000, sa_flags=none +SIGUSR2: [libjvm.dylib+0x49202a], sa_mask[0]=00100000000000000000000000000000, sa_flags=SA_RESTART|SA_SIGINFO +SIGHUP: [libjvm.dylib+0x490239], sa_mask[0]=11111111011111110111111111111111, sa_flags=SA_RESTART|SA_SIGINFO +SIGINT: [libjvm.dylib+0x490239], sa_mask[0]=11111111011111110111111111111111, sa_flags=SA_RESTART|SA_SIGINFO +SIGTERM: [libjvm.dylib+0x490239], sa_mask[0]=11111111011111110111111111111111, sa_flags=SA_RESTART|SA_SIGINFO +SIGQUIT: [libjvm.dylib+0x490239], sa_mask[0]=11111111011111110111111111111111, sa_flags=SA_RESTART|SA_SIGINFO + + +--------------- S Y S T E M --------------- + +OS:Bsduname:Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64 +rlimit: STACK 8192k, CORE 0k, NPROC 2784, NOFILE 10240, AS infinity +load average:3.65 2.46 2.24 + +CPU:total 16 (initial active 16) (8 cores per cpu, 2 threads per core) family 6 model 158 stepping 13, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx + +Memory: 4k page, physical 16777216k(428808k free) + +/proc/meminfo: + + +vm_info: Java HotSpot(TM) 64-Bit Server VM (25.271-b09) for bsd-amd64 JRE (1.8.0_271-b09), built on Sep 16 2020 16:54:38 by "java_re" with gcc 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5) + +time: Wed Oct 13 17:18:11 2021 +timezone: CST +elapsed time: 1.761082 seconds (0d 0h 0m 1s) + diff --git a/jinput-dx8.dll b/jinput-dx8.dll new file mode 100644 index 0000000..6d27ad5 Binary files /dev/null and b/jinput-dx8.dll differ diff --git a/jinput-dx8_64.dll b/jinput-dx8_64.dll new file mode 100644 index 0000000..6730589 Binary files /dev/null and b/jinput-dx8_64.dll differ diff --git a/jinput-raw.dll b/jinput-raw.dll new file mode 100644 index 0000000..ce1d162 Binary files /dev/null and b/jinput-raw.dll differ diff --git a/jinput-raw_64.dll b/jinput-raw_64.dll new file mode 100644 index 0000000..3d2b3ad Binary files /dev/null and b/jinput-raw_64.dll differ diff --git a/libjinput-osx.dylib b/libjinput-osx.dylib new file mode 100644 index 0000000..59a3eab Binary files /dev/null and b/libjinput-osx.dylib differ diff --git a/liblwjgl.dylib b/liblwjgl.dylib new file mode 100644 index 0000000..a6083b9 Binary files /dev/null and b/liblwjgl.dylib differ diff --git a/lwjgl.dll b/lwjgl.dll new file mode 100644 index 0000000..e6c97d9 Binary files /dev/null and b/lwjgl.dll differ diff --git a/lwjgl64.dll b/lwjgl64.dll new file mode 100644 index 0000000..2c8b93e Binary files /dev/null and b/lwjgl64.dll differ diff --git a/openal.dylib b/openal.dylib new file mode 100644 index 0000000..3c6d0f7 Binary files /dev/null and b/openal.dylib differ diff --git a/project 1 outline.pdf b/project 1 outline.pdf new file mode 100644 index 0000000..f959944 Binary files /dev/null and b/project 1 outline.pdf differ diff --git a/res/awesomeface.png b/res/awesomeface.png new file mode 100644 index 0000000..a092947 Binary files /dev/null and b/res/awesomeface.png differ diff --git a/res/default_cobble.png b/res/default_cobble.png new file mode 100644 index 0000000..239bdd2 Binary files /dev/null and b/res/default_cobble.png differ diff --git a/res/default_dirt.png b/res/default_dirt.png new file mode 100644 index 0000000..07a991a Binary files /dev/null and b/res/default_dirt.png differ diff --git a/res/default_lava.png b/res/default_lava.png new file mode 100644 index 0000000..bbf92fd Binary files /dev/null and b/res/default_lava.png differ diff --git a/res/default_stone.png b/res/default_stone.png new file mode 100644 index 0000000..1d65a8b Binary files /dev/null and b/res/default_stone.png differ diff --git a/res/earthspace.png b/res/earthspace.png new file mode 100644 index 0000000..d074572 Binary files /dev/null and b/res/earthspace.png differ diff --git a/res/farming_wheat_8.png b/res/farming_wheat_8.png new file mode 100644 index 0000000..723c023 Binary files /dev/null and b/res/farming_wheat_8.png differ diff --git a/res/tnt_side.png b/res/tnt_side.png new file mode 100644 index 0000000..9ea3705 Binary files /dev/null and b/res/tnt_side.png differ diff --git a/res/wool_pink.png b/res/wool_pink.png new file mode 100644 index 0000000..fc1a0e5 Binary files /dev/null and b/res/wool_pink.png differ diff --git a/src/GraphicsObjects/Arcball.java b/src/GraphicsObjects/Arcball.java new file mode 100644 index 0000000..0006d42 --- /dev/null +++ b/src/GraphicsObjects/Arcball.java @@ -0,0 +1,91 @@ +package GraphicsObjects; + +import java.nio.FloatBuffer; + +/* + * Created by Owen Grogan on 06/05/2010. + * Copyright 2010 School of Computer Science,UCD. All rights reserved. + * + * Update for Java by Abraham Campbell on 14/10/2015 for School of Computer Science,UCD. + */ +public class Arcball { + private quat currQuat; + private Vector4f v0; + + + public Arcball() + { + currQuat=new quat(); + v0=new Vector4f(); + } + + + /* + * Converts screen coordinates to a point on a unit sphere + * needs to be modified based on what click coordinate system is being used + */ + + public Vector4f screenToPoint(int x, int y, int windowWidth, int windowHeight) + { + float retX,retY,s; + float radius = (float) min(windowWidth,windowHeight)/2.0f; + + + + retX = (x-(windowWidth/2.0f))/radius; + retY = ((y-(windowHeight/2.0f))/radius); + + float r = (retX*retX)+(retY*retY); + float srR=(float) Math.sqrt(r); + + if(r>=1.0f){ + s=1.0f/srR; + return new Vector4f(s*retX,s*retY,0.0f,0.0f); + }else{ + return new Vector4f(retX, retY, (float)Math.sqrt(1.0f-r) ,0.0f); + } + } + + public void startBall(int x, int y, int windowWidth, int windowHeight){ + v0 = screenToPoint(x, y, windowWidth, windowHeight); + } + + /* + * Uses ken shoemakes tecnique + */ + public void updateBall(int x, int y, int windowWidth, int windowHeight){ + + Vector4f v1 = screenToPoint(x, y, windowWidth, windowHeight); + Vector4f im = v0.cross(v1); + float re = v0.dot(v1); + quat newQuat = new quat(re,im); + + currQuat = newQuat.mult(currQuat); + + v0=v1; + // System.out.println(" v1" + currQuat.getImag().x+"," +currQuat.getImag().y+"," +currQuat.getImag().z); + } + + /* + * Takes current modelview matrix as 16 item array + * and replaces the rotation part with the current rotation + */ + public void getMatrix(FloatBuffer currentMatrix){ + currQuat.toMatrix(currentMatrix); + + } + + public int min(int i,int j){ + if(i>j) + return j; + else + return i; + } + + public void reset(){ + currQuat= new quat(); + } + + + +} diff --git a/src/GraphicsObjects/Point4f.java b/src/GraphicsObjects/Point4f.java new file mode 100644 index 0000000..3202c03 --- /dev/null +++ b/src/GraphicsObjects/Point4f.java @@ -0,0 +1,142 @@ +package GraphicsObjects; + +public class Point4f { + + public float x; + public float y; + public float z; + public float a; + + + // default constructor + // setting all the variables to 0 if no value passed in + public Point4f() { + x = 0.0f; + y = 0.0f; + z = 0.0f; + a = 0.0f; + } + + //initializing constructor + //setting all the variables to the passed in value + public Point4f(float x, float y, float z, float a) { + this.x = x; + this.y = y; + this.z = z; + this.a = a; + } + + // sometimes for different algorithms we will need to address the point using positions 0 1 2 3 + //get the variable based on the positions + public float getPostion(int postion) { + switch (postion) { + case 0: + return x; + case 1: + return y; + case 2: + return z; + case 3: + return a; + default: + return Float.NaN; + } + } + + //override toString method to change the display in console. + public String toString() { + return ("(" + x + "," + y + "," + z + "," + a + ")"); + } + + //implement Point plus a Vector + // Plus a Vector on a point mathematically is move the + // point along the vector's direction and the distance moved + // is the length of the vector. + public Point4f PlusVector(Vector4f Additonal) { + + return new Point4f( + this.x + Additonal.x, + this.y + Additonal.y, + this.z + Additonal.z, + this.a + Additonal.a + ); + + } + + //implement Point minus a Vector + // Similar to the plus vector method, but this time we move the + // point to the opposite direction of the vector. + public Point4f MinusVector(Vector4f Minus) { + return new Point4f( + this.x - Minus.x, + this.y - Minus.y, + this.z - Minus.z, + this.a - Minus.a + ); + } + + + ///implement Point - Point + // A point minus a point gives the vector between this two + // points (Pointing to the point that be minused) + public Vector4f MinusPoint(Point4f Minus) { + return new Vector4f( + this.x - Minus.x, + this.y - Minus.y, + this.z - Minus.z, + this.a - Minus.a + ); + } + + + // Remember point + point is not defined so we not write a method for it. + + +} + +/*................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +....................................=?7777+..................................... +.............................,8MMMMMMMMMMMMMMMMM7............................... +...........................$MMMMMMMMMMMMMMMMMMMMMM7............................. +........................IMMMMMMMMMMMMMMMMMMMMMMMMMMMM?.......................... +......................?MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN........................ +.....................MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM$...................... +...................ZMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM..................... +..................MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM8.................... +.................NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM................... +................IMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM.................. +................MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM$................. +...............=MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMZ................ +..............:MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM................ +..............7MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM:............... +..............DMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMZ............... +..............MMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMM8............... +..............MMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMN............... +..............NMMMMMMMMMMMMMMMMMMMM MM MMMMMMMMMMMMMMMMMMMMMMMMMO............... +..............$MMMMMMMMMMMMMMMMMM MMMM MMMMMMMMMMMMMMMMMMMMMMMMMI............... +..............+MMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMM=............... +...............8MMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMM................ +................MMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMM8................ +................MMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMN,................ +................=MMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMM.................. +.................MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMZ.................. +..................MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMD................... +...................?MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM..................... +....................8MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM...................... +.....................,8MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM,....................... +........................NMMMMMMMMMMMMMMMMMMMMMMMMMMMMN?......................... +..........................NMMMMMMMMMMMMMMMMMMMMMMMMMI........................... +.............................$MMMMMMMMMMMMMMMMMMM?.............................. +.................................,I$NMMMMMN$?................................... +................................................................................ +................................................................................ +................................................................................ +.......................................................................*/ diff --git a/src/GraphicsObjects/Utils.java b/src/GraphicsObjects/Utils.java new file mode 100644 index 0000000..baa958b --- /dev/null +++ b/src/GraphicsObjects/Utils.java @@ -0,0 +1,21 @@ +package GraphicsObjects; +import java.nio.FloatBuffer; + +import org.lwjgl.BufferUtils; + +public class Utils { + + + public static FloatBuffer ConvertForGL(float[] ToConvert) + + { + FloatBuffer Any4 = BufferUtils.createFloatBuffer(4); + Any4.put(ToConvert[0]).put(ToConvert[1]).put(ToConvert[2]).put(ToConvert[3]).flip(); + return Any4; + } + + public static FloatBuffer initFloat() { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/GraphicsObjects/Vector4f.java b/src/GraphicsObjects/Vector4f.java new file mode 100644 index 0000000..45f130a --- /dev/null +++ b/src/GraphicsObjects/Vector4f.java @@ -0,0 +1,184 @@ +package GraphicsObjects; + + +public class Vector4f { + + public float x = 0; + public float y = 0; + public float z = 0; + public float a = 0; + + // If we don't pass the coordinates this will be called + public Vector4f() { + x = 0.0f; + y = 0.0f; + z = 0.0f; + a = 0.0f; + } + + //initializing constructor + public Vector4f(float x, float y, float z, float a) { + this.x = x; + this.y = y; + this.z = z; + this.a = a; + } + + //implement Vector plus a Vector + // A vector plus a vector means make the origin vector change + // its direction or magnitude or both. In the direction of + // the additional vector. + // The new vector is pointing from the start of the original + // vector and ends at the end of the Additional vector. + public Vector4f PlusVector(Vector4f Additonal) { + return new Vector4f( + this.x + Additonal.x, + this.y + Additonal.y, + this.z + Additonal.z, + this.a + Additonal.a + ); + + } + + //implement Vector minus a Vector + //This is similar to the plus vector method, the only different is + //the direction. At this time,this direction is the opposite of the + //passed in vector. + public Vector4f MinusVector(Vector4f Minus) { + return new Vector4f( + this.x - Minus.x, + this.y - Minus.y, + this.z - Minus.z, + this.a - Minus.a + ); + + } + + //implement Vector plus a Point + //This method gives us a new point that moves the original point in + //the direction of the Additional vector. And the magnitude is the + //length of the additional vector. + public Point4f PlusPoint(Point4f Additonal) { + return new Point4f( + this.x + Additonal.x, + this.y + Additonal.y, + this.z + Additonal.z, + this.a + Additonal.a + ); + } + //Do not implement Vector minus a Point as it is undefined + + //Implement a Vector * Scalar + // This method only change the magnitude of the vector, scale it by a + // Scalar. It is actually multiply the magnitude by n . + public Vector4f byScalar(float scale) { + return new Vector4f( + this.x * scale, + this.y * scale, + this.z * scale, + this.a * scale + ); + } + + //implement returning the negative of a Vector + //This method will give us a new vector that is pointing the + //opposite direction of the current and not changing its magnitude. + public Vector4f NegateVector() { + return new Vector4f( + -this.x, + -this.y, + -this.z, + -this.a + ); + } + + //implement getting the length of a Vector + //This method gives the magnitude of the current vector + //by using the length formula + public float length() { + return (float) Math.sqrt(x * x + y * y + z * z + a * a); + } + + //implement getting the Normal of a Vector + // Remember that since you just have one vector, this method is returning a normalized vector with a one unity length + // This method returns the normalized vector of the current vector + // which has unit magnitude of 1. + // I use the 1.0f / length() as the norm, which is like a scale that can change the x,y,z by this scale + public Vector4f Normal() { + float l = this.length(); + return new Vector4f( + this.x / l, + this.y / l, + this.z / l, + this.a / l + ); + } + + //implement getting the dot product of Vector.Vector + //This method gives the dot product of two vector. + //the result is a number(scalar) + //It is actually projecting Vector A to Vector B and multiply it by the + //magnitude of B + public float dot(Vector4f v) { + return (this.x * v.x + this.y * v.y + this.z * v.z + this.a * v.a); + } + + // Implemented this for you to avoid confusion + // as we will not normally be using 4 float vector + //The cross product gives us a vector. + //The vector is actually perpendicular to the Vector A and vector B + //Here A is "this" vector and B is "v" + public Vector4f cross(Vector4f v) { + float u0 = (this.y * v.z - z * v.y); + float u1 = (z * v.x - x * v.z); + float u2 = (x * v.y - y * v.x); + float u3 = 0; //ignoring this for now + return new Vector4f(u0, u1, u2, u3); + } + +} + + + +/* + + MMMM + MMMMMM + MM MMMM + MMI MMMM + MMM MMMM + MMM MMMM + MM MMMMM + MMM MMMMM + MMM OMMMM + MM .MMMM +MMMMMMMMMMMMMMM MMM .MMMM +MM IMMMMMMMMMMMMMMMMMMMMMMMM MMM MMMM +MM ~MMMMMMMMMMMMMMMMMMMMM MMMM +MM OMMMMM MMMMM +MM MMMMM +MM MMMMM +MM ~MMMM +MM =MMMM +MM MMMM +MM 4 D MMMMMM +MM MMMMMMMM +MM :MMMMMMMM +MM MMMMMMMMM +MM MMMMMMMMM +MM ,MMMMMMMMMM MMMMMMMMM +MM IMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM ZMMMMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMM MM$ MMMMMMMMM +MMMMMMMMMMMMMM MMM MMMMMMMMM + MMM MMMMMMMM + MM~ IMMMMMMMM + MM DMMMMMMMM + MMM MMMMMMMMM + MMD MMMMMMMM + MMM MMMMMMMM + MMMMMMMMMM + MMMMMMMM + MMMM + MM + GlassGiant.com */ \ No newline at end of file diff --git a/src/GraphicsObjects/quat.java b/src/GraphicsObjects/quat.java new file mode 100644 index 0000000..b1c94fa --- /dev/null +++ b/src/GraphicsObjects/quat.java @@ -0,0 +1,162 @@ +package GraphicsObjects; + +import java.nio.FloatBuffer; + +import org.lwjgl.BufferUtils; + +/* + * Created by Owen Grogan on 06/05/2010. + * Copyright 2010 School of Computer Science and Informatics. All rights reserved. + * + * Update for Java by Abraham Campbell on 14/10/2015 + Updated again by Abraham Campbell on 14/10/2019 with Huang Yuyang fix to stop Arc Ball issues ( well spotted ) + */ +public class quat { + + + private float real =1f; + private Vector4f imag = new Vector4f( 0.0f,0.0f,0.0f,0.0f); + + public quat() + { + + } + + public quat(float[] matrix) + { + real = (float) (Math.sqrt( 1.0+matrix[0]+matrix[5]+matrix[10]) /2.0); + float w4 = (float) (4.0*real); + imag= new Vector4f((matrix[6] - matrix[9])/w4, + (matrix[8] - matrix[2])/w4, + (matrix[1] - matrix[4])/w4,0.0f); + } + + public quat(float w,float x, float y, float z) + { + imag.x = x; + imag.y = y; + imag.z = z; + real = w; + } + + public quat(Vector4f v, float w) + { + imag = v; + real = w; + } + + public quat(float w, Vector4f v){ + imag = v; + real = w; + } + + public float getReal() + { + return real; + } + + public Vector4f getImag() + { + return imag; + } + + public quat mult(quat q) + { + float T = (real*q.getReal()) - (imag.dot(q.getImag())); + //System.out.println("T =" + T); + Vector4f P = q.getImag().byScalar(real); + Vector4f Q = imag.byScalar(q.getReal()); + Vector4f W = imag.cross(q.getImag()); + Vector4f Combine = P.PlusVector(Q); + Combine = Combine.PlusVector(W); + + return new quat(T,Combine); + +} + public quat conj() +{ + return new quat(real,-imag.x,-imag.y,-imag.z); +} + +float sumSquare(){ + return (real*real+imag.x*imag.x+ + imag.y*imag.y+imag.z*imag.z); +} + +public quat inverse(){ + float T= real/sumSquare(); + Vector4f W = conj().getImag().byScalar(1/sumSquare()); + return new quat(T,W); +} + +void toMatrix(FloatBuffer currentMatrix){ + float treal = real; + + float[] ToConvert = new float[16]; + + //identity matrix + ToConvert[0] = 1.0f; + ToConvert[1] = 0.0f; + ToConvert[2] = 0.0f; + ToConvert[3] = 0.0f; + ToConvert[4] = 0.0f; + ToConvert[5] = 1.0f; + ToConvert[6] = 0.0f; + ToConvert[7] = 0.0f; + ToConvert[8] = 0.0f; + ToConvert[9] = 0.0f; + ToConvert[10] = 1.0f;; + ToConvert[11] = 0.0f; + ToConvert[12] = 0.0f; + ToConvert[13] = 0.0f; + ToConvert[14] = 0.0f; + ToConvert[15] = 1.0f;; + + + + +// currentMatrix. + //System.out.println("TEst = "+ (1.0f-((2.0f*imag.y*imag.y)+(2.0f*imag.z*imag.z)))); + ToConvert[0] = 1.0f-((2.0f*imag.y*imag.y)+(2.0f*imag.z*imag.z)); + ToConvert[4] = 2.0f*((imag.x*imag.y)-(imag.z*treal)); + ToConvert[8] = 2.0f*((imag.x*imag.z)+(imag.y*treal)); + + ToConvert[1] = 2.0f*((imag.x*imag.y)+(imag.z*treal)); + ToConvert[5] = 1.0f-((2.0f*imag.x*imag.x)+(2.0f*imag.z*imag.z)); + ToConvert[9] = 2.0f*((imag.y*imag.z)-(imag.x*treal)); + + ToConvert[2] = 2.0f*((imag.x*imag.z)-(imag.y*treal)); + ToConvert[6] = 2.0f*((imag.y*imag.z)+(imag.x*treal)); + ToConvert[10] = 1.0f-((2.0f*imag.y*imag.y)+(2.0f*imag.x*imag.x)); + + /* + System.out.println("Matrix " + ToConvert[0] +" "+ ToConvert[4] +" "+ ToConvert[8] +" "+ ToConvert[12] + "\n" + +" " + ToConvert[1] +" "+ ToConvert[5] +" "+ ToConvert[9] +" "+ ToConvert[13] + "\n" + +" " + ToConvert[2] +" "+ ToConvert[6] +" "+ ToConvert[10] +" "+ ToConvert[14] + "\n" + +" " + ToConvert[3] +" "+ ToConvert[7] +" "+ ToConvert[11] +" "+ ToConvert[15] + "\n"); +*/ + + + currentMatrix.put( + ToConvert[0]).put + (ToConvert[1]).put + (ToConvert[2]).put + (ToConvert[3]).put + (ToConvert[4]).put + (ToConvert[5]).put + (ToConvert[6]).put + (ToConvert[7]).put + (ToConvert[8]).put + (ToConvert[9]).put + (ToConvert[10]).put + (ToConvert[11]).put + (ToConvert[12]).put + (ToConvert[13]).put + (ToConvert[14]).put + (ToConvert[15]).flip(); + + +} + + +} diff --git a/src/META-INF/MANIFEST.MF b/src/META-INF/MANIFEST.MF new file mode 100644 index 0000000..c2184f5 --- /dev/null +++ b/src/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: MainWindow + diff --git a/src/MainWindow.java b/src/MainWindow.java new file mode 100644 index 0000000..16aa61e --- /dev/null +++ b/src/MainWindow.java @@ -0,0 +1,740 @@ +import GraphicsObjects.Arcball; +import GraphicsObjects.Utils; +import GraphicsObjects.Vector4f; +import objects3D.Grid; +import objects3D.Human; +import objects3D.TexCube; +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.GLU; +import org.newdawn.slick.Color; +import org.newdawn.slick.opengl.Texture; +import org.newdawn.slick.opengl.TextureLoader; +import org.newdawn.slick.util.ResourceLoader; +import java.io.IOException; +import java.nio.FloatBuffer; +import java.util.HashMap; +import java.util.LinkedHashMap; + +//Main windows class controls and creates the 3D virtual world , please do not change this class but edit the other classes to complete the assignment. +// Main window is built upon the standard Helloworld LWJGL class which I have heavily modified to use as your standard openGL environment. +// + +// Do not touch this class, I will be making a version of it for your 3rd Assignment +public class MainWindow { + //MY Hash map to store the textures + public static HashMap textures = new LinkedHashMap(); + + + // basic colours + static float black[] = {0.0f, 0.0f, 0.0f, 1.0f}; + static float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; + static float grey[] = {0.5f, 0.5f, 0.5f, 1.0f}; + static float spot[] = {0.1f, 0.1f, 0.1f, 0.5f}; + // primary colours + static float red[] = {1.0f, 0.0f, 0.0f, 1.0f}; + static float green[] = {0.0f, 1.0f, 0.0f, 1.0f}; + static float blue[] = {0.0f, 0.0f, 1.0f, 1.0f}; + // secondary colours + static float yellow[] = {1.0f, 1.0f, 0.0f, 1.0f}; + static float magenta[] = {1.0f, 0.0f, 1.0f, 1.0f}; + static float cyan[] = {0.0f, 1.0f, 1.0f, 1.0f}; + // other colours + static float orange[] = {1.0f, 0.5f, 0.0f, 1.0f, 1.0f}; + static float brown[] = {0.5f, 0.25f, 0.0f, 1.0f, 1.0f}; + static float dkgreen[] = {0.0f, 0.5f, 0.0f, 1.0f, 1.0f}; + static float pink[] = {1.0f, 0.6f, 0.6f, 1.0f, 1.0f}; + /** + * position of pointer + */ + float x = 400, y = 300; + /** + * angle of rotation + */ + float rotation = 0; + /** + * time at last frame + */ + long lastFrame; + /** + * frames per second + */ + int fps; + /** + * last fps time + */ + long lastFPS; + long myDelta = 0; //to use for animation + float Alpha = 0; //to use for animation + long StartTime; // beginAnimiation + Arcball MyArcball = new Arcball(); + boolean DRAWGRID = false; + boolean waitForKeyrelease = true; + /** + * Mouse movement + */ + int LastMouseX = -1; + int LastMouseY = -1; + float pullX = 0.0f; // arc ball X cord. + float pullY = 0.0f; // arc ball Y cord. + int OrthoNumber = 1200; // using this for screen size, making a window of 1200 x 800 so aspect ratio 3:2 // do not change this for assignment 3 but you can change everything for your project + Texture texture; + private boolean MouseOnepressed = true; + private boolean dragMode = false; + + // static GLfloat light_position[] = {0.0, 100.0, 100.0, 0.0}; + private boolean BadAnimation = false; + //support method to aid in converting a java float array into a Floatbuffer which is faster for the opengl layer to process + private boolean Earth = false; + + //mouse right button click record + private int secMouseX = 700; + private int secMouseY = 0; + //if mouse right button click + private Boolean secMousePressed = false; + + public static void main(String[] argv) { + MainWindow hello = new MainWindow(); + hello.start(); + } + + public void start() { + + StartTime = getTime(); + try { + Display.setDisplayMode(new DisplayMode(1200, 800)); + Display.create(); + } catch (LWJGLException e) { + e.printStackTrace(); + System.exit(0); + } + + initGL(); // init OpenGL + getDelta(); // call once before loop to initialise lastFrame + lastFPS = getTime(); // call before loop to initialise fps timer + +// 489 477 +// 558 585 +// MyArcball.startBall(489 ,477,1200,800); +// MyArcball.updateBall(558 ,585,1200,800); + + //move camera away + OrthoNumber = 1440; + + + while (!Display.isCloseRequested()) { + int delta = getDelta(); + update(delta); + renderGL(); + Display.update(); + Display.sync(120); // cap fps to 120fps + } + + Display.destroy(); + } + + public void update(int delta) { + // rotate quad + //rotation += 0.01f * delta; + + //My translation function needs to log Mouse position + int MouseX = Mouse.getX(); + int MouseY = Mouse.getY(); + int WheelPostion = Mouse.getDWheel(); + + //If first button pressed then use the arcball, if second button then translate the scene + boolean MouseButonPressed = Mouse.isButtonDown(0); + this.secMousePressed = Mouse.isButtonDown(1); + + + //for scene translation + if (this.secMousePressed) { + int x = (int) (MouseX - this.LastMouseX); + int y = (int) (MouseY - this.LastMouseY); + this.secMouseX += x; + this.secMouseY += y; + } + + //scene rotation + if (MouseButonPressed && !MouseOnepressed) { + MouseOnepressed = true; +// System.out.println("Mouse drag mode"); + MyArcball.startBall(MouseX, MouseY, 1200, 800); +// System.out.println(MouseX + " " + MouseY); + System.out.println(OrthoNumber); + dragMode = true; + } else if (!MouseButonPressed) { +// if(MouseX != LastMouseX) +// System.out.println(MouseX + " " + MouseY); + MouseOnepressed = false; + dragMode = false; + } + + if (dragMode) { + //update arcball + MyArcball.updateBall(MouseX, MouseY, 1200, 800); + } + + if (WheelPostion > 0) { + OrthoNumber += 10; + + } + + if (WheelPostion < 0) { + OrthoNumber -= 10; + if (OrthoNumber < 610) { + OrthoNumber = 610; + } + + // System.out.println("Orth nubmer = " + OrthoNumber); + + } + + /** rest key is R*/ + if (Keyboard.isKeyDown(Keyboard.KEY_R)) + MyArcball.reset(); + + /* bad animation can be turn on or off using A key)*/ + + if (Keyboard.isKeyDown(Keyboard.KEY_A)) + BadAnimation = !BadAnimation; + if (Keyboard.isKeyDown(Keyboard.KEY_D)) + x += 0.35f * delta; + + if (Keyboard.isKeyDown(Keyboard.KEY_W)) + y += 0.35f * delta; + if (Keyboard.isKeyDown(Keyboard.KEY_S)) + y -= 0.35f * delta; + + if (Keyboard.isKeyDown(Keyboard.KEY_Q)) + rotation += 0.35f * delta; + if (Keyboard.isKeyDown(Keyboard.KEY_E)) { + Earth = !Earth; + } + + if (waitForKeyrelease) // check done to see if key is released + { + if (Keyboard.isKeyDown(Keyboard.KEY_G)) { + + DRAWGRID = !DRAWGRID; + Keyboard.next(); + if (Keyboard.isKeyDown(Keyboard.KEY_G)) { + waitForKeyrelease = true; + } else { + waitForKeyrelease = false; + + } + } + } + + /** to check if key is released */ + if (Keyboard.isKeyDown(Keyboard.KEY_G) == false) { + waitForKeyrelease = true; + } else { + waitForKeyrelease = false; + + } + + + // keep quad on the screen + if (x < 0) + x = 0; + if (x > 1200) + x = 1200; + if (y < 0) + y = 0; + if (y > 800) + y = 800; + + updateFPS(); // update FPS Counter + + LastMouseX = MouseX; + LastMouseY = MouseY; + } + + /** + * Calculate how many milliseconds have passed since last frame. + * + * @return milliseconds passed since last frame + */ + public int getDelta() { + long time = getTime(); + int delta = (int) (time - lastFrame); + lastFrame = time; + + return delta; + } + + /** + * Get the accurate system time + * + * @return The system time in milliseconds + */ + public long getTime() { + return (Sys.getTime() * 1000) / Sys.getTimerResolution(); + } + + /** + * Calculate the FPS and set it in the title bar + */ + public void updateFPS() { + if (getTime() - lastFPS > 1000) { + Display.setTitle("FPS: " + fps); + fps = 0; + lastFPS += 1000; + } + fps++; + } + + public void initGL() { + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + changeOrth(); + MyArcball.startBall(0, 0, 1200, 800); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + FloatBuffer lightPos = BufferUtils.createFloatBuffer(4); + lightPos.put(10000f).put(1000f).put(1000).put(0).flip(); + + FloatBuffer lightPos2 = BufferUtils.createFloatBuffer(4); + lightPos2.put(0f).put(1000f).put(0).put(-1000f).flip(); + + FloatBuffer lightPos3 = BufferUtils.createFloatBuffer(4); + lightPos3.put(-10000f).put(1000f).put(1000).put(0).flip(); + + FloatBuffer lightPos4 = BufferUtils.createFloatBuffer(4); + lightPos4.put(1000f).put(1000f).put(1000f).put(0).flip(); + + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, lightPos); // specify the + // position + // of the + // light +// GL11.glEnable(GL11.GL_LIGHT0); // switch light #0 on // I've setup specific materials so in real light it will look abit strange + + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION, lightPos); // specify the + // position + // of the + // light + GL11.glEnable(GL11.GL_LIGHT1); // switch light #0 on + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, Utils.ConvertForGL(spot)); + + GL11.glLight(GL11.GL_LIGHT2, GL11.GL_POSITION, lightPos3); // specify + // the + // position + // of the + // light + GL11.glEnable(GL11.GL_LIGHT2); // switch light #0 on + GL11.glLight(GL11.GL_LIGHT2, GL11.GL_DIFFUSE, Utils.ConvertForGL(grey)); + + GL11.glLight(GL11.GL_LIGHT3, GL11.GL_POSITION, lightPos4); // specify + // the + // position + // of the + // light + GL11.glEnable(GL11.GL_LIGHT3); // switch light #0 on + GL11.glLight(GL11.GL_LIGHT3, GL11.GL_DIFFUSE, Utils.ConvertForGL(grey)); + + GL11.glEnable(GL11.GL_LIGHTING); // switch lighting on + GL11.glEnable(GL11.GL_DEPTH_TEST); // make sure depth buffer is switched + // on + GL11.glEnable(GL11.GL_NORMALIZE); // normalize normal vectors for safety + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + try { + init(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } //load in texture + + + } + + public void changeOrth() { + + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(1200 - OrthoNumber, OrthoNumber, (800 - (OrthoNumber * 0.66f)), (OrthoNumber * 0.66f), 100000, -100000); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + + FloatBuffer CurrentMatrix = BufferUtils.createFloatBuffer(16); + GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, CurrentMatrix); + + // if(MouseOnepressed) + // { + + MyArcball.getMatrix(CurrentMatrix); + // } + + GL11.glLoadMatrix(CurrentMatrix); + + + } + + /* + * You can edit this method to add in your own objects / remember to load in textures in the INIT method as they take time to load + * + */ + public void renderGL() { + changeOrth(); + + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); + GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); + GL11.glColor3f(0.5f, 0.5f, 1.0f); + + myDelta = getTime() - StartTime; + float delta = ((float) myDelta) / 10000; + + // code to aid in animation + float theta = (float) (delta * 2 * Math.PI); + float thetaDeg = delta * 360; + float posn_x = (float) Math.cos(theta); // same as your circle code in your notes + float posn_y = (float) Math.sin(theta); +// System.out.println(posn_x); + OrthoNumber = (int) (1240 + posn_x * 200); //letting the OrthoNumber change when the scene change + +// GL11.glLoadIdentity(); +// System.out.println(-posn_x * 5.0f); + + + +// GLU.gluLookAt(0f, -1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f); + if (!BadAnimation) { +// secMouseX = 600; +// secMouseY = 100; + Vector4f v = new Vector4f(-posn_x, -0.5f, -posn_y, 0f); + GL11.glTranslatef(secMouseX, secMouseY, 0); + + Vector4f v1 = new Vector4f(posn_x, 0f, posn_y,0f); + Vector4f v2 = new Vector4f(0f, 1f, 0f,0f); + Vector4f v3 = v1.cross(v2); + v3 = new Vector4f(v3.x, v3.y + 0.3f, v3.z, 0f).Normal(); +// GLU.gluLookAt(v.Normal().x, v.Normal().y, v.Normal().z, 0f, 0f, 0f, 0f, 1f, 0f); + GLU.gluLookAt(-v3.x, -v3.y, -v3.z, 0f, 0f, 0f, 0f, 1f, 0f); //change the look at position + } else { +// secMouseX = 600; +// secMouseY = 0; + GL11.glTranslatef(secMouseX, secMouseY, 0); + GLU.gluLookAt(2f, -1f, -1f, 0f, 0f, 0f, 0f, 1f, 0f); + } + +// GL11.glPushMatrix(); +// TexCube MyGrid1 = new TexCube(); +//// GL11.glTranslatef(secMouseX,secMouseY,0); +//// GL11.glTranslatef(600, 270, 0); +// GL11.glScalef(200f, 200f, 200f); +// GL11.glTexParameteri( +// GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, +// GL11.GL_REPEAT); +// GL11.glTexParameteri( +// GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, +// GL11.GL_REPEAT); +// Color.white.bind(); +// textures.get("default_dirt").bind(); +// GL11.glEnable(GL11.GL_TEXTURE_2D); +// GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); +// MyGrid1.DrawTexCube(30f); +// GL11.glDisable(GL11.GL_TEXTURE_2D); +// GL11.glPopMatrix(); + /* + * This code draws a grid to help you view the human models movement + * You may change this code to move the grid around and change its starting angle as you please + */ + if (DRAWGRID) { + GL11.glPushMatrix(); + Grid MyGrid = new Grid(); +// GL11.glTranslatef(secMouseX,secMouseY,0); + GL11.glTranslatef(600, 300, 0); + GL11.glScalef(200f, 200f, 200f); + MyGrid.DrawGrid(); + GL11.glPopMatrix(); + } + + //Draw a big plain + GL11.glPushMatrix(); + TexCube MyGrid = new TexCube(); +// GL11.glTranslatef(secMouseX,secMouseY,0); + GL11.glTranslatef(600, 270, 0); + GL11.glScalef(8000f, 1f, 8000f); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, + GL11.GL_REPEAT); + Color.white.bind(); + //bind texture + textures.get("default_dirt").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + MyGrid.DrawTexCube(30f); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glPopMatrix(); + + GL11.glPushMatrix(); + //human obj + Human MyHuman = new Human(textures); //init human with textures +// GL11.glTranslatef(secMouseX,secMouseY,0); + GL11.glTranslatef(300, 400, 0); + GL11.glScalef(90f, 90f, 90f); + + + if (!BadAnimation) { + // insert your animation code to correct the postion for the human rotating + GL11.glTranslatef(posn_x * 3.0f, 0.0f, posn_y * 3.0f); + float angle = -(float) (180 * (theta) / Math.PI); + GL11.glRotatef(180 + angle, 0, 1, 0); +// System.out.println(theta); + + } else { + //bad animation version +// GL11.glTranslatef(posn_x * 3.0f, 0.0f, posn_y * 3.0f); + GL11.glTranslatef(posn_x * 3.0f, 0.0f, posn_y * 3.0f); + float angle = -(float) (180 * (theta) / Math.PI); + GL11.glRotatef(180 + angle, 0, 1, 0); + } + + MyHuman.DrawHuman(delta, true); // give a delta for the Human object ot be animated + + GL11.glPopMatrix(); + + + + // Draw TNTs + GL11.glPushMatrix(); + TexCube cube1 = new TexCube(); +// GL11.glTranslatef(secMouseX,secMouseY,0); + GL11.glTranslatef(300, 320, 0); + GL11.glScalef(50f, 50f, 50f); + Color.white.bind(); + textures.get("tnt_side").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + cube1.DrawTexCube(); + //TNT + GL11.glPushMatrix(); + { + //go up + GL11.glTranslatef(0, 2f, 0); + cube1.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0, 2f, 0); + cube1.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0, 2f, 0); + cube1.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0, 2f, 0); + cube1.DrawTexCube(); + GL11.glPushMatrix(); + { + //right(top TNTs) + GL11.glTranslatef(2f, 0f, 0); + cube1.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(2f, 0f, 0); + cube1.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(2f, 0f, 0); + cube1.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(2f, 0f, 0); + cube1.DrawTexCube(); + GL11.glPushMatrix(); + { + //go down + GL11.glTranslatef(0f, -2f, 0); + cube1.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0f, -2f, 0); + cube1.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0f, -2f, 0); + cube1.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0f, -2f, 0); + cube1.DrawTexCube(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + GL11.glPopMatrix(); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glPopMatrix(); + + + //Draw lava + GL11.glPushMatrix(); + TexCube cube2 = new TexCube(); +// GL11.glTranslatef(secMouseX,secMouseY,0); + GL11.glTranslatef(300, 320, 0); +// GL11.glTranslatef(0, -2f, 0); + GL11.glScalef(50f, 50f, 50f); + Color.white.bind(); + textures.get("default_lava").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GL11.glTranslatef(-2f, 0f, 0); + cube2.DrawTexCube(); + //LAVA + GL11.glPushMatrix(); + { + //Go UP + GL11.glTranslatef(0f, 2f, 0); + cube2.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0f, 2f, 0); + cube2.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0f, 2f, 0); + cube2.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0f, 2f, 0); + cube2.DrawTexCube(); + GL11.glPushMatrix(); + { + //go left (TOP lava) + GL11.glTranslatef(-2f, 0f, 0); + cube2.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(-2f, 0f, 0); + cube2.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(-2f, 0f, 0); + cube2.DrawTexCube(); + GL11.glPushMatrix(); + { + //Go DOWN + GL11.glTranslatef(0f, -2f, 0); + cube2.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0f, -2f, 0); + cube2.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0f, -2f, 0); + cube2.DrawTexCube(); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0f, -2f, 0); + cube2.DrawTexCube(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + + } + GL11.glPopMatrix(); + + } + GL11.glPopMatrix(); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glPopMatrix(); + + /* + * This code puts the earth code in which is larger than the human so it appears to change the scene + */ + if (Earth) { + //Globe in the centre of the scene + GL11.glPushMatrix(); +// TexSphere MyGlobe = new TexSphere(); + TexCube MyGlobe = new TexCube(); + GL11.glTranslatef(500, 500, 500); + GL11.glScalef(140f, 140f, 140f); + + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_CLAMP); + + Color.white.bind(); + texture.bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + +// MyGlobe.DrawTexSphere(8f, 100, 100, texture); + MyGlobe.DrawTexCube(); + GL11.glPopMatrix(); + } + + } + + /* + * Any additional textures for your assignment should be written in here. + * Make a new texture variable for each one so they can be loaded in at the beginning + */ + public void init() throws IOException { + + //LOAD textures + texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/earthspace.png")); + textures.put("awesomeface", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/awesomeface.png"))); + textures.put("default_dirt", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/default_dirt.png"))); + textures.put("earthspace", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/earthspace.png"))); + textures.put("tnt_side", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/tnt_side.png"))); + textures.put("farming_wheat_8", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/farming_wheat_8.png"))); + textures.put("wool_pink", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/wool_pink.png"))); + textures.put("default_lava", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/default_lava.png"))); + textures.put("default_stone", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/default_stone.png"))); + textures.put("default_cobble", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/default_cobble.png"))); +// textures.put("awesomeface",TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/awesomeface.png"))); +// textures.put("awesomeface",TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/awesomeface.png"))); + + + System.out.println("Texture loaded okay "); + } +} diff --git a/src/objects3D/Cube.java b/src/objects3D/Cube.java new file mode 100644 index 0000000..81dc991 --- /dev/null +++ b/src/objects3D/Cube.java @@ -0,0 +1,78 @@ +package objects3D; + +import GraphicsObjects.Point4f; +import GraphicsObjects.Vector4f; +import org.lwjgl.opengl.GL11; + +public class Cube { + + + public Cube() { + + } + + // Implement using notes and examine Tetrahedron to aid in the coding look at lecture 7 , 7b and 8 + // Implement using notes and examine Tetrahedron to aid in the coding look at lecture 7 , 7b and 8 + //This method will draw a cube, base on the vertices and the faces + public void DrawCube() { + //a cube have 8 vertices so this is the coordinates of the vertices + Point4f vertices[] = {new Point4f(-1.0f, -1.0f, -1.0f, 0.0f), + new Point4f(-1.0f, -1.0f, 1.0f, 0.0f), + new Point4f(-1.0f, 1.0f, -1.0f, 0.0f), + new Point4f(-1.0f, 1.0f, 1.0f, 0.0f), + new Point4f(1.0f, -1.0f, -1.0f, 0.0f), + new Point4f(1.0f, -1.0f, 1.0f, 0.0f), + new Point4f(1.0f, 1.0f, -1.0f, 0.0f), + new Point4f(1.0f, 1.0f, 1.0f, 0.0f)}; + + //each face of the cube consists four edges, there are 6 faces in total + //so, this array has 6 element, each element contains the related edges + int faces[][] = {{0, 4, 5, 1}, + {0, 2, 6, 4}, + {0, 1, 3, 2}, + {4, 6, 7, 5}, + {1, 5, 7, 3}, + {2, 3, 7, 6}}; + + + //INIT GL + GL11.glBegin(GL11.GL_QUADS); + + for (int face = 0; face < 6; face++) { // per face + //calculate the normal vector using cross product which returns a vector + //that is perpendicular to these two vector + Vector4f v = vertices[faces[face][1]].MinusPoint(vertices[faces[face][0]]); + Vector4f w = vertices[faces[face][3]].MinusPoint(vertices[faces[face][0]]); + //calc the normal vector + Vector4f normal = v.cross(w).Normal(); + //set the normal vector of this face in GL + GL11.glNormal3f(normal.x, normal.y, normal.z); + + + //draw one face + //point 1 + GL11.glVertex3f(vertices[faces[face][0]].x, vertices[faces[face][0]].y, vertices[faces[face][0]].z); + //point 2 + GL11.glVertex3f(vertices[faces[face][1]].x, vertices[faces[face][1]].y, vertices[faces[face][1]].z); + //point 3 + GL11.glVertex3f(vertices[faces[face][2]].x, vertices[faces[face][2]].y, vertices[faces[face][2]].z); + //point 4 + GL11.glVertex3f(vertices[faces[face][3]].x, vertices[faces[face][3]].y, vertices[faces[face][3]].z); + } // per face + + //END GL + GL11.glEnd(); + + + } + + +} + + /* + + +} + + */ + \ No newline at end of file diff --git a/src/objects3D/Cylinder.java b/src/objects3D/Cylinder.java new file mode 100644 index 0000000..0ebc551 --- /dev/null +++ b/src/objects3D/Cylinder.java @@ -0,0 +1,74 @@ +package objects3D; + +import GraphicsObjects.Vector4f; +import org.lwjgl.opengl.GL11; + +public class Cylinder { + + + public Cylinder() { + } + + // remember to use Math.PI isntead PI + // Implement using notes and examine Tetrahedron to aid in the coding look at lecture 7 , 7b and 8 + // This method draws a Cylinder + public void DrawCylinder(float radius, float height, int nSegments) { + //INIT GL + GL11.glBegin(GL11.GL_TRIANGLES); + + //Cylinder is drawn piece by piece, and each piece consist two triangle + //so, here we loop through the nSegments, to draw each piece. + for (float i = 0.0f; i < nSegments; i += 1.0) { + //left side angle of the piece + float angle = (float) (Math.PI * i * 2.0 / nSegments); + //right side angle of the piece + float nextAngle = (float) (Math.PI * (i + 1.0) * 2.0 / nSegments); + + //left side angle of the piece + float x1 = (float) Math.sin(angle) * radius; + float y1 = (float) Math.cos(angle) * radius; + + //right side angle of the piece + float x2 = (float) Math.sin(nextAngle) * radius; + float y2 = (float) Math.cos(nextAngle) * radius; + + //upper triangle + GL11.glNormal3f(x1, y1, 0); + GL11.glVertex3f(x1, y1, 0); + GL11.glNormal3f(x2, y2, 0); + GL11.glVertex3f(x2, y2, height); + GL11.glNormal3f(x1, y1, 0); + GL11.glVertex3f(x1, y1, height); + + //lower triangle + GL11.glNormal3f(x1, y1, 0); + GL11.glVertex3f(x1, y1, 0); + GL11.glNormal3f(x2, y2, 0); + GL11.glVertex3f(x2, y2, 0.0f); + GL11.glNormal3f(x2, y2, 0); + GL11.glVertex3f(x2, y2, height); + +// //top & bottom + Vector4f normalTop = (new Vector4f(x1, y1, 0, 0)).cross(new Vector4f(x2 - x1, y2 - y1, 0, 0)); + Vector4f normalBottom = (new Vector4f(x1, y1, 0, 0)).cross(new Vector4f(x2 - x1, y2 - y1, 0, 0)); + + //the top normal vector + GL11.glNormal3f(-normalTop.x, -normalTop.y, -normalTop.z); + GL11.glVertex3f(x1, y1, height); + GL11.glVertex3f(x2, y2, height); + GL11.glVertex3f(0, 0, height); + + //the bottom normal vector + GL11.glNormal3f(normalBottom.x, normalBottom.y, normalBottom.z); + GL11.glVertex3f(x1, y1, 0); + GL11.glVertex3f(x2, y2, 0); + GL11.glVertex3f(0, 0, 0); + + + } + //END GL + GL11.glEnd(); + + + } +} diff --git a/src/objects3D/Grid.java b/src/objects3D/Grid.java new file mode 100644 index 0000000..6f9c4e2 --- /dev/null +++ b/src/objects3D/Grid.java @@ -0,0 +1,141 @@ +package objects3D; + +import org.lwjgl.opengl.GL11; +import GraphicsObjects.Point4f; +import GraphicsObjects.Utils; +import GraphicsObjects.Vector4f; + + +public class Grid { + + static float black[] = { 0.0f, 0.0f, 0.0f, 1.0f }; + static float white[] = { 1.0f, 1.0f, 1.0f, 1.0f }; + + + public Grid() { + + } + + // Do not touch this class, I have implmented to help you in your Assignment 3 and project + public void DrawGrid() + { + int nGridlines = 50; + + int x, z; + // edges don't reflect + GL11.glMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(black)); + GL11.glMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_EMISSION, Utils.ConvertForGL(black)); // but they do emit + GL11.glMatrixMode(GL11.GL_MODELVIEW); + + GL11.glPushMatrix(); + for (x = -nGridlines; x <= nGridlines; x++){ // for each x + if ((x % 50 >0)) GL11.glLineWidth((float) 0.1); + + else GL11.glLineWidth((float) 0.1); + GL11.glBegin( GL11.GL_LINES); + GL11.glVertex3i(x, 0, -nGridlines); + GL11.glVertex3i(x, 0, +nGridlines); + GL11.glEnd(); + } // for each x + + + for (z = -nGridlines; z <= nGridlines; z++){ // for each y + if ((z % 50 >0)) GL11.glLineWidth((float) 0.1); + else GL11.glLineWidth((float) 0.1); + GL11.glBegin(GL11.GL_LINES); + GL11.glVertex3i(-nGridlines, 0, z); + GL11.glVertex3i(+nGridlines, 0, z); + GL11.glEnd(); + } // for each y + GL11.glLineWidth((float) 1.0); + GL11.glPopMatrix(); + // stop emitting, otherwise other objects will emit the same colour + GL11.glMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_EMISSION, Utils.ConvertForGL(black)); // but they do emit + + + + + } + + + +} + + + + + + + + + + + + /* + On the grid + = $ ~ D I D ~ $ = . + ~ = + N ? M I M I M I N ? D + = ~ . + $ D 8 Z M 7 D O O N I N Z O D 7 M $ 8 8 $ . + : 7 ~ Z + N 8 I 8 N ? Z = $ : . + , ~ . D Z I O D . ~ , . + N M M , : $ 7 I $ Z , . M M D . + . N D ? I I I ? D D , . . + ~ . = I + : . : + I + : . : + I + . : . + Z N N Z + ~ I ~ + Z N N Z . + N I . + 8 8 , I , 8 D ? . I N . + N + : O 8 + D I N + O O : + N . + $ 7 7 I 7 $ $ . + ~ Z + : . I . : + Z ~ . + $ ? O M . = I = . N O ? Z . + 7 I I 7 7 I 7 7 I I 7 . + ......?.....I............~............M............8............7............O............M............~............I.....I...... . + D $ N 7 M I M $ N Z D . + Z ? = , 8 I 8 , ~ ? Z . . + : = ~ 8 D 7 I $ D 8 ~ = : . + I Z = : I + = , I , = + I : = Z I . + M D Z . ~ I ~ , Z D M . + D + I M + I + M I + D . + : D = + Z I I I Z = = D , . + : : M . D 8 = $ I 7 = 8 D . M , : . + Z D . $ $ 8 O I Z 8 $ $ . D Z . + $ O = , 8 I 8 , = . O $ . + = D $ + N I N + . $ D ~ . + D O ~ , $ M I M 7 , = O 8 . + ~ : 7 D D I D D 7 : : . + +++++++O++++++D++++++M++++++I++++++$++++++8++++++N++++++M++++++8++++++Z++++++8++++++M++++++N++++++8++++++$++++++I++++++M++++++D++++++O+++++++ . + I + = : N M N 8 Z $ I $ O 8 N M N ~ = ? I . + ? ? ? ? I I I I I I I ? ? . + D O $ , ~ + I + ~ , $ O D . + ~ I ~ . ~ I = . ~ 7 = . . + : M O + : I : + Z M : . + Z : $ N ? . I . ? N $ : O . + N = 7 N = I = N 7 = D . + , 8 I Z Z I Z Z I 8 , . + M : 7 $ , N ~ I ~ M , $ 7 : M . + 8 = O + $ I I ? $ + O ~ 8 . + + D , N ~ Z I Z = N . , D + . + 7 = N I = N I N = 7 N = 7 . + Z . = ? 8 D I N O ? = . Z . + 8 M N 8 Z I Z 8 N M 8 . + . ? , + ~ ~ = ? I ? + ~ ~ = : ? . . + , 7 D D : I : 8 N 7 , . + O . $ I $ , O . + D . = I ~ D . + 8 ~ O $ I $ Z ~ 8 . + M : 7 $ , M I M , $ 7 : M . + Z Z 7 O I O 7 Z $ . + =???????M???????Z??????????????????????Z???????M???????$??????????????????????O??????????????????????$???????M???????Z??????????????????????Z???????M???????= . + 7 . I M 7 . I . 7 M I . 7 . + . ? 8 D ? . , I , , I D 8 ? . . +8 N Z ? : ~ I ~ : ? Z M 8. +, . ~ + I + : . + +The grid, a digital frontier + +I tried to picture clusters of information as they moved through the computer. + + What do they look like? Ships, motorcycles. With the circuits like freeways, I kept dreaming of a world, I thought I'd never see. + +And then, one day, I got in + */ + \ No newline at end of file diff --git a/src/objects3D/Human.java b/src/objects3D/Human.java new file mode 100644 index 0000000..98c3a06 --- /dev/null +++ b/src/objects3D/Human.java @@ -0,0 +1,533 @@ +package objects3D; + +import GraphicsObjects.Utils; +import org.lwjgl.opengl.GL11; +import org.newdawn.slick.Color; +import org.newdawn.slick.opengl.Texture; + +import java.util.HashMap; + +public class Human { + + // basic colours + static float black[] = {0.0f, 0.0f, 0.0f, 1.0f}; + static float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; + + static float grey[] = {0.5f, 0.5f, 0.5f, 1.0f}; + static float spot[] = {0.1f, 0.1f, 0.1f, 0.5f}; + + // primary colours + static float red[] = {1.0f, 0.0f, 0.0f, 1.0f}; + static float green[] = {0.0f, 1.0f, 0.0f, 1.0f}; + static float blue[] = {0.0f, 0.0f, 1.0f, 1.0f}; + + // secondary colours + static float yellow[] = {1.0f, 1.0f, 0.0f, 1.0f}; + static float magenta[] = {1.0f, 0.0f, 1.0f, 1.0f}; + static float cyan[] = {0.0f, 1.0f, 1.0f, 1.0f}; + + // other colours + static float orange[] = {1.0f, 0.5f, 0.0f, 1.0f, 1.0f}; + static float brown[] = {0.5f, 0.25f, 0.0f, 1.0f, 1.0f}; + static float dkgreen[] = {0.0f, 0.5f, 0.0f, 1.0f, 1.0f}; + static float pink[] = {1.0f, 0.6f, 0.6f, 1.0f, 1.0f}; + + private HashMap textures; + + public Human(HashMap textures) { + this.textures = textures; + } + + // Implement using notes in Animation lecture + public void DrawHuman(float delta, boolean GoodAnimation) { + float theta = (float) (delta * 2 * Math.PI) * 8; + //a variable for anim sync + float LimbRotation; + //two animation + if (GoodAnimation) { + LimbRotation = (float) Math.cos(theta) * 60; + } else { + LimbRotation = 0; + } + + //a sphere for drawing + Sphere sphere = new Sphere(); + //a sphere with texture + TexSphere texSphere = new TexSphere(); + //a cylinder for drawing + Cylinder cylinder = new Cylinder(); + + //Start to draw + GL11.glPushMatrix(); + { + // move to pelvis + GL11.glTranslatef(0.0f, 0.5f, 0.0f); + //set up TEXTURE + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + //bind a color texture + Color.white.bind(); + textures.get("wool_pink").bind(); + //Enable TEXTURE + GL11.glEnable(GL11.GL_TEXTURE_2D); + //set texture Parameters + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.5f, 32, 32, textures.get("wool_pink")); + //Draw finish Disable TEXTURE + GL11.glDisable(GL11.GL_TEXTURE_2D); + + +// sphere.DrawSphere(0.5f, 32, 32); // pelvis sphere + + // chest + GL11.glColor3f(green[0], green[1], green[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(green)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.5f, 0.0f); // move to chest + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); //bind color + //bind texture + textures.get("tnt_side").bind(); //set texture + //Enable TEXTURE + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.5f, 32, 32, textures.get("tnt_side")); + GL11.glDisable(GL11.GL_TEXTURE_2D); //disable texture + + +// sphere.DrawSphere(0.5f, 32, 32);// chest sphere + GL11.glRotatef((float) (LimbRotation * 0.2), 0.0f, 0.0f, 1.0f); +// GL11.glRotatef((float) (LimbRotation * 3), 1f, 1f, 0f); + + // neck + GL11.glColor3f(orange[0], orange[1], orange[2]); //set color + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(orange)); //set material render mode + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.0f); + GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f); + // GL11.glRotatef(45.0f,0.0f,1.0f,0.0f); + cylinder.DrawCylinder(0.15f, 0.7f, 32); + + + // head + GL11.glColor3f(red[0], red[1], red[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(red)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 1.0f); + + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("awesomeface").bind(); //set texture + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.5f, 32, 32, textures.get("awesomeface")); + GL11.glDisable(GL11.GL_TEXTURE_2D); + + +// sphere.DrawSphere(0.5f, 32, 32); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + + + // left shoulder + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glRotatef((float) (LimbRotation * 0.5), 0f, 1f, 0f); + + GL11.glTranslatef(0.5f, 0.4f, 0.0f); + //set texture Parameter + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_stone").bind(); //set texture + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.25f, 32, 32, textures.get("default_stone")); + GL11.glDisable(GL11.GL_TEXTURE_2D); +// sphere.DrawSphere(0.25f, 32, 32); + + + // left arm + GL11.glColor3f(orange[0], orange[1], orange[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(orange)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.0f); + GL11.glRotatef(20, 0f, 0f, 1f); + GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f); + + + GL11.glRotatef(LimbRotation, 1.0f, 0.0f, 0.0f); + // GL11.glRotatef(27.5f,0.0f,1.0f,0.0f); + cylinder.DrawCylinder(0.15f, 0.7f, 32); + + + // left elbow + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glRotatef((float) (LimbRotation * -0.5), 0f, 0f, 1f); + GL11.glTranslatef(0.0f, 0.0f, 0.75f); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_stone").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.2f, 32, 32, textures.get("default_stone")); + GL11.glDisable(GL11.GL_TEXTURE_2D); +// sphere.DrawSphere(0.2f, 32, 32); + + //left forearm + GL11.glColor3f(orange[0], orange[1], orange[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(orange)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.0f); + GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f); + // GL11.glRotatef(90.0f,0.0f,1.0f,0.0f); + cylinder.DrawCylinder(0.1f, 0.7f, 32); + + // left hand + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.75f); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_stone").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.2f, 32, 32, textures.get("default_stone")); + GL11.glDisable(GL11.GL_TEXTURE_2D); +// sphere.DrawSphere(0.2f, 32, 32); + + + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + + + // to chest + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glRotatef((float) (LimbRotation * 0.5), 0f, 1f, 0f); + + GL11.glTranslatef(-0.5f, 0.4f, 0.0f); // move to right arm + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_stone").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.25f, 32, 32, textures.get("default_stone")); + GL11.glDisable(GL11.GL_TEXTURE_2D); +// sphere.DrawSphere(0.25f, 32, 32); + + + // right arm + GL11.glColor3f(orange[0], orange[1], orange[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(orange)); + GL11.glPushMatrix(); + { + GL11.glRotatef(-20, 0f, 0f, 1f); + GL11.glTranslatef(0.0f, 0.0f, 0.0f); + GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f); + + + GL11.glRotatef(-LimbRotation, 1.0f, 0.0f, 0.0f); + // GL11.glRotatef(27.5f,0.0f,1.0f,0.0f); + cylinder.DrawCylinder(0.15f, 0.7f, 32); + + + // right elbow + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glRotatef((float) (LimbRotation * -0.5), 0f, 0f, 1f); + GL11.glTranslatef(0.0f, 0.0f, 0.75f); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_stone").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.2f, 32, 32, textures.get("default_stone")); + GL11.glDisable(GL11.GL_TEXTURE_2D); +// sphere.DrawSphere(0.2f, 32, 32); + + //right forearm + GL11.glColor3f(orange[0], orange[1], orange[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(orange)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.0f); + GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f); + // GL11.glRotatef(90.0f,0.0f,1.0f,0.0f); + cylinder.DrawCylinder(0.1f, 0.7f, 32); + + // right hand + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.75f); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_stone").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.2f, 32, 32, textures.get("default_stone")); + GL11.glDisable(GL11.GL_TEXTURE_2D); +// sphere.DrawSphere(0.2f, 32, 32); + + + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + + //now chest + + + } + GL11.glPopMatrix(); +// GL11.glRotatef(LimbRotation * 3, 0.0f, 1.0f, 0.0f); +// GL11.glRotatef((float) (LimbRotation * -0.2), 0.0f, 1.0f, 0.0f); + + + // pelvis + // left hip + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.5f, -0.2f, 0.0f); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_cobble").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.25f, 32, 32, textures.get("default_cobble")); + GL11.glDisable(GL11.GL_TEXTURE_2D); +// sphere.DrawSphere(0.25f, 32, 32); + + + // left high leg + GL11.glColor3f(orange[0], orange[1], orange[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(orange)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.0f); + GL11.glRotatef(0.0f, 0.0f, 0.0f, 0.0f); + + + GL11.glRotatef((-LimbRotation / 2) + 90, 1.0f, 0.0f, 0.0f); + // GL11.glRotatef(90.0f,1.0f,0.0f,0.0f); + cylinder.DrawCylinder(0.15f, 0.7f, 32); + + + // left knee + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.75f); + GL11.glRotatef(0.0f, 0.0f, 0.0f, 0.0f); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_cobble").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.25f, 32, 32, textures.get("default_cobble")); + GL11.glDisable(GL11.GL_TEXTURE_2D); +// sphere.DrawSphere(0.25f, 32, 32); + + //left low leg + GL11.glColor3f(orange[0], orange[1], orange[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(orange)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.0f); + // GL11.glRotatef(120.0f,1.0f,0.0f,0.0f); + // GL11.glRotatef(0.0f,0.0f,0.0f,0.0f); + cylinder.DrawCylinder(0.15f, 0.7f, 32); + + // left foot + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.75f); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_cobble").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.3f, 32, 32, textures.get("default_cobble")); + GL11.glDisable(GL11.GL_TEXTURE_2D); + +// sphere.DrawSphere(0.3f, 32, 32); + + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + + // pelvis + // right hip + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(-0.5f, -0.2f, 0.0f); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_cobble").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.25f, 32, 32, textures.get("default_cobble")); + GL11.glDisable(GL11.GL_TEXTURE_2D); + +// sphere.DrawSphere(0.25f, 32, 32); + + + // right high leg + GL11.glColor3f(orange[0], orange[1], orange[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(orange)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.0f); + GL11.glRotatef(0.0f, 0.0f, 0.0f, 0.0f); + + + GL11.glRotatef((LimbRotation / 2) + 90, 1.0f, 0.0f, 0.0f); + // GL11.glRotatef(90.0f,1.0f,0.0f,0.0f); + cylinder.DrawCylinder(0.15f, 0.7f, 32); + + + // right knee + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.75f); + GL11.glRotatef(0.0f, 0.0f, 0.0f, 0.0f); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_cobble").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.25f, 32, 32, textures.get("default_cobble")); + GL11.glDisable(GL11.GL_TEXTURE_2D); +// sphere.DrawSphere(0.25f, 32, 32); + + //right low leg + GL11.glColor3f(orange[0], orange[1], orange[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(orange)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.0f); + // GL11.glRotatef(120.0f,1.0f,0.0f,0.0f); + // GL11.glRotatef(0.0f,0.0f,0.0f,0.0f); + cylinder.DrawCylinder(0.15f, 0.7f, 32); + + // left foot + GL11.glColor3f(blue[0], blue[1], blue[2]); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, Utils.ConvertForGL(blue)); + GL11.glPushMatrix(); + { + GL11.glTranslatef(0.0f, 0.0f, 0.75f); + GL11.glTexParameteri( + GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, + GL11.GL_REPEAT); + Color.white.bind(); + textures.get("default_cobble").bind(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + texSphere.DrawTexSphere(0.3f, 32, 32, textures.get("default_cobble")); + GL11.glDisable(GL11.GL_TEXTURE_2D); +// sphere.DrawSphere(0.3f, 32, 32); + + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + + } + GL11.glPopMatrix(); + + } + + + } + + +} + + /* + + +} + + */ + \ No newline at end of file diff --git a/src/objects3D/Sphere.java b/src/objects3D/Sphere.java new file mode 100644 index 0000000..96245cf --- /dev/null +++ b/src/objects3D/Sphere.java @@ -0,0 +1,87 @@ +package objects3D; + +import org.lwjgl.opengl.GL11; + +public class Sphere { + + + public Sphere() { + + } + + // Implement using notes and examine Tetrahedron to aid in the coding look at lecture 7 , 7b and 8 + // 7b should be your primary source, we will cover more about circles in later lectures to understand why the code works + public void DrawSphere(float radius, float nSlices, float nSegments) { + //Constant PI to use when drawing + final float pi = (float) Math.PI; + + //From -pi to pi, this inctheta is the angle of each piece horizontally + final float inctheta = (float) ((2.0f * Math.PI) / nSlices); + + //From -pi/2 to pi/2, this incphi is the angle of each piece vertically + final float incphi = (float) (Math.PI / nSegments); + + //INIT GL + //GL_QUADS draws quadrangle + GL11.glBegin(GL11.GL_QUADS); + + //first loop is the horizontal loop + for (float theta = -pi; theta < pi; theta += inctheta) { + //second loop is the vertical loop + for (float phi = -(pi / 2.0f); phi < (pi / 2.0f); phi += incphi) { + //next angle vertically + float next_phi = phi + incphi; + + //next angle horizontally + float next_theta = theta + inctheta; + + //point 1, left lower point + float x1 = (float) (radius * Math.cos(phi) * Math.cos(theta)); + float y1 = (float) (radius * Math.cos(phi) * Math.sin(theta)); + float z1 = (float) (radius * Math.sin(phi)); + + //point 2, left upper point + float x2 = (float) (radius * Math.cos(next_phi) * Math.cos(theta)); + float y2 = (float) (radius * Math.cos(next_phi) * Math.sin(theta)); + float z2 = (float) (radius * Math.sin(next_phi)); + + //point 3, right lower point + float x3 = (float) (radius * Math.cos(phi) * Math.cos(next_theta)); + float y3 = (float) (radius * Math.cos(phi) * Math.sin(next_theta)); + float z3 = (float) (radius * Math.sin(phi)); + + //point 4, right upper point + float x4 = (float) (radius * Math.cos(next_phi) * Math.cos(next_theta)); + float y4 = (float) (radius * Math.cos(next_phi) * Math.sin(next_theta)); + float z4 = (float) (radius * Math.sin(next_phi)); + + //here the normal is the direction of this vector. + //normal of point 1 + GL11.glNormal3f(x1, y1, z1); + //point 1 + GL11.glVertex3f(x1, y1, z1); + + //normal of point 2 + GL11.glNormal3f(x2, y2, z2); + //point 2 + GL11.glVertex3f(x2, y2, z2); + + //normal of point 3 + GL11.glNormal3f(x4, y4, z4); + //point 3 + GL11.glVertex3f(x4, y4, z4); + + //normal of point 4 + GL11.glNormal3f(x3, y3, z3); + //point 4 + GL11.glVertex3f(x3, y3, z3); + + + } + } + //END GL + GL11.glEnd(); + } +} + + \ No newline at end of file diff --git a/src/objects3D/TexCube.java b/src/objects3D/TexCube.java new file mode 100644 index 0000000..08931dc --- /dev/null +++ b/src/objects3D/TexCube.java @@ -0,0 +1,163 @@ +package objects3D; + +import GraphicsObjects.Point4f; +import GraphicsObjects.Vector4f; +import org.lwjgl.opengl.GL11; + +public class TexCube { + + + public TexCube() { + + } + + // Implement using notes and looking at TexSphere + public void DrawTexCube() { + + //a cube have 8 vertices so this is the coordinates of the vertices + Point4f vertices[] = {new Point4f(-1.0f, -1.0f, -1.0f, 0.0f), + new Point4f(-1.0f, -1.0f, 1.0f, 0.0f), + new Point4f(-1.0f, 1.0f, -1.0f, 0.0f), + new Point4f(-1.0f, 1.0f, 1.0f, 0.0f), + new Point4f(1.0f, -1.0f, -1.0f, 0.0f), + new Point4f(1.0f, -1.0f, 1.0f, 0.0f), + new Point4f(1.0f, 1.0f, -1.0f, 0.0f), + new Point4f(1.0f, 1.0f, 1.0f, 0.0f)}; + + //each face of the cube consists four edges, there are 6 faces in total + //so, this array has 6 element, each element contains the related edges + int faces[][] = {{1, 5, 4, 0}, + {2, 6, 4, 0}, + {3, 2, 0, 1}, + {6, 7, 5, 4}, + {7, 3, 1, 5}, + {7, 6, 2, 3}}; + + //this array is used to calculate the normal for lighting +// int n_faces[][] = {{0, 4, 5, 1}, +// {0, 2, 6, 4}, +// {0, 1, 3, 2}, +// {4, 6, 7, 5}, +// {1, 5, 7, 3}, +// {2, 3, 7, 6}}; + + + //INIT GL + GL11.glBegin(GL11.GL_QUADS); + + for (int face = 0; face < 6; face++) { // per face + //a new way of calculating the normal vector by letting the face center minus the model center + Point4f face_center = new Point4f( + (vertices[faces[face][0]].x + vertices[faces[face][2]].x) / 2, + (vertices[faces[face][0]].y + vertices[faces[face][2]].y) / 2, + (vertices[faces[face][0]].z + vertices[faces[face][2]].z) / 2, + 0 + ); + Point4f model_center = new Point4f(0, 0, 0, 0); + Vector4f normal = face_center.MinusPoint(model_center); + + //calculate the normal vector using cross product which returns a vector + //that is perpendicular to these two vector +// Vector4f v = vertices[n_faces[face][1]].MinusPoint(vertices[n_faces[face][0]]); +// Vector4f w = vertices[n_faces[face][3]].MinusPoint(vertices[n_faces[face][0]]); +// Vector4f normal = v.cross(w).Normal(); + GL11.glNormal3f(normal.x, normal.y, normal.z); + + //top left + GL11.glTexCoord2f(0f, 1f); + GL11.glVertex3f(vertices[faces[face][0]].x, vertices[faces[face][0]].y, vertices[faces[face][0]].z); + + //top right + GL11.glTexCoord2f(1f, 1f); + GL11.glVertex3f(vertices[faces[face][1]].x, vertices[faces[face][1]].y, vertices[faces[face][1]].z); + + //right bottom + GL11.glTexCoord2f(1f, 0f); + GL11.glVertex3f(vertices[faces[face][2]].x, vertices[faces[face][2]].y, vertices[faces[face][2]].z); + + //left bottom + GL11.glTexCoord2f(0f, 0f); + GL11.glVertex3f(vertices[faces[face][3]].x, vertices[faces[face][3]].y, vertices[faces[face][3]].z); + } // per face + + GL11.glEnd(); + + + } + + public void DrawTexCube(float number) { + + //a cube have 8 vertices so this is the coordinates of the vertices + Point4f vertices[] = {new Point4f(-1.0f, -1.0f, -1.0f, 0.0f), + new Point4f(-1.0f, -1.0f, 1.0f, 0.0f), + new Point4f(-1.0f, 1.0f, -1.0f, 0.0f), + new Point4f(-1.0f, 1.0f, 1.0f, 0.0f), + new Point4f(1.0f, -1.0f, -1.0f, 0.0f), + new Point4f(1.0f, -1.0f, 1.0f, 0.0f), + new Point4f(1.0f, 1.0f, -1.0f, 0.0f), + new Point4f(1.0f, 1.0f, 1.0f, 0.0f)}; + + //each face of the cube consists four edges, there are 6 faces in total + //so, this array has 6 element, each element contains the related edges + int faces[][] = {{1, 5, 4, 0}, + {2, 6, 4, 0}, + {3, 2, 0, 1}, + {6, 7, 5, 4}, + {7, 3, 1, 5}, + {7, 6, 2, 3}}; + + + GL11.glBegin(GL11.GL_QUADS); + + + for (int face = 0; face < 6; face++) { // per face + + //a new way of calculating the normal vector by letting the face center minus the model center + Point4f face_center = new Point4f( + (vertices[faces[face][0]].x + vertices[faces[face][2]].x) / 2, + (vertices[faces[face][0]].y + vertices[faces[face][2]].y) / 2, + (vertices[faces[face][0]].z + vertices[faces[face][2]].z) / 2, + 0 + ); + Point4f model_center = new Point4f(0, 0, 0, 0); + Vector4f normal = face_center.MinusPoint(model_center); + + //calculate the normal vector using cross product which returns a vector + //that is perpendicular to these two vector +// Vector4f v = vertices[n_faces[face][1]].MinusPoint(vertices[n_faces[face][0]]); +// Vector4f w = vertices[n_faces[face][3]].MinusPoint(vertices[n_faces[face][0]]); +// Vector4f normal = v.cross(w).Normal(); + GL11.glNormal3f(normal.x, normal.y, normal.z); + + + //number indicate the repeating times + //top left + GL11.glTexCoord2f(0f, number); + GL11.glVertex3f(vertices[faces[face][0]].x, vertices[faces[face][0]].y, vertices[faces[face][0]].z); + + //top right + GL11.glTexCoord2f(number, number); + GL11.glVertex3f(vertices[faces[face][1]].x, vertices[faces[face][1]].y, vertices[faces[face][1]].z); + + //right bottom + GL11.glTexCoord2f(number, 0f); + GL11.glVertex3f(vertices[faces[face][2]].x, vertices[faces[face][2]].y, vertices[faces[face][2]].z); + + //left bottom + GL11.glTexCoord2f(0f, 0f); + GL11.glVertex3f(vertices[faces[face][3]].x, vertices[faces[face][3]].y, vertices[faces[face][3]].z); + } // per face + + GL11.glEnd(); + } + + +} + + /* + + +} + + */ + \ No newline at end of file diff --git a/src/objects3D/TexSphere.java b/src/objects3D/TexSphere.java new file mode 100644 index 0000000..3fdd562 --- /dev/null +++ b/src/objects3D/TexSphere.java @@ -0,0 +1,89 @@ +package objects3D; + +import org.lwjgl.opengl.GL11; +import org.newdawn.slick.opengl.Texture; + +public class TexSphere { + static float red[] = {1.0f, 0.0f, 0.0f, 1.0f}; + static float green[] = {0.0f, 1.0f, 0.0f, 1.0f}; + static float blue[] = {0.0f, 0.0f, 1.0f, 1.0f}; + static float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; + + public TexSphere() { + + } + + // Implement using notes and examine Tetrahedron to aid in the coding look at lecture 7 , 7b and 8 + // 7b should be your primary source, we will cover more about circles in later lectures to understand why the code works + public void DrawTexSphere(float radius, float nSlices, float nSegments, Texture myTexture) { + float x, y, z; + float s, t; // texture coordinates + + //angle for drawing the sphere + //From -pi to pi, this inctheta is the angle of each piece horizontally + float inctheta = (float) ((2.0f * Math.PI) / nSlices); + //From -pi/2 to pi/2, this incphi is the angle of each piece vertically + float incphi = (float) (Math.PI / nSegments); + + //INIT GL + //GL_QUADS draws quadrangle + GL11.glBegin(GL11.GL_QUADS); + //first loop is the horizontal loop + for (float theta = (float) -Math.PI; theta < Math.PI; theta += inctheta) { + //second loop is the vertical loop + for (float phi = (float) -(Math.PI / 2.0f); phi < (Math.PI / 2.0f); phi += incphi) { + + //point 1 + x = (float) (Math.cos(phi) * Math.cos(theta) * radius); + y = (float) (Math.cos(phi) * Math.sin(theta) * radius); + z = (float) (Math.sin(phi) * radius); + + //texture coordinate + t = (float) (phi / (float) Math.PI) + 0.5f; + s = (float) (theta / Math.PI * 2.0f) + 0.5f; + + //GL11.glTexCoord2f(s,t); // should be here but seems to be a bug in LWJGL + GL11.glNormal3f(x, y, z); + GL11.glVertex3f(x, y, z); + + //point 2 + x = (float) (Math.cos(phi) * Math.cos(theta + inctheta) * radius); + y = (float) (Math.cos(phi) * Math.sin(theta + inctheta) * radius); + z = (float) (Math.sin(phi) * radius); + t = (float) (((float) phi / (float) Math.PI) + 0.5f); + s = (float) ((((float) theta + inctheta) / ((float) Math.PI * 2.0f))) + 0.5f; + + //texture coordinate + GL11.glTexCoord2f(s, t); + + GL11.glNormal3f(x, y, z); //Mistake in previous version fixed ( abey 11/1/2018) + GL11.glVertex3f(x, y, z); // Top Right corner + + //point 3 + x = (float) (Math.cos(phi + incphi) * Math.cos(theta + inctheta) * radius); + y = (float) (Math.cos(phi + incphi) * Math.sin(theta + inctheta) * radius); + z = (float) (Math.sin(phi + incphi) * radius); + t = (float) ((((float) phi + incphi) / (float) Math.PI) + 0.5f); + s = (float) ((((float) theta + inctheta) / ((float) Math.PI * 2.0f)) + 0.5f); + + GL11.glTexCoord2f(s, t); + GL11.glNormal3f(x, y, z); + GL11.glVertex3f(x, y, z); + + //point 4 + x = (float) (Math.cos(phi + incphi) * Math.cos(theta) * radius); + y = (float) (Math.cos(phi + incphi) * Math.sin(theta) * radius); + z = (float) (Math.sin(phi + incphi) * radius); + t = (float) ((((float) phi + incphi) / (float) Math.PI) + 0.5f); + s = (float) (((float) theta / ((float) Math.PI * 2.0f)) + 0.5f); + + //set texture coordinate + GL11.glTexCoord2f(s, t); + GL11.glNormal3f(x, y, z); + GL11.glVertex3f(x, y, z); + } + } + GL11.glEnd(); + } +} + \ No newline at end of file