:orphan:

===========
TKE_Texture
===========

Opcode
======

.. csv-table::

	"ASCII", "t"
	"Hexadecimal", "74"
	"Decimal", "116"


Operands
========

| Byte name_length, (name_length)xByte name, 
| Byte image_length, (image_length)xByte image_name, 
| Short options, [Byte parameter_source], [Byte tiling], 
| [Byte interpolation], [Byte decimation], 
| [Byte red_mapping], [Byte green_mapping], 
| [Byte blue_mapping], [Byte alpha_mapping], 
| [Byte param_function], [Byte layout], 
| [(2)xByte value_scale], [Byte transform_length], 
| [(transform_length)xByte transform_segment] 

.. raw:: html

	<table BORDER =1 WIDTH="530">
	  <tr> 
		<td WIDTH="131" HEIGHT="21">name_length</td>
		<td WIDTH="390" HEIGHT="21">length of texture name string</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">name</td>
		<td WIDTH="390" HEIGHT="21">name of texture</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">image_length</td>
		<td WIDTH="390" HEIGHT="21">length of image name string</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">image_name</td>
		<td WIDTH="390" HEIGHT="21">name of image on which the texture is based</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">options</td>
		<td WIDTH="390" HEIGHT="21">flags indicating optional fields</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">parameter_source</td>
		<td WIDTH="390" HEIGHT="21">initial values used for texture lookup, usually 
		  UV parametric values</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">tiling</td>
		<td WIDTH="390" HEIGHT="21">indicates how parameter values outside the 
		  0-1 range are handled.</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">interpolation</td>
		<td WIDTH="390" HEIGHT="21">indicates texture sampling when a texture 
		  pixel spans multiple display pixels</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">decimation</td>
		<td WIDTH="390" HEIGHT="21">indicates texture sampling when a display 
		  pixel covers multiple texture pixels</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">red_mapping</td>
		<td WIDTH="390" HEIGHT="21">enumeration of source choices for red value</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">green_mapping</td>
		<td WIDTH="390" HEIGHT="21">enumeration of source choices for green value</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">blue_mapping</td>
		<td WIDTH="390" HEIGHT="21">enumeration of source choices for blue value</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">alpha_mapping</td>
		<td WIDTH="390" HEIGHT="21">enumeration of source choices for alpha value</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">param_function</td>
		<td WIDTH="390" HEIGHT="21">initial remapping function for parameter values</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">layout</td>
		<td WIDTH="390" HEIGHT="21">arrangement of useful picture data within 
		  the image</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">value_scale</td>
		<td WIDTH="390" HEIGHT="21">amount to scale and shift color values</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">transform_length</td>
		<td WIDTH="390" HEIGHT="21">length of transform segment name</td>
	  </tr>
	  <tr> 
		<td WIDTH="131" HEIGHT="21">transform_segment</td>
		<td WIDTH="390" HEIGHT="21">name of a segment containing an additional 
		  texture_matrix to apply</td>
	  </tr>
	</table>
	
	
Notes
=====

Textures define a form of image which can be stretched and applied to a surface. The simplest form is indeed just an image; as each pixel on the surface is drawn, a color is selected from a corresponding spot on the image. The ``options`` allow for changes to the correspondence between points, and/or changes to the color selected.

For the specific definitions on what the various texture option bits mean in HOOPS/3dGS please refer to the ``Define_Texture`` specification in the 3dGS Reference Manual.


Option bits
-----------

.. raw:: html

	<table BORDER =1 WIDTH="330">
	  <TR> 
		<TD height=21 width=50>0001</TD>
		<TD height=21 width=190>Parameter Source</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0002</TD>
		<TD height=21 width=190>Tiling</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0004</TD>
		<TD height=21 width=190>Interpolation</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0008</TD>
		<TD height=21 width=190>Decimation</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0010</TD>
		<TD height=21 width=190>Red Channel Mapping</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0020</TD>
		<TD height=21 width=190>Green Channel Mapping</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0040</TD>
		<TD height=21 width=190>Blue Channel Mapping</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0080</TD>
		<TD height=21 width=190>Alpha Channel Mapping</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0100</TD>
		<TD height=21 width=190>Parameter Function</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0200</TD>
		<TD height=21 width=190>Layout</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0400</TD>
		<TD height=21 width=190>Transform Segment Name</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0800</TD>
		<TD height=21 width=190>Value Scale</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>1000</TD>
		<TD height=21 width=190>Caching</TD>
	  </TR>
	</table>


