Skip to content

Commit

Permalink
Merge pull request #667 from brickify/release/v0.10.1
Browse files Browse the repository at this point in the history
Release/v0.10.1
  • Loading branch information
ad-si committed Jun 25, 2015
2 parents 801d5c9 + 5e9bb4e commit 8b60afa
Show file tree
Hide file tree
Showing 45 changed files with 1,524 additions and 1,156 deletions.
2 changes: 1 addition & 1 deletion coffeelint.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"level": "ignore"
},
"no_backticks": {
"level": "error"
"level": "warn"
},
"no_debugger": {
"level": "warn"
Expand Down
4 changes: 0 additions & 4 deletions karma.conf.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ module.exports = (config) ->
# whenever any file changes
autoWatch: true

# start these browsers
# available browser launchers: npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome']

# Continuous Integration mode
# if true, Karma captures browsers, runs the tests and exits
singleRun: false
Expand Down
1 change: 0 additions & 1 deletion modelCache/1336affaf837a831f6b580ec75c3b73a

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Brickify",
"version": "0.9.3",
"version": "0.10.1",
"description": "Faster 3D-printing with LEGO bricks",
"keywords": [
"fabrication",
Expand Down Expand Up @@ -73,7 +73,6 @@
"karma-browserify": "^1.0.1",
"karma-chai": "^0.1.0",
"karma-chai-plugins": "^0.2.4",
"karma-chrome-launcher": "^0.1.7",
"karma-cli": "0.0.4",
"karma-mocha": "^0.1.10",
"mocha": "^2.1.0"
Expand Down
Binary file modified public/img/baseplateStud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/partList/partList (26).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/stud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion routes/dataPackets.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ dpStorage = require '../src/server/sync/dataPacketRamStorage'

module.exports.create = (request, response) ->
dpStorage.create()
.then (packet) -> response.status(201).json packet
.then (packet) ->
response
.location('/datapacket/' + packet.id)
.status(201)
.json packet
.catch -> response.status(500).send 'Packet could not be created'

module.exports.exists = (request, response) ->
Expand Down
30 changes: 14 additions & 16 deletions src/client/rendering/Renderer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Renderer
@ssaoTarget.quadScene, @camera, @ssaoBlurTarget.renderTarget, true
)

# Take the ssao values and render a gaussed version on the screen
# Take the SSAO values and render a gaussed version on the screen
@threeRenderer.render(
@ssaoBlurTarget.quadScene, @camera
)
Expand Down Expand Up @@ -146,7 +146,7 @@ class Renderer
not renderTargetHelper.renderTargetHasRightSize(
@pipelineRenderTarget.renderTarget, @threeRenderer
)
# Create the render target that renders everything antialiased to the screen
# Create the render target that renders everything anti-aliased to the screen
shaderParts = []
if @usePipelineFxaa
shaderParts.push new FxaaShaderPart()
Expand All @@ -173,7 +173,7 @@ class Renderer
if @ssaoBlurTarget?
renderTargetHelper.deleteRenderTarget @ssaoBlurTarget, @threeRenderer

# Clone the pipeline Rendertarget:
# Clone the pipeline render target:
# use this render target to create SSAO values out of scene
@ssaoTarget = renderTargetHelper.cloneRenderTarget(
@pipelineRenderTarget,
Expand All @@ -192,15 +192,9 @@ class Renderer
)

setFidelity: (fidelityLevel, availableLevels) =>
if @pipelineEnabled
# Determine whether to use bigger render targets (super sampling)
if fidelityLevel >= availableLevels.indexOf 'PipelineHigh'
@useBigRendertargets = true
else
@useBigRendertargets = false

renderTargetHelper.configureSize @useBigRendertargets
@pipelineEnabled = fidelityLevel >= availableLevels.indexOf 'PipelineLow'

if @pipelineEnabled
# Determine whether to use FXAA
if fidelityLevel >= availableLevels.indexOf 'PipelineMedium'
# Only do something when FXAA is not already used
Expand All @@ -212,20 +206,24 @@ class Renderer
@usePipelineFxaa = false
@pipelineRenderTarget = null

# Determine wether to use SSAO
# Determine whether to use bigger render targets (super sampling)
@useBigRendertargets =
fidelityLevel >= availableLevels.indexOf 'PipelineHigh'

renderTargetHelper.configureSize @useBigRendertargets

# Determine whether to use SSAO
if fidelityLevel >= availableLevels.indexOf 'PipelineUltra'
# Only do something when SSAO is not already used
if not @usePipelineSsao
@usePipelineSsao = true

if @pipelineRenderTarget?
@pipelineRenderTarget.dirty = true
@pipelineRenderTarget?.dirty = true
else
if @usePipelineSsao
@usePipelineSsao = false

if @pipelineRenderTarget?
@pipelineRenderTarget.dirty = true
@pipelineRenderTarget?.dirty = true

addToScene: (node) ->
@scene.add node
Expand Down
2 changes: 1 addition & 1 deletion src/client/rendering/shader/ShaderGenerator.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ShaderGenerator
shaderCode += preMain
shaderCode += '
void main(){
vec4 col = vec4(0.0, 0.0, 0.0, 0.0);\n
vec4 col = vec4(0.0);\n
float currentOpacity = opacity;
\n
' + inMain + '
Expand Down
127 changes: 98 additions & 29 deletions src/client/rendering/shader/ssaoBlurPart.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,109 @@
ShaderPart = require './shaderPart'

class SsaoBlurPart extends ShaderPart
getVertexVariables: ->
return ''

getVertexPreMain: ->
return ''

getVertexInMain: ->
return''

getFragmentVariables: ->
return ''

getFragmentPreMain: ->
return '
float ssaoBlur(vec2 texCoords){
float gaussKernelValues[81];
gaussKernelValues[0] = 0.00839;
gaussKernelValues[1] = 0.00965;
gaussKernelValues[2] = 0.01066;
gaussKernelValues[3] = 0.01132;
gaussKernelValues[4] = 0.01155;
gaussKernelValues[5] = 0.01132;
gaussKernelValues[6] = 0.01066;
gaussKernelValues[7] = 0.00965;
gaussKernelValues[8] = 0.00839;
gaussKernelValues[9] = 0.00965;
gaussKernelValues[10] = 0.01110;
gaussKernelValues[11] = 0.01226;
gaussKernelValues[12] = 0.01302;
gaussKernelValues[13] = 0.01328;
gaussKernelValues[14] = 0.01302;
gaussKernelValues[15] = 0.01226;
gaussKernelValues[16] = 0.01110;
gaussKernelValues[17] = 0.00965;
gaussKernelValues[18] = 0.01066;
gaussKernelValues[19] = 0.01226;
gaussKernelValues[20] = 0.01355;
gaussKernelValues[21] = 0.01439;
gaussKernelValues[22] = 0.01468;
gaussKernelValues[23] = 0.01439;
gaussKernelValues[24] = 0.01355;
gaussKernelValues[25] = 0.01226;
gaussKernelValues[26] = 0.01066;
gaussKernelValues[27] = 0.01132;
gaussKernelValues[28] = 0.01302;
gaussKernelValues[29] = 0.01439;
gaussKernelValues[30] = 0.01528;
gaussKernelValues[31] = 0.01559;
gaussKernelValues[32] = 0.01528;
gaussKernelValues[33] = 0.01439;
gaussKernelValues[34] = 0.01302;
gaussKernelValues[35] = 0.01132;
gaussKernelValues[36] = 0.01155;
gaussKernelValues[37] = 0.01328;
gaussKernelValues[38] = 0.01468;
gaussKernelValues[39] = 0.01559;
gaussKernelValues[40] = 0.01590;
gaussKernelValues[41] = 0.01559;
gaussKernelValues[42] = 0.01468;
gaussKernelValues[43] = 0.01328;
gaussKernelValues[44] = 0.01155;
gaussKernelValues[45] = 0.01132;
gaussKernelValues[46] = 0.01302;
gaussKernelValues[47] = 0.01439;
gaussKernelValues[48] = 0.01528;
gaussKernelValues[49] = 0.01559;
gaussKernelValues[50] = 0.01528;
gaussKernelValues[51] = 0.01439;
gaussKernelValues[52] = 0.01302;
gaussKernelValues[53] = 0.01132;
gaussKernelValues[54] = 0.01066;
gaussKernelValues[55] = 0.01226;
gaussKernelValues[56] = 0.01355;
gaussKernelValues[57] = 0.01439;
gaussKernelValues[58] = 0.01468;
gaussKernelValues[59] = 0.01439;
gaussKernelValues[60] = 0.01355;
gaussKernelValues[61] = 0.01226;
gaussKernelValues[62] = 0.01066;
gaussKernelValues[63] = 0.00965;
gaussKernelValues[64] = 0.01110;
gaussKernelValues[65] = 0.01226;
gaussKernelValues[66] = 0.01302;
gaussKernelValues[67] = 0.01328;
gaussKernelValues[68] = 0.01302;
gaussKernelValues[69] = 0.01226;
gaussKernelValues[70] = 0.01110;
gaussKernelValues[71] = 0.00965;
gaussKernelValues[72] = 0.00839;
gaussKernelValues[73] = 0.00965;
gaussKernelValues[74] = 0.01066;
gaussKernelValues[75] = 0.01132;
gaussKernelValues[76] = 0.01155;
gaussKernelValues[77] = 0.01132;
gaussKernelValues[78] = 0.01066;
gaussKernelValues[79] = 0.00965;
gaussKernelValues[80] = 0.00839;
float dX = 1.0 / texWidth;
float dY = 1.0 / texHeight;
const int kernelSize = 3;
float value = texture2D(tColor, texCoords).r;
for (int x = -kernelSize; x <= kernelSize; x++){
for (int y = -kernelSize; y <= kernelSize; y++){
if (x != 0 && y != 0){
float fx = float(x);
float fy = float(y);
float tx = texCoords.x + fx * dX;
float ty = texCoords.y + fy * dY;
float weight = 1.0 / ((abs(fx) + 0.5) * (abs(fy) + 0.5));
float currentValue = texture2D(tColor, vec2(tx, ty)).r;
value = value * (1.0 - weight) + currentValue * (weight);
}
}
const int kernelSize = 4;
float value = 0.0;
for (int kernelIndex = 0; kernelIndex < 81; kernelIndex++){
float x = mod(float(kernelIndex), float(kernelSize*2+1))
- float(kernelSize);
float y = floor(float(kernelIndex)/float(kernelSize*2+1))
- float(kernelSize);
float tx = texCoords.x + x * dX;
float ty = texCoords.y + y * dY;
float weight = gaussKernelValues[kernelIndex];
float currentValue = texture2D(tColor, vec2(tx, ty)).r;
value = value + currentValue * weight;
}
return value;
Expand Down
48 changes: 18 additions & 30 deletions src/client/rendering/shader/ssaoPart.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
ShaderPart = require './shaderPart'

class SsaoPart extends ShaderPart
getVertexVariables: ->
return ''

getVertexPreMain: ->
return ''

getVertexInMain: ->
return''

getFragmentVariables: ->
return '
uniform sampler2D tRandom;
Expand Down Expand Up @@ -71,29 +62,29 @@ class SsaoPart extends ShaderPart
float depth = linearizeDepth(texture2D( tDepth, texCoords ).r);
vec3 random = normalize(texture2D(tRandom,texCoords * (7.0 + depth)).rgb);
vec3 random = normalize(texture2D(tRandom,texCoords * (7.0 + depth)).rgb);
vec3 position = vec3(texCoords, depth);
vec3 normal = ssaoNormalFromDepth(depth, texCoords);
vec3 position = vec3(texCoords, depth);
vec3 normal = ssaoNormalFromDepth(depth, texCoords);
float radius_depth = radius / depth;
float occlusion = 0.0;
float radius_depth = radius / depth;
float occlusion = 0.0;
for (int i = 0; i < SSAO_SAMPLES; i++){
vec3 ray = radius_depth * reflect(sample_sphere[i], random);
vec3 hemi_ray = position + sign(dot(ray, normal)) * ray;
for (int i = 0; i < SSAO_SAMPLES; i++){
vec3 ray = radius_depth * reflect(sample_sphere[i], random);
vec3 hemi_ray = position + sign(dot(ray, normal)) * ray;
float occ_depth = linearizeDepth(
texture2D(tDepth, clamp(hemi_ray.xy,0.0,1.0)).r
);
float difference = depth - occ_depth;
float occ_depth = linearizeDepth(
texture2D(tDepth, clamp(hemi_ray.xy,0.0,1.0)).r
);
float difference = depth - occ_depth;
occlusion += step(falloff, difference) *
(1.0 - smoothstep(falloff, area, difference));
}\n
occlusion += step(falloff, difference) *
(1.0 - smoothstep(falloff, area, difference));
}\n
float ao = 1.0 - total_strength * occlusion * (1.0 / float(SSAO_SAMPLES));
return clamp(ao + base, 0.0, 1.0);
float ao = 1.0 - total_strength * occlusion * (1.0 / float(SSAO_SAMPLES));
return clamp(ao + base, 0.0, 1.0);
}\n
'

Expand All @@ -104,12 +95,9 @@ class SsaoPart extends ShaderPart
vec3 normal = ssaoNormalFromDepth(ssaoDepth, vUv);
/*normal = normal * 0.5 + 0.5;
col = vec4(normal.rgb, 1.0);*/
col = vec4(normal.rgb, 1.0);*/
col = vec4( ssao, ssao, ssao, 1.0 );
'

#cameraNearPlane: 0.1
#cameraFarPlane: 2500

module.exports = SsaoPart
27 changes: 17 additions & 10 deletions src/client/sync/dataPacketsProxy.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,32 @@
###
$ = require 'jquery'

sanitizeJqXHRError = (jqXHR) ->
return Promise.reject {
status: jqXHR.status
statusText: jqXHR.statusText
responseText: jqXHR.responseText
}

module.exports.create = ->
return Promise.resolve $.ajax '/datapacket/create', type: 'GET'
.catch (jqXHR) -> throw new Error jqXHR.statusText
return Promise.resolve $.ajax '/datapacket', type: 'POST'
.catch sanitizeJqXHRError

module.exports.exists = (id) ->
return Promise.resolve $.ajax '/datapacket/exists/' + id, type: 'GET'
.catch (jqXHR) -> throw new Error jqXHR.statusText
return Promise.resolve $.ajax '/datapacket/' + id, type: 'HEAD'
.catch sanitizeJqXHRError

module.exports.get = (id) ->
return Promise.resolve $.ajax '/datapacket/get/' + id, type: 'GET'
.catch (jqXHR) -> throw new Error jqXHR.statusText
return Promise.resolve $.ajax '/datapacket/' + id, type: 'GET'
.catch sanitizeJqXHRError

module.exports.put = (packet) ->
return Promise.resolve(
$.ajax '/datapacket/put/' + packet.id, type: 'PUT',
$.ajax '/datapacket/' + packet.id, type: 'PUT',
contentType: 'application/json'
data: JSON.stringify packet.data
).catch (jqXHR) -> throw new Error jqXHR.statusText
).catch sanitizeJqXHRError

module.exports.delete = (id) ->
return Promise.resolve $.ajax '/datapacket/delete/' + id, type: 'DELETE'
.catch (jqXHR) -> throw new Error jqXHR.statusText
return Promise.resolve $.ajax '/datapacket/' + id, type: 'DELETE'
.catch sanitizeJqXHRError
Loading

0 comments on commit 8b60afa

Please sign in to comment.