Description Edit

UI3DScene is an element of the NWN2's GUI which displays a 3D view of a creature.

A simple UI3DScene is defined as follows:

<UI3DScene OnRender=UI3DScene_OnRender_DisplaySceneCreature() />

The above example will produce a minimalist 3DScene, with default lights and camera orientation, showing the creature which handles the GUI. See below:

3dscene minimal

Attributes Edit

AttributeTypeDefault valuePredefined constantsDescription
namestringnonenoneThe name of the element, used to reference it in scripts.
xint0ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHTHorizontal coordinates in the parent element.
yint0ALIGN_TOP, ALIGN_CENTER, ALIGN_BOTTOMVertical coordinates in the parent element.
texturestringnonenoneBackground image (example: "inv_3d_bg.tga").
cameralook_xfloat0noneCamera orientation, x axis.
cameralook_yfloat0noneCamera orientation, y axis.
cameralook_zfloat0noneCamera orientation, z axis.
camerapos_xfloat0noneCamera position, x plane.
camerapos_yfloat0noneCamera position, y plane.
camerapos_zfloat0noneCamera position, z plane.
ambground_intensfloat0noneGround light, intensity.
ambgroundcolor_rfloat0noneGround light, red.
ambgroundcolor_gfloat0noneGround light, green.
ambgroundcolor_bfloat0noneGround light, blue.
ambsky_intensfloat0noneSky light, intensity.
ambskycolor_rfloat0noneSky light, red.
ambskycolor_gfloat0noneSky light, green.
ambskycolor_bfloat0noneSky light, blue.
light_intensfloat0noneGlobal light, intensity.
lightdir_xfloat0noneGlobal light orientation, x axis.
lightdir_xfloat0noneGlobal light orientation, y axis.
lightdir_xfloat0noneGlobal light orientation, z axis.
diffusecolor_rfloat0noneColor diffusion, red.
diffusecolor_gfloat0noneColor diffusion, green.
diffusecolor_bfloat0noneColor diffusion, blue.
updateboolfalsenoneTriggers the OnUpdate event.

Events Edit

OnRender Edit

The OnRender event occurs when the UI3DScene is diplayed on screen.

It is known to be usable with the following functions:

OnUpdate Edit

The OnUpdate event occurs when the UI3DScene is updated.

It is known to be usable with the following functions:

OnMouseDropReceived Edit

The OnMouseDropReceived event occurs when an element is dropped on the UI3DScene.

It is known to be usable with the following functions:

Examples Edit

Here is how to create a UI3DScene more evolved than the minimal one:

<UI3DScene name="3DScene" x="ALIGN_CENTER" y="ALIGN_CENTER" width="136" height="248" texture="inv_3d_bg.tga"
    cameralook_x="0.0" cameralook_y="0.0" cameralook_z="1.25"
    camerapos_x="0.25" camerapos_y="2.70" camerapos_z="1.70"
    ambground_intens=".4" ambgroundcolor_r=".7" ambgroundcolor_g=".55" ambgroundcolor_b=".4"
    ambsky_intens=".8" ambskycolor_r=".3" ambskycolor_g=".4" ambskycolor_b=".78"
    light_intens="1.0" diffusecolor_r="1.10" diffusecolor_g="1.0" diffusecolor_b="1.0"
    lightdir_x="1.0" lightdir_y="1.0" lightdir_z="2.15"
    OnRender=UI3DScene_OnRender_DisplaySceneCreature() />

And it looks like this:

3dscene better

More Edit

It's also possible to add custom lights to the 3DScene by using the element UIPointLight.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.