From 2215a509a3dcd75e8b02967bee7a5eb35af08ae9 Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Fri, 6 Jan 2017 19:16:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BE=D1=82=20=D1=82=D0=B0=D0=BA-=D1=82?= =?UTF-8?q?=D0=BE=20=D0=BB=D1=83=D1=87=D1=88=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 18436 -> 18436 bytes Applications.txt | 50 ++++++++++++++ Applications/OCGL/OCGLTest.lua | 22 +++---- lib/.DS_Store | Bin 10244 -> 10244 bytes lib/{WildCatEngine => PolyCatEngine}/Main.lua | 62 +++++++++--------- .../PostProcessing.lua | 0 6 files changed, 92 insertions(+), 42 deletions(-) rename lib/{WildCatEngine => PolyCatEngine}/Main.lua (91%) rename lib/{WildCatEngine => PolyCatEngine}/PostProcessing.lua (100%) diff --git a/.DS_Store b/.DS_Store index d19e94d54c02884dd053bec16e4ee539e233fcfc..b02ba3fc9988adda95536eb3e9722b3576210a52 100644 GIT binary patch delta 508 zcmXw#&1(}u7>D2wFc1 zf=Y=lo?O@e ztPz>Nzl{HlE=UZBFyGN1rn|O;_UgV45f_Q@qfAa73p~GE4^9Ps)v)+(IAyowe~y_} zG?|iO%yaAhaK&r&p7~xk+Rd_*l*e05f7Mr~r|a!_MUNCtEx72L?%YE=BZPA%D0^nj z_&>U)SIC1C?n!^b^b9rDr$Fo03wij0U#$g|vN_mFRk(4JkVlG@Qc2m>EPChS@PoB< zu}sOlt{-g~~AxJIO2XUIsY82%|U(UcjY@hfkTaRNDfV inB*$gxUK}IX>fS6rZS@golQlP&1$jL4GSSft0fY|w9!_mr4`fGFSKcPgssU&ljuRv z_|c={;-Ewn#hX}^O7NtAfCn!^>B+O;K@r4{i{Nfn=P=CsJoCOUzh}wAl82SgnmVG$ zX>)U1je6?;_wvR+Jzc$HOpZkIvadHI%^idC8&5aCP`VoBS`Uls3CdrSQ+BZ-Cabn{ z))98c(c^j_AtwVpUlaZv%B)}CPI-|O>ds{mjz}_#@;WV?bKHNeDV8SOrZeT@f+&a6 zcCsPDC+OTIQL8)E-EOE3vkcLYqQ^?rN=3MhdMIc0eT2Uwr-S8(i}l9TdEp9Me$Zm7 z*YY7pOKZwU<&*MN`L6s_eks2JsED8&Q6yks3oPuy5cXggSscJYjN=d{F^f4I#|g~C z!6M42;3BS~i5s|yTeye&XyE~#;T7KCt^8pw!f4MY*F(P7&1NF5$F}t|#uW`gd@(;d zBWYN~kB_UJlBJAv5DxDO-43)(d3Wggv_Vij61rLDQ%+F6E-Z7#XaLPg_&I58po9$M zyp|H20Xb`C< O%Sq}mZ7!4T;{pI|pBl^n delta 104 zcmZn(XbIRLC%M^6T8D{~mm!=XlOcy8WwW}Z3?n;~GucZ@0nRRzQirqWBeBmSv4116 NHKi3dm&x{V0RT2$8Y=(* diff --git a/lib/WildCatEngine/Main.lua b/lib/PolyCatEngine/Main.lua similarity index 91% rename from lib/WildCatEngine/Main.lua rename to lib/PolyCatEngine/Main.lua index 58b4b997..f6ce965d 100644 --- a/lib/WildCatEngine/Main.lua +++ b/lib/PolyCatEngine/Main.lua @@ -7,12 +7,12 @@ local matrix = require("matrix") local OCGL = require("OpenComputersGL/Main") local renderer = require("OpenComputersGL/Renderer") local materials = require("OpenComputersGL/Materials") -local postProcessing = require("WildCatEngine/PostProcessing") -local wildCatEngine = {} +local postProcessing = require("PolyCatEngine/PostProcessing") +local polyCatEngine = {} -------------------------------------------------------- Universal object methods -------------------------------------------------------- -function wildCatEngine.newPivotPoint(vector3Position) +function polyCatEngine.newPivotPoint(vector3Position) return { position = vector3Position, axis = { @@ -41,10 +41,10 @@ local function pushMeshToRenderQueue(mesh) end -function wildCatEngine.newMesh(vector3Position, vertices, triangles, material) +function polyCatEngine.newMesh(vector3Position, vertices, triangles, material) local mesh = {} - -- mesh.pivotPoint = wildCatEngine.newPivotPoint(vector3Position) + -- mesh.pivotPoint = polyCatEngine.newPivotPoint(vector3Position) mesh.vertices = vertices for vertexIndex = 1, #mesh.vertices do mesh.vertices[vertexIndex][1], mesh.vertices[vertexIndex][2], mesh.vertices[vertexIndex][3] = mesh.vertices[vertexIndex][1] + vector3Position[1], mesh.vertices[vertexIndex][2] + vector3Position[2], mesh.vertices[vertexIndex][3] + vector3Position[3] @@ -66,10 +66,10 @@ local function pushLineToRenderQueue(line) ) end -function wildCatEngine.newLine(vector3Position, vector3Vertex1, vector3Vertex2, color) +function polyCatEngine.newLine(vector3Position, vector3Vertex1, vector3Vertex2, color) local line = {} - -- line.pivotPoint = wildCatEngine.newPivotPoint(vector3Position) + -- line.pivotPoint = polyCatEngine.newPivotPoint(vector3Position) line.vertices = { vector3Vertex1, vector3Vertex2 } line.color = color line.pushToRenderQueue = pushLineToRenderQueue @@ -87,7 +87,7 @@ local function pushFloatingTextToRenderQueue(floatingText) ) end -function wildCatEngine.newFloatingText(vector3Position, color, text) +function polyCatEngine.newFloatingText(vector3Position, color, text) local floatingText = {} floatingText.position = vector3Position @@ -100,9 +100,9 @@ end -------------------------------------------------------- Plane object -------------------------------------------------------- -function wildCatEngine.newPlane(vector3Position, width, height, material) +function polyCatEngine.newPlane(vector3Position, width, height, material) local halfWidth, halfHeight = width / 2, height / 2 - return wildCatEngine.newMesh( + return polyCatEngine.newMesh( vector3Position, { vector.newVector3(-halfWidth, 0, -halfHeight), @@ -132,9 +132,9 @@ end 1######4 4######5 5######8 8######1 2######3 1######4 ]] -function wildCatEngine.newCube(vector3Position, size, material) +function polyCatEngine.newCube(vector3Position, size, material) local halfSize = size / 2 - return wildCatEngine.newMesh( + return polyCatEngine.newMesh( vector3Position, { -- (1-2-3-4) @@ -174,11 +174,11 @@ end -------------------------------------------------------- Grid lines -------------------------------------------------------- -function wildCatEngine.newGridLines(vector3Position, axisRange, gridRange, gridRangeStep) +function polyCatEngine.newGridLines(vector3Position, axisRange, gridRange, gridRangeStep) local objects = {} -- Grid for x = -gridRange, gridRange, gridRangeStep do - table.insert(objects, 1, wildCatEngine.newLine( + table.insert(objects, 1, polyCatEngine.newLine( vector.newVector3(vector3Position[1] + x, vector3Position[2], vector3Position[3]), vector.newVector3(0, 0, -gridRange), vector.newVector3(0, 0, gridRange), @@ -186,7 +186,7 @@ function wildCatEngine.newGridLines(vector3Position, axisRange, gridRange, gridR )) end for z = -gridRange, gridRange, gridRangeStep do - table.insert(objects, 1, wildCatEngine.newLine( + table.insert(objects, 1, polyCatEngine.newLine( vector.newVector3(vector3Position[1], vector3Position[2], vector3Position[3] + z), vector.newVector3(-gridRange, 0, 0), vector.newVector3(gridRange, 0, 0), @@ -195,19 +195,19 @@ function wildCatEngine.newGridLines(vector3Position, axisRange, gridRange, gridR end -- Axis - table.insert(objects, wildCatEngine.newLine( + table.insert(objects, polyCatEngine.newLine( vector3Position, vector.newVector3(-axisRange, -1, 0), vector.newVector3(axisRange, -1, 0), renderer.colors.axis.x )) - table.insert(objects, wildCatEngine.newLine( + table.insert(objects, polyCatEngine.newLine( vector3Position, vector.newVector3(0, -axisRange, 0), vector.newVector3(0, axisRange, 0), renderer.colors.axis.y )) - table.insert(objects, wildCatEngine.newLine( + table.insert(objects, polyCatEngine.newLine( vector3Position, vector.newVector3(0, -1, -axisRange), vector.newVector3(0, -1, axisRange), @@ -264,7 +264,7 @@ local function cameraSetFOV(camera, FOV) return camera end -function wildCatEngine.newCamera(vector3Position, FOV, nearClippingSurface, farClippingSurface) +function polyCatEngine.newCamera(vector3Position, FOV, nearClippingSurface, farClippingSurface) local camera = {} camera.projectionEnabled = true @@ -323,7 +323,7 @@ local function sceneRender(scene) return scene end -function wildCatEngine.newScene(backgroundColor) +function polyCatEngine.newScene(backgroundColor) local scene = {} scene.renderMode = renderer.renderModes.material @@ -334,7 +334,7 @@ function wildCatEngine.newScene(backgroundColor) scene.addObjects = sceneAddObjects scene.render = sceneRender - scene.camera = wildCatEngine.newCamera(vector.newVector3(0, 0, 0), math.rad(90), 1, 100) + scene.camera = polyCatEngine.newCamera(vector.newVector3(0, 0, 0), math.rad(90), 1, 100) return scene end @@ -350,7 +350,7 @@ end -- end -- -- В случае попадания лучика этот метод вернет сам треугольник, а также дистанцию до его плоскости --- function wildCatEngine.triangleRaycast(vector3RayStart, vector3RayEnd) +-- function polyCatEngine.triangleRaycast(vector3RayStart, vector3RayEnd) -- local minimalDistance, closestTriangleIndex -- for triangleIndex = 1, #OCGL.triangles do -- -- Это вершины треугольника @@ -408,12 +408,12 @@ end -- return closestTriangleIndex, minimalDistance -- end --- -- function wildCatEngine.sceneRaycast(scene, vector3RayStart, vector3RayEnd) +-- -- function polyCatEngine.sceneRaycast(scene, vector3RayStart, vector3RayEnd) -- -- local closestObjectIndex, closestTriangleIndex, minimalDistance -- -- for objectIndex = 1, #scene.objects do -- -- if scene.objects[objectIndex].triangles then --- -- local triangleIndex, distance = wildCatEngine.meshRaycast(scene.objects[objectIndex], vector3RayStart, vector3RayEnd) +-- -- local triangleIndex, distance = polyCatEngine.meshRaycast(scene.objects[objectIndex], vector3RayStart, vector3RayEnd) -- -- if triangleIndex and (not minimalDistance or distance < minimalDistance ) then -- -- closestObjectIndex, closestTriangleIndex, minimalDistance = objectIndex, triangleIndex, distance -- -- end @@ -425,8 +425,8 @@ end -------------------------------------------------------- Intro -------------------------------------------------------- -function wildCatEngine.newPolyCatMesh(vector3Position, size) - return wildCatEngine.newMesh( +function polyCatEngine.newPolyCatMesh(vector3Position, size) + return polyCatEngine.newMesh( vector3Position, { vector.newVector3(-1.0 * size, 0.8 * size, 0.3 * size), @@ -465,11 +465,11 @@ function wildCatEngine.newPolyCatMesh(vector3Position, size) ) end -function wildCatEngine.intro(vector3Position, size) +function polyCatEngine.intro(vector3Position, size) local GUI = require("GUI") - local scene = wildCatEngine.newScene(0xEEEEEE) - scene:addObject(wildCatEngine.newPolyCatMesh(vector3Position, size)) - scene:addObject(wildCatEngine.newFloatingText(vector.newVector3(vector3Position[1] + 2, vector3Position[2] - size, vector3Position[3] + size * 0.1), 0xBBBBBB, "Powered by PolyCat Engine™")) + local scene = polyCatEngine.newScene(0xEEEEEE) + scene:addObject(polyCatEngine.newPolyCatMesh(vector3Position, size)) + scene:addObject(polyCatEngine.newFloatingText(vector.newVector3(vector3Position[1] + 2, vector3Position[2] - size, vector3Position[3] + size * 0.1), 0xBBBBBB, "Powered by PolyCat Engine™")) local from, to, speed = -30, 20, 4 local transparency, transparencyStep = 0, 100 / math.abs(to - from) * speed @@ -503,4 +503,4 @@ end -------------------------------------------------------- Zalupa -------------------------------------------------------- -return wildCatEngine +return polyCatEngine diff --git a/lib/WildCatEngine/PostProcessing.lua b/lib/PolyCatEngine/PostProcessing.lua similarity index 100% rename from lib/WildCatEngine/PostProcessing.lua rename to lib/PolyCatEngine/PostProcessing.lua