[tubras] r1892 committed - irrb - added PolygonOffsetFactor/Direction.

8 views
Skip to first unread message

tub...@googlecode.com

unread,
Dec 29, 2011, 1:22:48 PM12/29/11
to tubras-s...@googlegroups.com
Revision: 1892
Author: pc0...@gmail.com
Date: Thu Dec 29 10:22:13 2011
Log: irrb - added PolygonOffsetFactor/Direction.

http://code.google.com/p/tubras/source/detail?r=1892

Modified:
/trunk/tools/irrb/doc/material_panel.rst
/trunk/tools/irrb/io_export_irrlicht.py

=======================================
--- /trunk/tools/irrb/doc/material_panel.rst Thu Dec 29 04:52:01 2011
+++ /trunk/tools/irrb/doc/material_panel.rst Thu Dec 29 10:22:13 2011
@@ -57,6 +57,107 @@
Irrlicht Material Texture Layers
================================
Irrlicht allows up to four texture layers (`SMaterialLayer
<http://irrlicht.sourceforge.net/docu/classirr_1_1video_1_1_s_material_layer.html>`_)
-to be defined per material.
-
-
+to be defined per material. All of the pre-defined Irrlicht material
types use
+at most two texture layers. The current Irrlicht internal vertex format
support
+at most two set of UV coordinates.
+
+Each texture layer is made up of information that includes an
image/texture reference
+and various other properties. **irrB** allows you to specify the image
reference in
+Blender in two different ways.
+
+**UV Mapped Image**. Using Blender's UV Image Editor, you may assign one
or more images
+to the various UV mapped faces within the UV Image Editor itself.
+
+**Blender Texture Slot**. Blender allows one or more "texture slots" to be
assigned
+to a material.
+
+Regardless of the method you use to specify the image reference for a
texture layer,
+the layers associated properties are defined within the Irrlicht material
property
+panel.
+
+----
+
+irrB Irrlicht Material Properties
+=====================================
+
+Irrlicht material properties may be found underneath Blender's Material
panel group.
+
+**Type** - Type of material. Choices available are the 24 pre-defined
Irrlicht material types.
+You may also choose "Custom" if you have created your own material type.
When "Custom" is selected,
+a field named "Custom Name" will appear. Use this field to enter your
custom material name.
+
+**Lighting** - Whether or not this material will be lit.
+
+**Backface Culling** - Whether or not backface culling is enabled. If
enabled, backfaces won't
+be visible. If disabled, backfaces will be visible (double-sided).
+
+**ZWriteEnable** - Whether or not the zbuffer is writable.
+
+**Normalize Normals** - Whether or not the normals should be normalized.
Use this
+if the mesh is lit and scaled.
+
+**Link Diffuse** - Whether or not to link the diffuse color to Blender's
material diffuse
+property.
+
+**Gouraud** - Whether or not to use Gouraud or flat shading.
+
+**Frontface Culling** - Whether or not frontface culling is enabled. If
enabled, frontfaces won't
+be visible. If disabled, frontfaces will be visible.
+
+**Fog** - Whether or not fog is enabled for this material.
+
+**Use MipMaps** - Whether or not mipmaps are enabled.
+
+**Use Blender Textures** - Whether or not to use textures/images from
Blender's texture slots.
+
+**ZBuffer** - ZBuffer comparison method for depth buffer test. "Never"
(disabled), "Less or Equal",
+"Equal", "Less", "Not Equal" "Greator or Equal", "Greator", "Always".
+
+**Antialiasing** - Whether or not anti-aliasing is enabled
(EAAM_LINE_SMOOTH).
+
+**Color Material** - Defines the interpretation of vertex color in the
lighting equation.
+Values should be chosen from E_COLOR_MATERIAL. When lighting is enabled,
vertex color can
+be used instead of the material values for light modulation. This allows
to easily change e.g.
+the diffuse light behavior of each face. The default, ECM_DIFFUSE, will
result in
+a very similar rendering as with lighting turned off, just with light
shading.
+
+**Ambient** - How much ambient light (a global light) is reflected by this
material.
+
+**Emissive** - Light emitted by this material.
+
+**Diffuse** - How much diffuse light coming from a light source is
reflected by this material.
+
+**Specular** - How much specular light (highlights) is reflected.
See "Shininess" on how to
+enable specular lights.
+
+**Color Mask** - Defines the enabled color planes. Only enabled color
planes will be rendered
+to the current render target.
+
+**Param1** - Free parameter, dependent on the material type. Used for
example by the
+EMT_PARALLAX_MAP_SOLID and EMT_TRANSPARENT_ALPHA_CHANNEL material types.
+
+**Param2** - Free parameter, dependent on the material type.
+
+**Shininess** - Value affecting the size of the specular highlights. A
value of 20 is
+common. If set to 0, no specular highlights are used. To activate, set
the shininess
+of a material in the range 0.5-128.
+
+**Thickness** - Thickness of non-3dimensional elements such as lines and
points.
+
+Texture Layer Properties
+
+**UV Wrap Modes** - Texture clamp mode: "Repeat", "Clamp", "Clamp To
Edge",
+"Clamp To Border", "Mirror", "Mirror Clamp", "Mirror Clamp To Edge", and
+"Mirror Clamp To Border"
+
+**Filter** - Filter method to use. "None", "Bilinear", "Trilinear".
+
+**Anisotropic** - In Irrlicht you can use anisotropic filtering in
conjunction with
+bilinear or trilinear texture filtering to improve render results. Value
should be
+in the range 2-16. 0 & 1 is disabled.
+
+**LOD Bias** - Bias for mipmap selection. This value can make the textures
more or
+less blurry than with the default value of 0. The value (divided by 8.f)
is added
+to the mipmap level chosen initially, and thus takes a smaller mipmap for
a region
+if the value is positive.
+
=======================================
--- /trunk/tools/irrb/io_export_irrlicht.py Thu Dec 29 04:52:01 2011
+++ /trunk/tools/irrb/io_export_irrlicht.py Thu Dec 29 10:22:13 2011
@@ -345,6 +345,8 @@
'ZBuffer': 1,
'AntiAliasing': 5, # EAAM_SIMPLE | EAAM_LINE_SMOOTH,
'ColorMask': 15, # ECP_ALL
+ 'PolygonOffsetFactor': 0,
+ 'PolygonOffsetDirection': 'Front',
'Layer1': {
'Texture': '',
'TextureWrap': 'texture_clamp_repeat', # <= 1.6
@@ -2000,7 +2002,7 @@

bpy.types.Material.irrb_shininess = FloatProperty(name='Shininess',
description='Specular shininess', default=0.0,
- min=sys.float_info.min, max=sys.float_info.max,
+ min=0.0, max=128.0,
soft_min=sys.float_info.min, soft_max=sys.float_info.max,
step=3, precision=2,
options=emptySet)
@@ -2015,6 +2017,18 @@

bpy.types.Material.irrb_use_blender_textures = BoolProperty(name='Use
Blender Textures',
description='Use images from Blender texture layers',
default=False, options=emptySet)
+
+ bpy.types.Material.irrb_polyoffset_factor = IntProperty(name='Poly
Offset Factor',
+ description='Polygon Offset Factor',
+ min=0, max=7, default=0, options=emptySet)
+
+ bpy.types.Material.irrb_polyoffset_direction = EnumProperty(name='Poly
Offset Direction',
+ items=(('POLY_OFFDIR_FRONT', 'Front', ''),
+ ('POLY_OFFDIR_BACK', 'Back', ''),
+ ),
+ default='POLY_OFFDIR_FRONT',
+ description='Direction the polygon offset is applied to',
+ options=emptySet)

wrap_options = (('ETC_REPEAT', 'Repeat', ''),
('ETC_CLAMP', 'Clamp', ''),
@@ -2309,6 +2323,13 @@
self.attributes['ZBuffer'] = E_COMPARISON_FUNC[bmat.irrb_zbuffer]
self.attributes['AntiAliasing'] = \
E_ANTI_ALIASING_MODE[bmat.irrb_antialiasing]
+
+ self.attributes['PolygonOffsetFactor'] =
int(bmat.irrb_polyoffset_factor)
+
+ pdir = 'Front'
+ if bmat.irrb_polyoffset_direction == 'POLY_OFFDIR_BACK':
+ pdir = 'Back'
+ self.attributes['PolygonOffsetDirection'] = pdir

cmask = 0
if bmat.irrb_color_mask_alpha:
@@ -2423,6 +2444,10 @@
self.attributes['AntiAliasing'])
self._iwrite(file, i2, 'int', 'ColorMask',
self.attributes['ColorMask'])
+ self._iwrite(file, i2, 'int', 'PolygonOffsetFactor',
+ self.attributes['PolygonOffsetFactor'])
+ self._iwrite(file, i2, 'enum', 'PolygonOffsetDirection',
+ self.attributes['PolygonOffsetDirection'])

for i in range(1, textureCount + 1):
lname = 'Layer{}'.format(i)
@@ -5805,6 +5830,14 @@
row = layout.row()
row.label('Color Material')
row.prop(mat, 'irrb_color_material', '')
+
+ row = layout.row()
+ row.label('Polygon Offset Factor')
+ row.prop(mat, 'irrb_polyoffset_factor', '')
+
+ row = layout.row()
+ row.label('Polygon Offset Direction')
+ row.prop(mat, 'irrb_polyoffset_direction', '')

row = layout.row()
row.label(text='Ambient')

Reply all
Reply to author
Forward
0 new messages