POV-Ray : Newsgroups : povray.newusers : Parse Error: Expected 'texture', texture identifier found instead Server Time
1 Nov 2024 05:23:43 EDT (-0400)
  Parse Error: Expected 'texture', texture identifier found instead (Message 1 to 3 of 3)  
From: SmashManiac
Subject: Parse Error: Expected 'texture', texture identifier found instead
Date: 23 Apr 2006 21:00:00
Message: <web.444c21aa3c0893f53fcbaafb0@news.povray.org>
Is it possible to use an array of textures in POV-Ray? I've can get working
integer arrays and vector arrays, but not texture arrays. They can be
declared,
but they don't seem to work correctly because I get...
---
Parse Error: Expected 'texture', texture identifier found instead
---
.....which I find really strange.

Code sample:
---

#declare textures = array[nbTextures] {
 texture {
  pigment { color rgb<0.9, 0.7, 0.2> }
  finish { ambient 0.2 diffuse 0.5 specular 0.5 }
 },
};

 #declare withoutSnow = mesh2 {
  vertex_vectors {
   dimension_size(vertexes,1),
   #local i = 0;
   #while (i < dimension_size(vertexes,1))
    vertexes[i] // Working.
    #local i = i+1;
   #end
  }
  texture_list {
   dimension_size(textures,1),
   #local i = 0;
   #while (i < dimension_size(textures,1))
    textures[i] // ERROR HERE ********
    #local i = i+1;
   #end
  }
  face_indices {
   dimension_size(triangles,1)/6,
   #local i = 0;
   #while (i < dimension_size(triangles,1)/6)

<triangles[6*i],triangles[6*i+1],triangles[6*i+2]>,triangles[6*i+3],triangles[6*i+4],triangles[6*i+5]
// Working.
    #local i = i+1;
   #end
  }
 }

---

Can somebody help?


Post a reply to this message

From: Tom York
Subject: Re: Parse Error: Expected 'texture', texture identifier found instead
Date: 23 Apr 2006 21:40:01
Message: <web.444c2b4e10f514d47d55e4a40@news.povray.org>
"SmashManiac" <nomail@nomail> wrote:
> Is it possible to use an array of textures in POV-Ray? I've can get working
> integer arrays and vector arrays, but not texture arrays. They can be
> declared,
> but they don't seem to work correctly because I get...
> ---
> Parse Error: Expected 'texture', texture identifier found instead

In this case the error message is quite useful. You must enclose the
"textures[i]" variable in your mesh2 with a texture block, like

texture { textures[i] }

The error message says that POV needs the variable "textures[i]" to be a
texture (eg texture { MyTextureIdentifier }), but textures[i] is just a
label/name for a texture, like MyTexture here:

#declare MyTexture = texture { ... }

If I then do

sphere {
  <0,0,0>, 1
  MyTexture
}

POV will fail with a similar sort of error. Putting MyTexture in a texture
block will fix it. The same solution applies to your code.


Post a reply to this message

From: SmashManiac
Subject: Re: Parse Error: Expected 'texture', texture identifier found instead
Date: 25 Apr 2006 23:10:01
Message: <web.444ee3dc10f514d4b3d5a7d00@news.povray.org>
It worked! Thanks!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.