Comments (1)
Hi I got this.
You can enable the localClippingEnabled by using the template ref (like in my example) or by using useTresContext
But I believe you got another problem related to the bound of clippingPlane
null to the material.
<script setup lang="ts">
import { reactive, ref, shallowRef, watch } from 'vue';
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three';
import { TresCanvas, vLog } from '@tresjs/core';
import { OrbitControls, ContactShadows } from '@tresjs/cientos';
const gl = {
clearColor: '#82DBC5',
shadows: true,
alpha: false,
shadowMapType: BasicShadowMap,
outputColorSpace: SRGBColorSpace,
toneMapping: NoToneMapping,
};
const clippingPlane = ref(null);
const ctxRef = shallowRef();
watch(ctxRef, (ctx) => {
const { renderer } = ctx.context;
renderer.value.localClippingEnabled = true;
console.log(renderer.value.localClippingEnabled);
});
</script>
<template>
<TresCanvas v-bind="gl" ref="ctxRef">
<TresPerspectiveCamera :position="[9, 9, 9]" />
<OrbitControls />
<TresMesh>
<TresBoxGeometry :args="[1, 1, 1]" />
<TresMeshNormalMaterial /> // If I leave the null bound here throw error
</TresMesh>
<TresMesh :position="[0, 0.25, 0]" :rotation="[-Math.PI / 2, 0, 0]">
<TresPlaneGeometry ref="clippingPlane" :args="[2, 2]" />
<TresMeshBasicMaterial color="#555" :side="DoubleSide" />
</TresMesh>
<ContactShadows />
<TresDirectionalLight :position="[0, 2, 4]" :intensity="1.2" cast-shadow />
</TresCanvas>
</template>
from tres.
Related Issues (20)
- `useLoop` callback state missing controls HOT 1
- Render mode policies
- camera-position bug since version 3.8 HOT 3
- Add userData to vue devtools component inspector
- Invalid watch source error when declaring a CatmullRomCurve3 HOT 1
- position type is incorrect
- The Lifecycle Hooks is out of order after v3.9.0 HOT 8
- `<primitive> :object` breaking references to THREE objects HOT 1
- Physics support integration! HOT 3
- Toggle v-if on a Tres component declared in a separate SFC makes it detach from its parent HOT 9
- V4 drops fps HOT 2
- v4.0.1 The `onPointerLeave` function is not activating. HOT 8
- Manual rendering (edge case): canvases loaded into new tabs are initially blank
- Cannot read properties of undefined (reading 'dispose') - GridHelper HOT 6
- `Camera` wrapped by `TresGroup` cannot be used properly after `version 4.0` HOT 2
- `Event` is not triggered in `TresGroup` HOT 2
- Impossible to `inject` variable in canvas child component HOT 4
- intersect only objects with events registered HOT 3
- No more outlines since V4 HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tres.