com.watabou.noosa.NoosaScript Java Examples

The following examples show how to use com.watabou.noosa.NoosaScript. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Flare.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
private void drawRays() {
	
	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.uModel.valueM4( matrix );
	script.lighting( 
		rm, gm, bm, am, 
		ra, ga, ba, aa );
	
	script.camera( camera );
	script.drawElements( vertices, indices, nRays * 3 );
}
 
Example #2
Source File: Flare.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
private void drawRays() {
	
	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.uModel.valueM4( matrix );
	script.lighting(
		rm, gm, bm, am,
		ra, ga, ba, aa );
	
	script.camera( camera );
	script.drawElements( vertices, indices, nRays * 3 );
}
 
Example #3
Source File: KeyDisplay.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw() {
	super.draw();
	if (dirty){
		
		updateVertices();
		
		quads.limit(quads.position());
		if (buffer == null)
			buffer = new Vertexbuffer(quads);
		else
			buffer.updateVertices(quads);
		
	}
	
	NoosaScript script = NoosaScript.get();
	
	tx.bind();
	
	script.camera( camera() );
	
	script.uModel.valueM4( matrix );
	script.lighting(
			rm, gm, bm, am,
			ra, ga, ba, aa );
	script.drawQuadSet( buffer, totalKeys, 0 );
}
 
Example #4
Source File: Archs.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	arcsBg = new SkinnedBlock( 1, 1, Assets.ARCS_BG ){
		@Override
		protected NoosaScript script() {
			return NoosaScriptNoLighting.get();
		}

		@Override
		public void draw() {
			//arch bg has no alpha component, this improves performance
			Blending.disable();
			super.draw();
			Blending.enable();
		}
	};
	arcsBg.autoAdjust = true;
	arcsBg.offsetTo( 0,  offsB );
	add( arcsBg );

	arcsFg = new SkinnedBlock( 1, 1, Assets.ARCS_FG ){
		@Override
		protected NoosaScript script() {
			return NoosaScriptNoLighting.get();
		}
	};
	arcsFg.autoAdjust = true;
	arcsFg.offsetTo( 0,  offsF );
	add( arcsFg );

	darkness= new Image(TextureCache.createGradient(0x00000000, 0x22000000, 0x55000000, 0x99000000, 0xEE000000));
	darkness.angle = 90;
	add(darkness);
}
 
Example #5
Source File: ItemSprite.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw() {
	if (texture == null || (!dirty && buffer == null))
		return;

	if (renderShadow) {
		if (dirty) {
			verticesBuffer.position(0);
			verticesBuffer.put(vertices);
			if (buffer == null)
				buffer = new Vertexbuffer(verticesBuffer);
			else
				buffer.updateVertices(verticesBuffer);
			dirty = false;
		}

		NoosaScript script = script();

		texture.bind();

		script.camera(camera());

		updateMatrix();

		script.uModel.valueM4(shadowMatrix);
		script.lighting(
				0, 0, 0, am * .6f,
				0, 0, 0, aa * .6f);

		script.drawQuad(buffer);
	}

	super.draw();

}
 
Example #6
Source File: CharSprite.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw() {
	if (texture == null || (!dirty && buffer == null))
		return;

	if (renderShadow) {
		if (dirty) {
			verticesBuffer.position(0);
			verticesBuffer.put(vertices);
			if (buffer == null)
				buffer = new Vertexbuffer(verticesBuffer);
			else
				buffer.updateVertices(verticesBuffer);
			dirty = false;
		}

		NoosaScript script = script();

		texture.bind();

		script.camera(camera());

		updateMatrix();

		script.uModel.valueM4(shadowMatrix);
		script.lighting(
				0, 0, 0, am * .6f,
				0, 0, 0, aa * .6f);

		script.drawQuad(buffer);
	}

	super.draw();

}
 
Example #7
Source File: Flare.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void drawRays() {
	
	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.uModel.valueM4( matrix );
	script.lighting( 
		rm, gm, bm, am, 
		ra, ga, ba, aa );
	
	script.camera( camera );
	script.drawElements( vertices, indices, nRays * 3 );
}
 
Example #8
Source File: ItemSprite.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw() {
	super.draw();


	if(overlay != null) {
		NoosaScript script = NoosaScript.get();

		overlay.texture.bind();
		overlay.updateVerticesBuffer();
		script.drawQuad(overlay.getVerticesBuffer());
	}
}
 
Example #9
Source File: Flare.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void drawRays() {
	
	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.uModel.valueM4( matrix );
	script.lighting(
		rm, gm, bm, am,
		ra, ga, ba, aa );
	
	script.camera( camera );
	script.drawElements( vertices, indices, nRays * 3 );
}
 
Example #10
Source File: KeyDisplay.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw() {
	super.draw();
	if (dirty){
		
		updateVertices();
		
		quads.limit(quads.position());
		if (buffer == null)
			buffer = new Vertexbuffer(quads);
		else
			buffer.updateVertices(quads);
		
	}
	
	NoosaScript script = NoosaScript.get();
	
	tx.bind();
	
	script.camera( camera() );
	
	script.uModel.valueM4( matrix );
	script.lighting(
			rm, gm, bm, am,
			ra, ga, ba, aa );
	script.drawQuadSet( buffer, totalKeys, 0 );
}
 
