trois icon indicating copy to clipboard operation
trois copied to clipboard

Using more than one texture for a box

Open dirk-ecker opened this issue 3 years ago • 1 comments

I am not getting this: How can I set and use more than one texture for a box? This is working and the texture is used for every side.

      <Box
          :ref="setBoxReference"
          v-for="i in numberOfBars"
          :position="{ x: xStart, y: yStart + i * 4, z: 0 }"
          :width="width"
          :height="height"
          :depth="depth"
      >
        <LambertMaterial>
          <Texture src="src/assets/images/bar/front.jpg" />
        </LambertMaterial>
      </Box>

How can this be accomplished? Adding six textures is not working.

dirk-ecker avatar Sep 28 '21 14:09 dirk-ecker

Just opened a PR with a fix for this. After it is merged (or if you use my fork), you can do what you asked like this:

 <Box
  :ref="setBoxReference"
  v-for="i in numberOfBars"
  :position="{ x: xStart, y: yStart + i * 4, z: 0 }"
  :width="width"
  :height="height"
  :depth="depth"
>
  <LambertMaterial>
    <Texture src="src/assets/images/bar/right.jpg" />
  </LambertMaterial>
  <LambertMaterial>
    <Texture src="src/assets/images/bar/left.jpg" />
  </LambertMaterial>
  <LambertMaterial>
    <Texture src="src/assets/images/bar/above.jpg" />
  </LambertMaterial>
  <LambertMaterial>
    <Texture src="src/assets/images/bar/below.jpg" />
  </LambertMaterial>
  <LambertMaterial>
    <Texture src="src/assets/images/bar/behind.jpg" />
  </LambertMaterial>
  <LambertMaterial>
    <Texture src="src/assets/images/bar/ahead.jpg" />
  </LambertMaterial>
</Box>

feritarou avatar Apr 06 '23 17:04 feritarou