Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass a Intel bug on scissor test affecting click on 3D objects #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/alternativa/engine3d/core/View.as
Expand Up @@ -803,7 +803,9 @@ package alternativa.engine3d.core {
context.setVertexBufferAt(0, null);
context.setDepthTest(true, Context3DCompareMode.LESS);
}
scissor.x = pixelIndex;
// Use a 2x multiplicator to bypass a Intel HD300 Driver Bug
// maybe related to http://helpx.adobe.com/flash-player/release-note/developer-release-notes-11_3.html
scissor.x = pixelIndex * 2;
context.setScissorRectangle(scissor);
drawSurface(context, camera, j, m0, m5, m10, m11, (pixelIndex*2/contextWidth - rayCoefficients.x), rayCoefficients.y, kZ, fragmentConst, camera.orthographic);
raysIs[pixelIndex] = i;
Expand All @@ -813,16 +815,16 @@ package alternativa.engine3d.core {
// get
var pixel:BitmapData = pixels[pixelIndex];
if (pixel == null) {
pixel = new BitmapData(pixelIndex, 1, false, 0xFF);
pixel = new BitmapData(pixelIndex * 2, 1, false, 0xFF);
pixels[pixelIndex] = pixel;
}
context.drawToBitmapData(pixel);
for (var k:int = 0; k < pixelIndex; k++) {
var color:int = pixel.getPixel(k, 0);
var red:int = (color >> 16) & 0xFF;
var green:int = (color >> 8) & 0xFF;
var blue:int = color & 0xFF;
if (blue == 0) {
var color:uint = pixel.getPixel(k * 2, 0);
var red:uint = (color >> 16) & 0xFF;
var green:uint = (color >> 8) & 0xFF;
var blue:uint = color & 0xFF;
if (blue == 0 && color > 0) {
var ind:int = raysIs[k];
var raySurfaces:Vector.<Surface> = raysSurfaces[ind];
var rayDepths:Vector.<Number> = raysDepths[ind];
Expand Down