fix window framebuffer scrunching bug
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
43bb67ca57
commit
c9691beaa9
@ -1767,6 +1767,7 @@ Update inventory utility logic
|
||||
Fix styling for inventory panel ui element
|
||||
Fix content serialization bug with attached items
|
||||
Fix playing audio without item defined in natural inventory panel
|
||||
Fix window framebuffer scrunching bug
|
||||
|
||||
|
||||
|
||||
|
||||
@ -296,7 +296,7 @@ public class ElementService extends SignalServiceImpl {
|
||||
lock.unlock();
|
||||
while(windowIterator.hasPrevious()){
|
||||
Element currentWindow = windowIterator.previous();
|
||||
Stack<Element> elementStack = buildElementPositionalStack(new Stack<Element>(), currentWindow, x, y);
|
||||
Stack<Element> elementStack = this.buildElementPositionalStack(new Stack<Element>(), currentWindow, x, y);
|
||||
Element currentElement = null;
|
||||
while(elementStack.size() > 0 && propagate == true){
|
||||
currentElement = elementStack.pop();
|
||||
@ -409,14 +409,14 @@ public class ElementService extends SignalServiceImpl {
|
||||
* @param offsetY the y offset accumulated
|
||||
* @return the stack, filled with all relevant elements
|
||||
*/
|
||||
Stack<Element> buildElementPositionalStack(Stack<Element> inputStack, Element current, int x, int y){
|
||||
private Stack<Element> buildElementPositionalStack(Stack<Element> inputStack, Element current, int x, int y){
|
||||
//if contains x,y, call function on el
|
||||
if(elementContainsPoint(current,x,y)){
|
||||
if(this.elementContainsPoint(current,x,y)){
|
||||
inputStack.push(current);
|
||||
}
|
||||
if(current instanceof ContainerElement){
|
||||
for(Element el : ((ContainerElement)current).getChildren()){
|
||||
buildElementPositionalStack(inputStack, el, x, y);
|
||||
this.buildElementPositionalStack(inputStack, el, x, y);
|
||||
}
|
||||
}
|
||||
return inputStack;
|
||||
@ -427,7 +427,7 @@ public class ElementService extends SignalServiceImpl {
|
||||
ListIterator<Element> windowIterator = elementList.listIterator(elementList.size());
|
||||
while(windowIterator.hasPrevious()){
|
||||
Element currentWindow = windowIterator.previous();
|
||||
Stack<Element> elementStack = buildElementPositionalStack(new Stack<Element>(), currentWindow, event.getCurrentX(), event.getCurrentY());
|
||||
Stack<Element> elementStack = this.buildElementPositionalStack(new Stack<Element>(), currentWindow, event.getCurrentX(), event.getCurrentY());
|
||||
Element currentElement = null;
|
||||
while(elementStack.size() > 0){
|
||||
currentElement = elementStack.pop();
|
||||
@ -486,7 +486,7 @@ public class ElementService extends SignalServiceImpl {
|
||||
* @param event The event to fire
|
||||
*/
|
||||
public void click(ClickEvent event){
|
||||
fireEvent(event,event.getCurrentX(),event.getCurrentY());
|
||||
this.fireEvent(event,event.getCurrentX(),event.getCurrentY());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -502,7 +502,7 @@ public class ElementService extends SignalServiceImpl {
|
||||
DragEvent event = new DragEvent(x, y, lastX, lastY, deltaX, deltaY, DragEventType.START, null);
|
||||
currentDragElement = (DraggableElement)resolveFirstDraggable(event);
|
||||
event.setTarget(currentDragElement);
|
||||
fireEvent(event,x,y);
|
||||
this.fireEvent(event,x,y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -211,12 +211,6 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
||||
) {
|
||||
int absoluteX = this.getAbsoluteX();
|
||||
int absoluteY = this.getAbsoluteY();
|
||||
float ndcWidth = (float)this.getWidth()/framebuffer.getWidth();
|
||||
float ndcHeight = (float)this.getHeight()/framebuffer.getHeight();
|
||||
float ndcX = (float)this.absoluteToFramebuffer(absoluteX,framebufferPosX)/framebuffer.getWidth();
|
||||
float ndcY = (float)this.absoluteToFramebuffer(absoluteY,framebufferPosY)/framebuffer.getHeight();
|
||||
Vector3f boxPosition = new Vector3f(ndcX,ndcY,0);
|
||||
Vector3f boxDimensions = new Vector3f(ndcWidth,ndcHeight,0);
|
||||
|
||||
widgetBuffer.bind(openGLState);
|
||||
openGLState.glViewport(width, height);
|
||||
@ -234,8 +228,10 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
||||
drawableChild.draw(renderPipelineState,openGLState,widgetBuffer,absoluteX,absoluteY);
|
||||
}
|
||||
}
|
||||
//this call binds the screen as the "texture" we're rendering to
|
||||
//have to call before actually rendering
|
||||
|
||||
|
||||
//
|
||||
//Actually draw to screen
|
||||
framebuffer.bind(openGLState);
|
||||
openGLState.glViewport(framebuffer.getWidth(), framebuffer.getHeight());
|
||||
|
||||
@ -255,6 +251,12 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
||||
}
|
||||
|
||||
//render content of window
|
||||
float ndcWidth = (float)this.widgetBuffer.getWidth()/framebuffer.getWidth();
|
||||
float ndcHeight = (float)this.widgetBuffer.getHeight()/framebuffer.getHeight();
|
||||
float ndcX = (float)this.absoluteToFramebuffer(absoluteX,framebufferPosX)/framebuffer.getWidth();
|
||||
float ndcY = (float)this.absoluteToFramebuffer(absoluteY,framebufferPosY)/framebuffer.getHeight();
|
||||
Vector3f boxPosition = new Vector3f(ndcX,ndcY,0);
|
||||
Vector3f boxDimensions = new Vector3f(ndcWidth,ndcHeight,0);
|
||||
if(planeModel != null){
|
||||
planeModel.pushUniformToMesh("plane", "mPosition", boxPosition);
|
||||
planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user