ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperLicht
forum topic indicator Add transparent material to a cubenode
person icon
bagg
Registered User
Quote
2010-11-07 11:17:05

Hi Niko.

At First i want to report some bugs that i discovered in CL3D.Vect3d.
When you use addToThis(other) or just add(other) instead of adding a number it adds a string in the Y coordinate.For example if the first vector Y = 100 and the other vector Y = 0 instead of 100 it brings up 1000.And i think that's why in my previous post the object was disappearing when i was using

SelSceneNode.Pos.addToThis(yourMovementDirection);

And then i discovered and something else.When an object is rotated in an angle between >0 <90 and >270 <360 then the {Vect3d} substract(other) and {Vect3d} add(other) are not working right (The final position is not right).In all the other rotations they are working right.

And finally my question of the day.
How can i set a transparent material with colour in a cubenode?
e.g
// set material texture of the cube:
cubenode.getMaterial(0).Tex1 =
engine.getTextureManager().getTexture("crate_wood.jpg", true);

How can i change this material to be a transparent red material?

Thanks.

person icon
niko
Moderator
Quote
2010-11-08 16:48:08

Hi,
if you are supplying a string instead of a number to vect3d or any javascript function, of course something like this happens. But the function itself is ok, otherwise Copperlicht wouldn't work at all, it uses vect3d heavily in all parts of the engine.

About the transparency question: There is no material like this in CopperLicht (yet), if you want something like this, simply write your own shader for this (see the shader tutorial).

person icon
bagg
Registered User
Quote
2010-11-08 18:02:48

I am not supplying a string i am giving a number.Here is the code

var VectorToAdd = new CL3D.Vect3d ();
VectorToAdd.normalize();
VectorToAdd.set(0,0,0);
var NewPosAdd = TargetBBox.getCenter().add(VectorToAdd);
alert (NewPosAdd);

The TargetBBox.getCenter() is (100,100,100);

The alert is 100, 1000, 100

Ok later i found that the Y is always a string

for example the following

SomeBoundingBoxDims=SomeSceneNode.getTransformedBoundingBox().getExtent();

Now if you add to the Y a number

SomeBoundingBoxDims.Y=SomeBoundingBoxDims.Y+100;

It gives the right result

But if you add it like this

SomeBoundingBoxDims.Y=SomeBoundingBoxDims.Y+SomeSceneNode.Pos.Y;

It gives a string

if you replace with this

SomeBoundingBoxDims.Y=SomeBoundingBoxDims.Y+parseInt(SomeSceneNode.Pos.Y);

It gives the right result !!!!!!

This is not happening with X and Z

And my question of the day.

Can you give me an example on how to use

CL3D.Material.EMT_TRANSPARENT_ADD_COLOR
Transparent additive material, constant for using in Material.Type, specifying the type of the material.

Thanks.

person icon
niko
Moderator
Quote
2010-11-09 17:01:17

So somehow SomeSceneNode.Pos.Y was set to a string and not a number. Any chance this didn't happen somewhere in your code?
I've tested this locally and read through the code, but everything seems to be correct. Maybe you could post a _complete_ example how to reproduce this, so I can verify this?

About the material type: Works simple as this:

someSceneNode.getMaterial(0).Type = CL3D.Material.EMT_TRANSPARENT_ADD_COLOR;


person icon
bagg
Registered User
Quote
2010-11-09 18:09:42

Thanks i'll come back with an example

person icon
bagg
Registered User
Quote
2010-11-10 12:54:17

Dear Niko Sorry.

The mistake was in my code the Pos.Y was a string.But i didn't knew that you can set a string in an Objects Position.Normally it should alert an error in debugging.Sorry again.

And my today's question is:

Is there any possible way to make the CL3D.Line3d renderable? (Visible).
It is very important for my project !!!!!!!!!!!!!

And another thing
Is this code right?

var Plane=new CL3D.Plane3d()
var point1= new CL3D.Vect3d(0,0,0);
var point2= new CL3D.Vect3d(100,0,0);
var point3= new CL3D.Vect3d(100,0,100);
Plane.setPlaneFrom3Points(point1, point2, point3);
engine.getScene().getRootSceneNode().addChild(Plane);

Because i can't see the plane.Is it renderable or it's invisible like the Line3d?

Thanks.

person icon
niko
Moderator
Quote
2010-11-11 11:29:33

There is currently no way to render a 3d line, sorry. You could do this yourself by constructing some triangles, forming a line.

Same with plane: It's just a mathematical construct. You have to use triangles and scene node to do do 3d drawing.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |