mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-12-25 17:32:35 +00:00
fix tornado rendering finally
This commit is contained in:
parent
049fe44d81
commit
b2cd2d63a3
5 changed files with 15 additions and 9 deletions
|
|
@ -815,9 +815,9 @@ class DtsObject extends GameObject {
|
|||
if (pos >= prim.points.length) {
|
||||
meshIndex++;
|
||||
if (prim.buffer != null) {
|
||||
prim.addNormals();
|
||||
for (norm in prim.normals)
|
||||
norm = norm.multiply(-1);
|
||||
// prim.addNormals();
|
||||
// for (norm in prim.normals)
|
||||
// norm = norm.multiply(-1);
|
||||
prim.flush();
|
||||
}
|
||||
mesh.primitive = prim;
|
||||
|
|
@ -831,7 +831,7 @@ class DtsObject extends GameObject {
|
|||
var vertex = info.vertices[i];
|
||||
var normal = info.normals[i];
|
||||
prim.points[pos] = vertex.toPoint();
|
||||
prim.normals[pos] = normal.toPoint().normalized();
|
||||
prim.normals[pos] = normal.toPoint(); // .normalized();
|
||||
if (prim.buffer != null) {
|
||||
prim.dirtyFlags[pos] = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,12 +111,12 @@ class InstanceManager {
|
|||
if (dtsshader != null) {
|
||||
minfo.meshbatch.material.mainPass.removeShader(minfo.meshbatch.material.textureShader);
|
||||
minfo.meshbatch.material.mainPass.addShader(dtsshader);
|
||||
minfo.meshbatch.material.mainPass.culling = mat.mainPass.culling;
|
||||
// minfo.meshbatch.material.mainPass.culling = mat.mainPass.culling;
|
||||
}
|
||||
minfo.transparencymeshbatch = new MeshBatch(cast(cast(obj, Mesh).primitive), cast(cast(obj, Mesh)).material.clone(), scene);
|
||||
minfo.transparencymeshbatch.material.mainPass.removeShader(minfo.meshbatch.material.textureShader);
|
||||
minfo.transparencymeshbatch.material.mainPass.addShader(dtsshader);
|
||||
minfo.transparencymeshbatch.material.mainPass.culling = mat.mainPass.culling;
|
||||
// minfo.transparencymeshbatch.material.mainPass.culling = mat.mainPass.culling;
|
||||
|
||||
// minfo.meshbatch.material.mainPass.removeShader(minfo.meshbatch.material.mainPass.getShader(PropsValues));
|
||||
// minfo.transparencymeshbatch.material.mainPass.removeShader(minfo.transparencymeshbatch.material.mainPass.getShader(PropsValues));
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class Grid {
|
|||
|
||||
public var cellSize:Vector; // The dimensions of one cell
|
||||
|
||||
public static var CELL_DIV = new Vector(16, 16, 16); // split the bounds into cells of dimensions 1/16th of the corresponding dimensions of the bounds
|
||||
public static var CELL_DIV = new Vector(12, 12, 12); // split the bounds into cells of dimensions 1/16th of the corresponding dimensions of the bounds
|
||||
|
||||
var map:Map<Int, Array<Int>> = new Map();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ class DtsTexture extends hxsl.Shader {
|
|||
static var SRC = {
|
||||
@input var input:{
|
||||
var uv:Vec2;
|
||||
var normal:Vec3;
|
||||
};
|
||||
@global var global:{
|
||||
@perObject var modelView:Mat4;
|
||||
};
|
||||
@const var additive:Bool;
|
||||
@const var killAlpha:Bool;
|
||||
|
|
@ -14,8 +18,10 @@ class DtsTexture extends hxsl.Shader {
|
|||
var calculatedUV:Vec2;
|
||||
var pixelColor:Vec4;
|
||||
var specColor:Vec3;
|
||||
var transformedNormal:Vec3;
|
||||
function vertex() {
|
||||
calculatedUV = input.uv;
|
||||
transformedNormal = (input.normal * global.modelView.mat3());
|
||||
}
|
||||
function fragment() {
|
||||
var c = texture.get(calculatedUV);
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ class Tornado extends ForceObject {
|
|||
this.soundChannel = AudioManager.playSound(ResourceLoader.getResource("data/sound/tornado.wav", ResourceLoader.getAudio, this.soundResources),
|
||||
new Vector(1e8, 1e8, 1e8), true);
|
||||
for (material in this.materials) {
|
||||
// material.blendMode = Alpha;
|
||||
material.mainPass.culling = h3d.mat.Data.Face.None;
|
||||
material.blendMode = Alpha;
|
||||
// material.mainPass.culling = h3d.mat.Data.Face.None;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue