Add ant spawn uniform to AntsComputeScene
This commit is contained in:
parent
a7aeb064b3
commit
c81ecaf21e
3 changed files with 12 additions and 0 deletions
|
|
@ -206,6 +206,11 @@ export default class Renderer {
|
||||||
this.resources.antsPresenceRenderTarget.texture;
|
this.resources.antsPresenceRenderTarget.texture;
|
||||||
scenes.ants.material.uniforms.uMaterialProps.value =
|
scenes.ants.material.uniforms.uMaterialProps.value =
|
||||||
this.materialPropsTexture;
|
this.materialPropsTexture;
|
||||||
|
scenes.ants.material.uniforms.uAntSpawn.value.copy(
|
||||||
|
scenes.screen.antSpawnRequest,
|
||||||
|
);
|
||||||
|
// clear after reading
|
||||||
|
scenes.screen.antSpawnRequest.set(0, 0, 0, 0);
|
||||||
this.renderer.render(scenes.ants, scenes.ants.camera);
|
this.renderer.render(scenes.ants, scenes.ants.camera);
|
||||||
|
|
||||||
this.setViewportFromRT(this.resources.antsDiscreteRenderTarget);
|
this.setViewportFromRT(this.resources.antsDiscreteRenderTarget);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ export default class AntsComputeScene extends AbstractScene {
|
||||||
tPresence: { value: null },
|
tPresence: { value: null },
|
||||||
uMaterialProps: { value: null },
|
uMaterialProps: { value: null },
|
||||||
uForagerRatio: { value: 0 },
|
uForagerRatio: { value: 0 },
|
||||||
|
uAntSpawn: { value: new THREE.Vector4(0, 0, 0, 0) },
|
||||||
},
|
},
|
||||||
vertexShader,
|
vertexShader,
|
||||||
fragmentShader,
|
fragmentShader,
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,12 @@ export default class ScreenScene extends AbstractScene {
|
||||||
public ants!: THREE.InstancedMesh;
|
public ants!: THREE.InstancedMesh;
|
||||||
public readonly groundMaterial: THREE.ShaderMaterial;
|
public readonly groundMaterial: THREE.ShaderMaterial;
|
||||||
public readonly pointerPosition: THREE.Vector2 = new THREE.Vector2();
|
public readonly pointerPosition: THREE.Vector2 = new THREE.Vector2();
|
||||||
|
public readonly antSpawnRequest: THREE.Vector4 = new THREE.Vector4(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
);
|
||||||
public drawMode: number = -1;
|
public drawMode: number = -1;
|
||||||
// zoom stored in Config.cameraZoom
|
// zoom stored in Config.cameraZoom
|
||||||
private isPointerDown: boolean = false;
|
private isPointerDown: boolean = false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue