POV-Ray : Newsgroups : povray.general : A new SDL Idea Server Time
1 Aug 2024 04:17:14 EDT (-0400)
  A new SDL Idea (Message 101 to 110 of 118)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 8 Messages >>>
From: Bryan Valencia
Subject: Re: A new SDL Idea
Date: 16 Oct 2007 17:39:56
Message: <47152fac$1@news.povray.org>
how about

public static mesh loadfrom3DS(string filename)
{
	//write the code to import 3DS files here.
}

then we can do this:

POVmesh myMesh = loadfrom3DS("somefile.3ds");

//sorry the object keyword is already taken.



---

*runs for cover*

Warp wrote:
> Bryan Valencia <209### [at] gmailcalm> wrote:
>> POVMesh myMesh = new POVMESH.loadfrom3DS("Somefile.3DS");
> 
>   Why the obsession with 'new'?
> 
>   How about:
> 
> Object o = import3DS("Somefile.3ds");
> 
>   More abstract, less confusing syntax. No need for useless 'news'.
> 


-- 
Bryan Valencia

"I'd rather live with false hope than with false despair."


Post a reply to this message

From: andrel
Subject: Re: A new SDL Idea
Date: 16 Oct 2007 17:54:45
Message: <4715342A.6040004@hotmail.com>
Bryan Valencia wrote:
> how about
> 
> public static mesh loadfrom3DS(string filename)
> {
>     //write the code to import 3DS files here.
> }
> 
> then we can do this:
> 
> POVmesh myMesh = loadfrom3DS("somefile.3ds");
> 
> //sorry the object keyword is already taken.
> 
And why would this not be one?


Post a reply to this message

From: Alain
Subject: Re: A new SDL Idea
Date: 16 Oct 2007 22:52:29
Message: <471578ed@news.povray.org>
Bryan Valencia nous apporta ses lumieres en ce 2007/10/16 17:39:
> how about
> 
> public static mesh loadfrom3DS(string filename)
> {
>     //write the code to import 3DS files here.
> }
> 
> then we can do this:
> 
> POVmesh myMesh = loadfrom3DS("somefile.3ds");
> 
> //sorry the object keyword is already taken.
> 
> 
> 
As a mesh IS an object, you can use: object MyMesh = import3DS("MyObject.3ds") 
without any problem nor any conflict.
Here, import3DS(...) is a new function that return a mesh object from a .3DS 
file. It can have a different name if the developing team prefer, such as:
load3DS, loadfrom3DS, ... or load_object(<object_type>, "Object_Name")

-- 
Alain
-------------------------------------------------
Where the press is free and every man able to read, all is safe.
Thomas Jefferson


Post a reply to this message

From: Bruno Cabasson
Subject: Re: A new SDL Idea
Date: 17 Oct 2007 05:05:00
Message: <web.4715cf18bcc3cc02e8ba46670@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Bryan Valencia <209### [at] gmailcalm> wrote:
> > POVMesh myMesh = new POVMESH.loadfrom3DS("Somefile.3DS");
>
>   Why the obsession with 'new'?
>
>   How about:
>
> Object o = import3DS("Somefile.3ds");
>
>   More abstract, less confusing syntax. No need for useless 'news'.
>
> --
>                                                           - Warp


In order to keep current syntax spirit, I would rather propose something
like:

    my_mesh = mesh
    {
        load_file {obj "victoria.obj" [obj-specific options]}
        //load_file {3ds "zorg.3ds" [3ds-specific options]}

        ...

        [OBJECT MODIFIER (= methods calls? like translate, subdivide ...)]
    }

    object {my_mesh texture {...}}


Bruno


PS:
The creation block could stand for
    Mesh my_mesh = new Primitives.Mesh();
    my_mesh.load_obj_file_("victoria.obj", ...);

The object{...}  block could stand for
    Texture my_mesh_texture = new Texture(...);
    my_mesh.setTexture(my_mesh_texture);
    Scene.add(my_mesh);

This kind of notation is classical in OO, but not POV-like. I try to find a
notation that ressembles POV, but uses underlying OO features and general
notational principles. Until now, I had no feed back (I hope it does not
mean I am totally wrong ...)


Post a reply to this message

From: Warp
Subject: Re: A new SDL Idea
Date: 17 Oct 2007 06:45:42
Message: <4715e7d6@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> As a mesh IS an object, you can use: object MyMesh = import3DS("MyObject.3ds") 
> without any problem nor any conflict.
> Here, import3DS(...) is a new function that return a mesh object from a .3DS 
> file. It can have a different name if the developing team prefer, such as:
> load3DS, loadfrom3DS, ... or load_object(<object_type>, "Object_Name")

  The important thing, IMO, is that it doesn't hard-code that what is