Example #11
Source File: Archs.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	arcsBg = new SkinnedBlock( 1, 1, Assets.Interfaces.ARCS_BG ){
		@Override
		protected NoosaScript script() {
			return NoosaScriptNoLighting.get();
		}

		@Override
		public void draw() {
			//arch bg has no alpha component, this improves performance
			Blending.disable();
			super.draw();
			Blending.enable();
		}
	};
	arcsBg.autoAdjust = true;
	arcsBg.offsetTo( 0,  offsB );
	add( arcsBg );

	arcsFg = new SkinnedBlock( 1, 1, Assets.Interfaces.ARCS_FG ){
		@Override
		protected NoosaScript script() {
			return NoosaScriptNoLighting.get();
		}
	};
	arcsFg.autoAdjust = true;
	arcsFg.offsetTo( 0,  offsF );
	add( arcsFg );

	darkness= new Image(TextureCache.createGradient(0x00000000, 0x22000000, 0x55000000, 0x99000000, 0xEE000000));
	darkness.angle = 90;
	add(darkness);
}
 
Example #12
Source File: ItemSprite.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw() {
	if (texture == null || (!dirty && buffer == null))
		return;

	if (renderShadow) {
		if (dirty) {
			verticesBuffer.position(0);
			verticesBuffer.put(vertices);
			if (buffer == null)
				buffer = new Vertexbuffer(verticesBuffer);
			else
				buffer.updateVertices(verticesBuffer);
			dirty = false;
		}

		NoosaScript script = script();

		texture.bind();

		script.camera(camera());

		updateMatrix();

		script.uModel.valueM4(shadowMatrix);
		script.lighting(
				0, 0, 0, am * .6f,
				0, 0, 0, aa * .6f);

		script.drawQuad(buffer);
	}

	super.draw();

}
 
Example #13
Source File: CharSprite.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw() {
	if (texture == null || (!dirty && buffer == null))
		return;

	if (renderShadow) {
		if (dirty) {
			verticesBuffer.position(0);
			verticesBuffer.put(vertices);
			if (buffer == null)
				buffer = new Vertexbuffer(verticesBuffer);
			else
				buffer.updateVertices(verticesBuffer);
			dirty = false;
		}

		NoosaScript script = script();

		texture.bind();

		script.camera(camera());

		updateMatrix();

		script.uModel.valueM4(shadowMatrix);
		script.lighting(
				0, 0, 0, am * .6f,
				0, 0, 0, aa * .6f);

		script.drawQuad(buffer);
	}

	super.draw();

}
 
Example #14
Source File: Flare.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void drawRays() {
	
	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.uModel.valueM4( matrix );
	script.lighting( 
		rm, gm, bm, am, 
		ra, ga, ba, aa );
	
	script.camera( camera );
	script.drawElements( vertices, indices, nRays * 3 );
}
 
Example #15
Source File: Flare.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void drawRays() {
	
	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.uModel.valueM4( matrix );
	script.lighting(
		rm, gm, bm, am,
		ra, ga, ba, aa );
	
	script.camera( camera );
	script.drawElements( vertices, indices, nRays * 3 );
}
 
Example #16
Source File: CircleArc.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void draw() {
	
	super.draw();
	
	if (dirty) {
		updateTriangles();
	}
	
	if (lightMode) Blending.setLightMode();
	
	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.uModel.valueM4( matrix );
	script.lighting(
			rm, gm, bm, am,
			ra, ga, ba, aa );
	
	script.camera( camera );
	script.drawElements( vertices, indices, nTris * 3 );
	
	if (lightMode) Blending.setNormalMode();
}
 
Example #17
Source File: SurfaceScene.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void draw() {
	
	super.draw();

	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.camera( camera() );
	
	script.uModel.valueM4( matrix );
	script.lighting(
		rm, gm, bm, am,
		ra, ga, ba, aa );
	
	script.drawQuad( verticesBuffer );
}
 
Example #18
Source File: FogOfWar.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected NoosaScript script() {
	return NoosaScriptNoLighting.get();
}
 
Example #19
Source File: SurfaceScene.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void draw() {
	
	super.draw();

	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.camera( camera() );
	
	script.uModel.valueM4( matrix );
	script.lighting( 
		rm, gm, bm, am, 
		ra, ga, ba, aa );
	
	script.drawQuad( verticesBuffer );
}
 
Example #20
Source File: SurfaceScene.java    From pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void draw() {
	
	super.draw();

	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.camera( camera() );
	
	script.uModel.valueM4( matrix );
	script.lighting( 
		rm, gm, bm, am, 
		ra, ga, ba, aa );
	
	script.drawQuad( verticesBuffer );
}
 
Example #21
Source File: SurfaceScene.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void draw() {
	
	super.draw();

	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.camera( camera() );
	
	script.uModel.valueM4( matrix );
	script.lighting(
		rm, gm, bm, am,
		ra, ga, ba, aa );
	
	script.drawQuad( verticesBuffer );
}
 
Example #22
Source File: SurfaceScene.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void draw() {
	
	super.draw();

	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.camera( camera() );
	
	script.uModel.valueM4( matrix );
	script.lighting(
		rm, gm, bm, am,
		ra, ga, ba, aa );
	
	script.drawQuad( verticesBuffer );
}
 
Example #23
Source File: CircleArc.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void draw() {
	
	super.draw();
	
	if (dirty) {
		updateTriangles();
	}
	
	if (lightMode) Blending.setLightMode();
	
	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.uModel.valueM4( matrix );
	script.lighting(
			rm, gm, bm, am,
			ra, ga, ba, aa );
	
	script.camera( camera );
	script.drawElements( vertices, indices, nTris * 3 );
	
	if (lightMode) Blending.setNormalMode();
}
 
Example #24
Source File: SurfaceScene.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void draw() {
	
	super.draw();

	NoosaScript script = NoosaScript.get();
	
	texture.bind();
	
	script.camera( camera() );
	
	script.uModel.valueM4( matrix );
	script.lighting( 
		rm, gm, bm, am, 
		ra, ga, ba, aa );
	
	script.drawQuad( verticesBuffer );
}
 
Example #25
Source File: FogOfWar.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected NoosaScript script() {
	return NoosaScriptNoLighting.get();
}