Parameter sources
-----------------

.. raw:: html

	<table BORDER =1 WIDTH="330">
	  <TR> 
		<TD height=21 width=50>0</TD>
		<TD height=21 width=190>U</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>1</TD>
		<TD height=21 width=190>UV</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>2</TD>
		<TD height=21 width=190>UVW</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>3</TD>
		<TD height=21 width=190>Object Space XYZ</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>4</TD>
		<TD height=21 width=190>World Space XYZ</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>5</TD>
		<TD height=21 width=190>Surface Normal</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>6</TD>
		<TD height=21 width=190>Reflection Vector</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>7</TD>
		<TD height=21 width=190>Natural UV</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>8</TD>
		<TD height=21 width=190>Local Pixels</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>9</TD>
		<TD height=21 width=190>Outer Pixels</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>10</TD>
		<TD height=21 width=190>Local Window</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>11</TD>
		<TD height=21 width=190>Outer Window</TD>
	  </TR>
	</table>


Parameter functions
-------------------

.. raw:: html

	<table BORDER =1 WIDTH="330">
	  <TR> 
		<TD height=21 width=50>0</TD>
		<TD height=21 width=190>None</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>1</TD>
		<TD height=21 width=190>Sphere</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>2</TD>
		<TD height=21 width=190>Cylinder</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>3</TD>
		<TD height=21 width=190>Box</TD>
	  </TR>
	</table>


Parameter layouts
-----------------

.. raw:: html

	<table BORDER =1 WIDTH="330">
	  <TR> 
		<TD height=21 width=50>0</TD>
		<TD height=21 width=190>Rectilinear</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>1</TD>
		<TD height=21 width=190>Spherical</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>2</TD>
		<TD height=21 width=190>Hemispherical</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>3</TD>
		<TD height=21 width=190>Cubic Faces</TD>
	  </TR>
	</table>


Parameter tilings
-----------------

.. raw:: html

	<table BORDER =1 WIDTH="330">
	  <TR> 
		<TD height=21 width=50>0</TD>
		<TD height=21 width=190>None</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>1</TD>
		<TD height=21 width=190>Clamp</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>2</TD>
		<TD height=21 width=190>Repeat</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>3</TD>
		<TD height=21 width=190>Mirror</TD>
	  </TR>
	</table>


Texture filters
---------------

.. raw:: html

	<table BORDER =1 WIDTH="330">
	  <TR> 
		<TD height=21 width=50>0</TD>
		<TD height=21 width=190>None</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>1</TD>
		<TD height=21 width=190>Bilinear</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>2</TD>
		<TD height=21 width=190>Trilinear</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>3</TD>
		<TD height=21 width=190>MipMap</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>4</TD>
		<TD height=21 width=190>Summed Areas</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>5</TD>
		<TD height=21 width=190>Gaussian</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>6</TD>
		<TD height=21 width=190>Stochastic</TD>
	  </TR>
	</table>


Channel mappings
----------------

.. raw:: html

	<table BORDER =1 WIDTH="330">
	  <TR> 
		<TD height=21 width=50>0</TD>
		<TD height=21 width=190>Red</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>1</TD>
		<TD height=21 width=190>Green</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>2</TD>
		<TD height=21 width=190>Blue</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>3</TD>
		<TD height=21 width=190>Alpha</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>4</TD>
		<TD height=21 width=190>Zero</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>5</TD>
		<TD height=21 width=190>One</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>6</TD>
		<TD height=21 width=190>Luminance</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>7</TD>
		<TD height=21 width=190>None</TD>
	  </TR>
	</table>