returned by the function is precisely a mesh. It should be more abstract
than that.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: A new SDL Idea
Date: 17 Oct 2007 06:47:06
Message: <4715e82a@news.povray.org>
Bruno Cabasson <bru### [at] alcatelaleniaspacefr> wrote:
> In order to keep current syntax spirit, I would rather propose something
> like:

  The problem is that it hard-codes that the imported object is a mesh.
(Can .obj files contain other things too, such as NURBS or whatever?)

-- 
                                                          - Warp


Post a reply to this message

From: Bruno Cabasson
Subject: Re: A new SDL Idea
Date: 17 Oct 2007 09:30:00
Message: <web.47160e0abcc3cc02e8ba46670@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Bruno Cabasson <bru### [at] alcatelaleniaspacefr> wrote:
> > In order to keep current syntax spirit, I would rather propose something
> > like:
>
>   The problem is that it hard-codes that the imported object is a mesh.
> (Can .obj files contain other things too, such as NURBS or whatever?)
>
> --
>                                                           - Warp

Well, ok, right, I agree 100% ... But that's not really the problem of the
principle that POV4 syntax should resemble current one. I don't know about
obj format, but the 'load_file' method of meshes can do such an assumption,
and focus on meshes in the file. However, the 'obj specific options' are
here to tell the import method what to do, like access the target object
through its name or whatever obj format is like.

Then, if 'name' is an attribute of obj format:

my_mesh = mesh
{
    load_file {obj "victoria.obj" name "victoria_body"  [other obj-specific
options]}
    ...
}

I do not address specific details, but the overall principles of the syntax.


Bruno.


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: A new SDL Idea
Date: 17 Oct 2007 13:43:14
Message: <471649b2$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Warp wrote:
> Bruno Cabasson <bru### [at] alcatelaleniaspacefr> wrote:
>> In order to keep current syntax spirit, I would rather propose something
>> like:
> 
>   The problem is that it hard-codes that the imported object is a mesh.
> (Can .obj files contain other things too, such as NURBS or whatever?)
> 
	.obj files can't, but other formats can. So how about:

victoria = object {
   load_file {obj "victoria.obj" [obj-specific options]}
   //load_file {3ds "zorg.3ds" [3ds-specific options]}

   ...
}

object { victoria }

	This would apply to formats that contain other object types, while
keeping a syntax that's closer to the current one.

		Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
|    mailto:jeb### [at] freefr      | ICQ:    238062172            |
|    http://jeberger.free.fr/     | Jabber: jeb### [at] jabberfr   |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHFkmxd0kWM4JG3k8RAqF5AKCLBvv5YMinWIdxiPGsJcuIZ7f++wCfTEy/
pkalLzOY4QKdfsLgvKJFOzU=
=6+RN
-----END PGP SIGNATURE-----


Post a reply to this message

From: Bryan Valencia
Subject: Re: A new SDL Idea
Date: 17 Oct 2007 14:10:37
Message: <4716501d$1@news.povray.org>
Warp wrote:
> Alain <ele### [at] netscapenet> wrote:
>   The important thing, IMO, is that it doesn't hard-code that what is
> returned by the function is precisely a mesh. It should be more abstract
> than that.

Actually no.  I would want a mesh object to be able to load from mesh 
data types only (or be created on the fly in SDL like always)  I would 
never want a CSG union, light source, or bologna sandwich to be able to 
load into a mesh, for instance.

The POVMesh object should descend from a POVObject, just like a 
POVSphere, POVCylinder, POVBlob, POVUnion, etc.  But there should be no 
way that a POVCylinder would implement the loadfrom3DS() method.

Keep in mind that the point of this thread is not about things to do to 
the SDL to improve it (which should also happen), it's about decoupling 
the SDL from the back-end so that we can integrate with more powerful 
languages (along with the SDL).  The examples I gave were not how I 
think the SDL should look at all.  I was envisioning what the code would 
look like in a fully object-oriented language.


-- 
Bryan Valencia

"I'd rather live with false hope than with false despair."


Post a reply to this message

From: Bryan Valencia
Subject: Re: A new SDL Idea
Date: 17 Oct 2007 14:13:43
Message: <471650d7$1@news.povray.org>
Warp wrote:
> Bruno Cabasson <bru### [at] alcatelaleniaspacefr> wrote:
>> In order to keep current syntax spirit, I would rather propose something
>> like:
> 
>   The problem is that it hard-codes that the imported object is a mesh.
> (Can .obj files contain other things too, such as NURBS or whatever?)
> 

No it's not associating ".obj" with meshes.  if you want to import a 
NURB, then you would use the POVNurb.loadfromobj("nurbfile.obj");

Maybe better for the mesh would be 
POVMesh.LoadFromWavefrontObj("somefile.obj");


-- 
Bryan Valencia

"I'd rather live with false hope than with false despair."


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 8 Messages >>>

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