1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-23 20:02:32 +08:00

intersectMode (#35)

This commit is contained in:
Kevin Levron 2021-04-02 23:22:19 +02:00
parent 75b34b23c5
commit d11c2fe247
2 changed files with 7 additions and 4 deletions

View File

@ -7,8 +7,8 @@ export default {
antialias: Boolean,
alpha: Boolean,
autoClear: { type: Boolean, default: true },
usePointer: { type: Boolean, default: false },
orbitCtrl: { type: [Boolean, Object], default: false },
pointer: { type: [Boolean, Object], default: false },
resize: { type: [Boolean, String], default: false },
shadow: Boolean,
width: String,
@ -35,7 +35,7 @@ export default {
alpha: this.alpha,
autoClear: this.autoClear,
orbit_ctrl: this.orbitCtrl,
use_pointer: this.usePointer,
pointer: this.pointer,
resize: this.resize,
width: this.width,
height: this.height,

View File

@ -113,6 +113,11 @@ export default function useThree() {
obj.pointer = usePointer(pointerConf);
if (conf.pointer || intersectObjects.length) {
obj.pointer.addListeners();
if (conf.pointer.intersectMode === 'frame') {
onBeforeRender(() => {
obj.pointer.intersect();
});
}
}
}
@ -156,7 +161,6 @@ export default function useThree() {
*/
function render() {
if (obj.orbitCtrl) obj.orbitCtrl.update();
// if (obj.pointer) obj.pointer.intersect();
beforeRenderCallbacks.forEach(c => c());
obj.renderer.render(obj.scene, obj.camera);
}
@ -166,7 +170,6 @@ export default function useThree() {
*/
function renderC() {
if (obj.orbitCtrl) obj.orbitCtrl.update();
// if (obj.pointer) obj.pointer.intersect();
beforeRenderCallbacks.forEach(c => c());
obj.composer.render();
}