POV-Ray : Newsgroups : povray.binaries.programming : My idea: Developers need tips! Help me, please! Server Time
1 Dec 2021 16:49:38 EST (-0500)
  My idea: Developers need tips! Help me, please! (Message 41 to 50 of 50)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: LanuHum
Subject: Re: My idea: Developers need tips! Help me, please!
Date: 4 Nov 2016 08:05:00
Message: <web.581c783c397eea9f7a3e03fe0@news.povray.org>
Now the scene I add Povray mesh2


                PyObject* textureList = PyList_GetItem(blenderObject,5);
                number_of_textures = PyObject_Size(textureList);
                if (number_of_textures>0)
                {
                    Textures = reinterpret_cast<TEXTURE
**>(POV_MALLOC(number_of_textures*sizeof(TEXTURE *), "triangle mesh data"));
                    for(i=0; i<number_of_textures; i++)
                    {
                        PyObject* pyName = PyList_GetItem(textureList,i);
                        PyObject* pyTexture = PyObject_Repr(pyName);
                        pyTexture = PyUnicode_AsEncodedString(pyTexture,
"ASCII","Error ~");
                        const char *cTexture = PyBytes_AS_STRING(pyTexture);
                        Textures[i] = Create_Texture();
                        Post_Textures(Textures[i]);
                    }
                }


At textures no name. How to initialize?


Post a reply to this message

From: clipka
Subject: Re: My idea: Developers need tips! Help me, please!
Date: 4 Nov 2016 08:50:31
Message: <581c8417$1@news.povray.org>
Am 04.11.2016 um 12:59 schrieb LanuHum:

> At textures no name. How to initialize?

I'm not sure what you mean.

POV-Ray's render engine does not use any names -- neither for objects
nor for textures. That's just a thing used in the parser to make life
easier for users.


Post a reply to this message

From: LanuHum
Subject: Re: My idea: Developers need tips! Help me, please!
Date: 4 Nov 2016 09:55:01
Message: <web.581c9191397eea9f7a3e03fe0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 04.11.2016 um 12:59 schrieb LanuHum:
>
> > At textures no name. How to initialize?
>
> I'm not sure what you mean.
>
> POV-Ray's render engine does not use any names -- neither for objects
> nor for textures. That's just a thing used in the parser to make life
> easier for users.


File Scene.pov:

#declare Tex0 = texture {...}
#declare Tex1 = texture {...}
#declare Tex2 = texture {...}
#declare Tex3 = texture {...}

#declare Foo = blender_object { "foo" }


1. Load mesh from Blender. I do not create BlenderMesh. I immediately create a
Povray Mesh2.

#include "core/shape/mesh.h"

Mesh* Object = new Mesh();

...........................

//Mesh uses four texture.

    for( i=0; i < 4; i++) Textures[i] = Create_Texture();
or
    for( i=0; i < 4; i++) Textures[i] = NULL;


   Object->Data = reinterpret_cast<MESH_DATA *>(POV_MALLOC...
   Object->Data->Normals   = Normals;
   Object->Data->Triangles = Triangles;
   Object->Data->Vertices  = Vertices;
   Object->Data->UVCoords  = UVCoords;

   Object->Textures  = Textures;  //  !!!!!!!!!

   Object->Data->Number_Of_Normals = number_of_normals;
   Object->Data->Number_Of_Triangles = number_of_triangles;
   Object->Data->Number_Of_Vertices = number_of_vertices;
   Object->Data->Number_Of_UVCoords  = number_of_uvcoords;
   Object->Number_Of_Textures = number_of_textures;

2. Parse Scene.pov

    char *s;
    ...
    CASE(BLENDER_OBJECT_TOKEN)
        Parse_Begin();
        s = Parse_C_String();
        Object = addBlenderObject(std::string(s));
        Object -> Textures[0] = Tex0  // How to implement this?
        Object -> Textures[1] = Tex1
        Object -> Textures[2] = Tex2
        Object -> Textures[3] = Tex3
        POV_FREE(s);
        Parse_End();
    END_CASE


???????? :)


Post a reply to this message

