Updated to use new external MVP functions

This commit is contained in:
Richard Davey 2020-07-14 16:49:30 +01:00
parent 06c1336f41
commit 0003d278fd
5 changed files with 181 additions and 172 deletions

View file

@ -13,6 +13,7 @@ var CONST = require('../../const');
var Frame = require('../../textures/Frame');
var GameObject = require('../GameObject');
var NOOP = require('../../utils/NOOP');
var ProjectOrtho = require('../../renderer/webgl/mvp/ProjectOrtho');
var Render = require('./RenderTextureRender');
var Utils = require('../../renderer/webgl/Utils');
var UUID = require('../../utils/string/UUID');
@ -538,7 +539,7 @@ var RenderTexture = new Class({
var pipeline = this.pipeline;
pipeline.projOrtho(0, this.texture.width, 0, this.texture.height, -1000.0, 1000.0);
ProjectOrtho(pipeline, 0, this.texture.width, 0, this.texture.height, -1000.0, 1000.0);
pipeline.drawFillRect(
x, y, width, height,
@ -550,7 +551,7 @@ var RenderTexture = new Class({
this.renderer.popScissor();
pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
ProjectOrtho(pipeline, 0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
}
else
{
@ -764,7 +765,7 @@ var RenderTexture = new Class({
var pipeline = this.pipeline;
pipeline.projOrtho(0, this.texture.width, 0, this.texture.height, -1000.0, 1000.0);
ProjectOrtho(pipeline, 0, this.texture.width, 0, this.texture.height, -1000.0, 1000.0);
this.batchList(entries, x, y, alpha, tint);
@ -774,7 +775,7 @@ var RenderTexture = new Class({
this.renderer.popScissor();
pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
ProjectOrtho(pipeline, 0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
}
else
{
@ -855,7 +856,7 @@ var RenderTexture = new Class({
var pipeline = this.pipeline;
pipeline.projOrtho(0, this.texture.width, 0, this.texture.height, -1000.0, 1000.0);
ProjectOrtho(pipeline, 0, this.texture.width, 0, this.texture.height, -1000.0, 1000.0);
pipeline.batchTextureFrame(textureFrame, x + this.frame.cutX, y + this.frame.cutY, tint, alpha, this.camera.matrix, null);
@ -865,7 +866,7 @@ var RenderTexture = new Class({
this.renderer.popScissor();
pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
ProjectOrtho(pipeline, 0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
}
else
{

View file

@ -12,6 +12,7 @@ var CONST = require('../../const');
var GameEvents = require('../../core/events');
var IsSizePowerOfTwo = require('../../math/pow2/IsSizePowerOfTwo');
var NOOP = require('../../utils/NOOP');
var ProjectOrtho = require('./mvp/ProjectOrtho');
var ScaleEvents = require('../../scale/events');
var SpliceOne = require('../../utils/array/SpliceOne');
var TextureEvents = require('../../textures/events');
@ -1850,7 +1851,7 @@ var WebGLRenderer = new Class({
gl.clear(gl.COLOR_BUFFER_BIT);
TextureTintPipeline.projOrtho(cx, cw + cx, cy, ch + cy, -1000, 1000);
ProjectOrtho(TextureTintPipeline, cx, cw + cx, cy, ch + cy, -1000, 1000);
if (camera.mask)
{
@ -1944,7 +1945,7 @@ var WebGLRenderer = new Class({
if (camera.renderToGame)
{
TextureTintPipeline.projOrtho(0, TextureTintPipeline.width, TextureTintPipeline.height, 0, -1000.0, 1000.0);
ProjectOrtho(TextureTintPipeline, 0, TextureTintPipeline.width, TextureTintPipeline.height, 0, -1000.0, 1000.0);
var getTint = Utils.getTintAppendFloatAlpha;

View file

@ -9,6 +9,7 @@ var Class = require('../../../utils/Class');
var Earcut = require('../../../geom/polygon/Earcut');
var GetFastValue = require('../../../utils/object/GetFastValue');
var ModelViewProjection = require('./components/ModelViewProjection');
var ProjectOrtho = require('../mvp/ProjectOrtho');
var ShaderSourceFS = require('../shaders/TextureTint-frag.js');
var ShaderSourceVS = require('../shaders/TextureTint-vert.js');
var TransformMatrix = require('../../../gameobjects/components/TransformMatrix');
@ -297,7 +298,7 @@ var TextureTintPipeline = new Class({
{
WebGLPipeline.prototype.resize.call(this, width, height, resolution);
this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0);
ProjectOrtho(this, 0, this.width, this.height, 0, -1000.0, 1000.0);
return this;
},

View file

@ -8,6 +8,7 @@
var Class = require('../../../utils/Class');
var GetFastValue = require('../../../utils/object/GetFastValue');
var ModelViewProjection = require('./components/ModelViewProjection');
var ProjectOrtho = require('../mvp/ProjectOrtho');
var ShaderSourceFS = require('../shaders/TextureTint-frag.js');
var ShaderSourceVS = require('../shaders/TextureTint-vert.js');
var TransformMatrix = require('../../../gameobjects/components/TransformMatrix');
@ -193,7 +194,7 @@ var TextureTintStripPipeline = new Class({
{
WebGLPipeline.prototype.resize.call(this, width, height, resolution);
this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0);
ProjectOrtho(this, 0, this.width, this.height, 0, -1000.0, 1000.0);
return this;
},

View file

@ -4,6 +4,12 @@
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var Identity = require('../../renderer/webgl/mvp/Identity');
var Scale = require('../../renderer/webgl/mvp/Scale');
var Translate = require('../../renderer/webgl/mvp/Translate');
var ViewIdentity = require('../../renderer/webgl/mvp/ViewIdentity');
var ViewLoad2D = require('../../renderer/webgl/mvp/ViewLoad2D');
/**
* Renders this Game Object with the WebGL Renderer to the given Camera.
*
@ -30,11 +36,10 @@ var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPerc
renderer.setPipeline(pipeline);
pipeline.modelIdentity();
pipeline.modelTranslate(src.x - (camera.scrollX * src.scrollFactorX), src.y - (camera.scrollY * src.scrollFactorY), 0);
pipeline.modelScale(src.scaleX, src.scaleY, 1);
pipeline.viewLoad2D(camera.matrix.matrix);
Identity(pipeline);
Translate(pipeline, src.x - (camera.scrollX * src.scrollFactorX), src.y - (camera.scrollY * src.scrollFactorY), 0);
Scale(pipeline, src.scaleX, src.scaleY, 1);
ViewLoad2D(pipeline, camera.matrix.matrix);
for (var i = 0; i < tilesets.length; i++)
{
@ -60,8 +65,8 @@ var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPerc
// Restore the pipeline
pipeline.vertexBuffer = pipelineVertexBuffer;
pipeline.viewIdentity();
pipeline.modelIdentity();
ViewIdentity(pipeline);
Identity(pipeline);
};
module.exports = StaticTilemapLayerWebGLRenderer;