From: clipka
Subject: Re: My idea: Developers need tips! Help me, please!
Date: 4 Nov 2016 13:59:09
Message: <581ccc6d$1@news.povray.org>
Am 04.11.2016 um 14:54 schrieb LanuHum:
> clipka <ano### [at] anonymousorg> wrote:
>> Am 04.11.2016 um 12:59 schrieb LanuHum:
>>
>>> At textures no name. How to initialize?
>>
>> I'm not sure what you mean.
>>
>> POV-Ray's render engine does not use any names -- neither for objects
>> nor for textures. That's just a thing used in the parser to make life
>> easier for users.
> 
> 
> File Scene.pov:
> 
> #declare Tex0 = texture {...}
> #declare Tex1 = texture {...}
> #declare Tex2 = texture {...}
> #declare Tex3 = texture {...}
> 
> #declare Foo = blender_object { "foo" }

Well, wouldn't the Blender object named "foo" also include references to
the textures as they are defined in Blender?

If not, then you'll of course have to design the syntax of
"blender_object" in such a manner that you can list the POV-Ray textures
that the Blender object is supposed to use, maybe like so:

    blender_object {
      STRING
      texture_list {
        texture { Tex0 },
        texture { Tex1 },
        texture { Tex2 },
        texture { Tex3 }
      }
    }


Post a reply to this message

From: LanuHum
Subject: Re: My idea: Developers need tips! Help me, please!
Date: 4 Nov 2016 15:15:00
Message: <web.581cdd9b397eea9f7a3e03fe0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 04.11.2016 um 14:54 schrieb LanuHum:
> > clipka <ano### [at] anonymousorg> wrote:
> >> Am 04.11.2016 um 12:59 schrieb LanuHum:
> >>
> >>> At textures no name. How to initialize?
> >>
> >> I'm not sure what you mean.
> >>
> >> POV-Ray's render engine does not use any names -- neither for objects
> >> nor for textures. That's just a thing used in the parser to make life
> >> easier for users.
> >
> >
> > File Scene.pov:
> >
> > #declare Tex0 = texture {...}
> > #declare Tex1 = texture {...}
> > #declare Tex2 = texture {...}
> > #declare Tex3 = texture {...}
> >
> > #declare Foo = blender_object { "foo" }
>
> Well, wouldn't the Blender object named "foo" also include references to
> the textures as they are defined in Blender?

Yes. I load objects to the parser.
Or should I convey texture code. I want to pass only the geometry.

>
> If not, then you'll of course have to design the syntax of
> "blender_object" in such a manner that you can list the POV-Ray textures
> that the Blender object is supposed to use, maybe like so:
>
>     blender_object {
>       STRING
>       texture_list {
>         texture { Tex0 },
>         texture { Tex1 },
>         texture { Tex2 },
>         texture { Tex3 }
>       }
>     }

I'll break your head about it.


Post a reply to this message

From: LanuHum
Subject: Re: My idea: Developers need tips! Help me, please!
Date: 4 Nov 2016 15:30:01
Message: <web.581ce0d1397eea9f7a3e03fe0@news.povray.org>
Why not add the name of the texture in texture.h to use options?
Your text:
struct Texture_Struct: public Pattern_Struct
{
     TextureBlendMapPtr Blend_Map;
     int References;
     TEXTURE * Next;
     string name; // Add your code !!!!!!!!!!!!!!!!


It will not affect the code, but it allows you to manipulate using povray as a
library...


Post a reply to this message

From: LanuHum
Subject: Re: My idea: Developers need tips! Help me, please!
Date: 4 Nov 2016 15:40:00
Message: <web.581ce3fa397eea9f7a3e03fe0@news.povray.org>
"LanuHum" <Lan### [at] yandexru> wrote:
> Why not add the name of the texture in texture.h to use options?
> Your text:
> struct Texture_Struct: public Pattern_Struct
> {
>      TextureBlendMapPtr Blend_Map;
>      int References;
>      TEXTURE * Next;
>      string name; // Add your code !!!!!!!!!!!!!!!!
>
>
> It will not affect the code, but it allows you to manipulate using povray as a
> library...

It can be applied to all objects: object, pigment, finish...ans so on...


Post a reply to this message

From: clipka
Subject: Re: My idea: Developers need tips! Help me, please!
Date: 5 Nov 2016 04:25:36
Message: <581d9780$1@news.povray.org>
Am 04.11.2016 um 20:26 schrieb LanuHum:
> Why not add the name of the texture in texture.h to use options?

Because it's entirely irrelevant for the render engine.

> Your text:
> struct Texture_Struct: public Pattern_Struct
> {
>      TextureBlendMapPtr Blend_Map;
>      int References;
>      TEXTURE * Next;
>      string name; // Add your code !!!!!!!!!!!!!!!!
> 
> 
> It will not affect the code, but it allows you to manipulate using povray as a
> library...

It will waste memory, adding 40(!) bytes of overhead per texture
(Windows 64-bit binary; other platforms may vary) even if the name is
unused.

Even a C-style string (char*) would add 8 bytes of overhead (again
Windows 64-bit binary).

As I sad before, such a name is entirely irrelevant during rendering.


Also, if the string is intended to reference textures by name, it would
be pretty inefficient to store that information in the texture itself,
as to find a texture you'd have to visit all of them and compare the
string. It would be much faster to store the name->texture mappings in a
separate data structure optimized for such purposes, e.g. a hash map or
a search tree.

And such a data structure wouldn't have to be part of the render engine
anyway: It could easily be set up and managed by whatever program
intends to feed the render engine with data.

The reasons why you're running into so many complications is that you're
trying to somehow shoehorn your Blender-to-POV-Ray bridge into the
existing parser, rather than bypassing the parser entirely.


Post a reply to this message

From: LanuHum
Subject: Re: My idea: Developers need tips! Help me, please!
Date: 5 Nov 2016 10:50:00
Message: <web.581df0db397eea9f7a3e03fe0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 04.11.2016 um 20:26 schrieb LanuHum:
> > Why not add the name of the texture in texture.h to use options?
>
> Because it's entirely irrelevant for the render engine.
>
> > Your text:
> > struct Texture_Struct: public Pattern_Struct
> > {
> >      TextureBlendMapPtr Blend_Map;
> >      int References;
> >      TEXTURE * Next;
> >      string name; // Add your code !!!!!!!!!!!!!!!!
> >
> >
> > It will not affect the code, but it allows you to manipulate using povray as a
> > library...
>
> It will waste memory, adding 40(!) bytes of overhead per texture
> (Windows 64-bit binary; other platforms may vary) even if the name is
> unused.
>
> Even a C-style string (char*) would add 8 bytes of overhead (again
> Windows 64-bit binary).
>
> As I sad before, such a name is entirely irrelevant during rendering.
>
>
> Also, if the string is intended to reference textures by name, it would
> be pretty inefficient to store that information in the texture itself,
> as to find a texture you'd have to visit all of them and compare the
> string. It would be much faster to store the name->texture mappings in a
> separate data structure optimized for such purposes, e.g. a hash map or
> a search tree.
>
> And such a data structure wouldn't have to be part of the render engine
> anyway: It could easily be set up and managed by whatever program
> intends to feed the render engine with data.
>
> The reasons why you're running into so many complications is that you're
> trying to somehow shoehorn your Blender-to-POV-Ray bridge into the
> existing parser, rather than bypassing the parser entirely.

Thanks.
I will sort this out.

I want to keep the possibility of including files written by hand.
Blender does not allow me to establish. Example: the slope_map.
Probably, I will try to add a my GUI texture editor.
But it is a task that must be performed after.
:)


Post a reply to this message

From: LanuHum
Subject: Re: My idea: Developers need tips! Help me, please!
Date: 6 Nov 2016 09:00:00
Message: <web.581f3746397eea9f7a3e03fe0@news.povray.org>
if use C++11:
[ 29%] Building CXX object
CMakeFiles/povanim.dir/source/core/support/octree.cpp.o
/home/leonid/workspace/programming/povanim_povray/povray/source/core/support/octree.cpp:110:55:
warning: missing terminating ' character
         #error 'int' is not 32 bit or does not use two's complement encoding;
try a different C99_COMPATIBLE_RADIOSITY setting in config.h

And:
/home/leonid/workspace/programming/povanim_povray/povray/source/base/image/hdr.cpp:
In function 'void pov_base::HDR::ReadOldLine(unsigned char*, int,
pov_base::IStream*)':
/home/leonid/workspace/programming/povanim_povray/povray/source/base/image/hdr.cpp:135:21:
warning: converting 'false' to pointer type 'const void*' [-Wconversion-null]
         if(*file == false)


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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