Procházet zdrojové kódy

fixed broken smart quotes.

mitm před 5 roky
rodič
revize
eb302c907f

+ 22 - 22
src/docs/asciidoc/jme3/advanced/material_specification.adoc

@@ -1,6 +1,6 @@
 = jMonkeyEngine3 Material Specification
-:author: 
-:revnumber: 
+:author:
+:revnumber:
 :revdate: 2016/03/17 20:48
 :relfileprefix: ../../
 :imagesdir: ../..
@@ -10,7 +10,7 @@ ifdef::env-github,env-browser[:outfilesuffix: .adoc]
 
 == General Syntax
 
-Material definitions and material instance files are formatted similarly to curly-bracket languages, in other words, you have “blocks and other “blocks nested in them, surrounded by curly-brackets. There are statements inside the blocks, the next statement begins after a new line, or a semi-colon to allow two statements on the same line. Comments are made by prefixing with two slashes, the `/* */` style comments are not allowed.
+Material definitions and material instance files are formatted similarly to curly-bracket languages, in other words, you have "`blocks`" and other "`blocks`" nested in them, surrounded by curly-brackets. There are statements inside the blocks, the next statement begins after a new line, or a semi-colon to allow two statements on the same line. Comments are made by prefixing with two slashes, the `/* */` style comments are not allowed.
 
 *Example:*
 
@@ -40,17 +40,17 @@ The syntax for J3MD and J3M files follows from this base format.
 
 == Material Definition files (J3MD)
 
-Material definitions provide the “logic for the material. Usually a shader that will handle drawing the object, and corresponding parameters that allow configuration of the shader. The J3MD file abstracts the shader and its configuration away from the user, allowing a simple interface where one can simply set a few parameters on the material to change its appearance and the way it's handled.
+Material definitions provide the "`logic`" for the material. Usually a shader that will handle drawing the object, and corresponding parameters that allow configuration of the shader. The J3MD file abstracts the shader and its configuration away from the user, allowing a simple interface where one can simply set a few parameters on the material to change its appearance and the way it's handled.
 
 Material definitions support multiple techniques, each technique describes a different way to draw the object. For example, currently in jME3, an additional technique is used to render shadow maps for example.
 
 
 === Shaders
 
-Shader support inside J3MD files is rather sophisticated. First, shaders may reference shader libraries, in a similar way to Java's “import statement, or C++'s “include pre-processor directive. Shader libraries in turn, can also reference other shader libraries this way. In the end, it is possible for a shader to use many functions together from many libraries and combine them in ways to create a more advanced effect. For example, any shader that wishes to take advantage of hardware skinning, can just import the skinning shader library and use the function, without having to write the specific logic needed for hardware skinning.
+Shader support inside J3MD files is rather sophisticated. First, shaders may reference shader libraries, in a similar way to Java's "`import`" statement, or C++'s "`include`" pre-processor directive. Shader libraries in turn, can also reference other shader libraries this way. In the end, it is possible for a shader to use many functions together from many libraries and combine them in ways to create a more advanced effect. For example, any shader that wishes to take advantage of hardware skinning, can just import the skinning shader library and use the function, without having to write the specific logic needed for hardware skinning.
 
-Shaders can also take advantage of “defines that are specified inside material definitions.
-The defines “bind into material parameters, so that a change in a material parameter can apply or remove a define from the corresponding shader. This allows the shader to completely change in behavior during run-time.
+Shaders can also take advantage of "`defines`" that are specified inside material definitions.
+The defines "`bind`" into material parameters, so that a change in a material parameter can apply or remove a define from the corresponding shader. This allows the shader to completely change in behavior during run-time.
 
 Although it is possible to use shader uniforms for the very same purpose, those may introduce slowdowns in older GPUs, that do not support branching. In that case, using defines can allow changing the way the shader works without using shader uniforms. In order to introduce a define into a shader, however, its source code must be changed, and therefore, it must be re-compiled. It is therefore not recommended to change define bound parameters often.
 
@@ -68,16 +68,16 @@ MaterialDef Test Material 123 {
 
 Inside a MaterialDef block, there can be at most one MaterialParameters block, and one or more `Technique` blocks.
 
-Techniques may have an optional name, which specifies the name of the technique. If no name is specified for a technique, then its name is “Default, and it is used by default if the user does not specify another technique to use for the material.
+Techniques may have an optional name, which specifies the name of the technique. If no name is specified for a technique, then its name is "`Default`", and it is used by default if the user does not specify another technique to use for the material.
 
 *Example of J3MD:*
 
 [source]
 ----
-MaterialDef Test Material 123 { 
+MaterialDef Test Material 123 {
   MaterialParameters { }
   Technique { }
-  Technique NamedTech { } 
+  Technique NamedTech { }
 }
 ----
 
@@ -100,7 +100,7 @@ Whereas in the J3MD file, the parameter names and types are specified, in a J3M
 
 At the time of writing, the following types of parameters are allowed inside J3MD files: Int, Boolean, Float, Vector2, Vector3, Vector4, Texture2D, TextureCubeMap.
 
-You can specify a default value for material parameters, inside material definitions, in the case that no value is specified in the material instance. 
+You can specify a default value for material parameters, inside material definitions, in the case that no value is specified in the material instance.
 
 [source]
 ----
@@ -119,9 +119,9 @@ Techniques are more advanced blocks than the MaterialParameters block. Technique
 
 In this section, the statements and nested blocks that are allowed inside the Technique block will be described.
 
-The two most important statements, are the `FragmentShader` and `VertexShader` statements. These statements specify the shader to use for the technique, and are required inside the “Default technique. Both operate in the same way, after the statement, the language of the shader is specified, usually with a version number as well, for example `GLSL100` for OpenGL Shading Language version 1.00. Followed by a colon and an absolute path for an asset describing the actual shader source code. For GLSL, it is permitted to specify .glsl, .frag, and .vert files.
+The two most important statements, are the `FragmentShader` and `VertexShader` statements. These statements specify the shader to use for the technique, and are required inside the "`Default`" technique. Both operate in the same way, after the statement, the language of the shader is specified, usually with a version number as well, for example `GLSL100` for OpenGL Shading Language version 1.00. Followed by a colon and an absolute path for an asset describing the actual shader source code. For GLSL, it is permitted to specify .glsl, .frag, and .vert files.
 
-When the material is applied to an object, the shader has its uniforms set based on the material parameter values specified in the material instance. but the parameter is prefixed with an“m_.
+When the material is applied to an object, the shader has its uniforms set based on the material parameter values specified in the material instance. but the parameter is prefixed with an "`m_`".
 
 For example, assuming the parameter `Shininess` is defined in the MaterialParameters block like so:
 
@@ -132,7 +132,7 @@ MaterialParameters {
 }
 ----
 
-The value of that parameter will map into an uniform with same name with the “m_ prefix in the GLSL shader:
+The value of that parameter will map into an uniform with same name with the "`m_`" prefix in the GLSL shader:
 
 [source]
 ----
@@ -161,7 +161,7 @@ The shader will be able to access this parameter through a uniform, also named `
 uniform float g_Time;
 ----
 
-The `g` letter stands for “global, which is considered a synonym with “world in the context of parameter scope.
+The `g` letter stands for "`global`", which is considered a synonym with "`world`" in the context of parameter scope.
 
 There are many world parameters available for shaders, a comprehensive list will be specified elsewhere.
 
@@ -187,7 +187,7 @@ Included is a full example of a J3MD file using all the features learned:
 
 [source]
 ----
-MaterialDef Test Material 123 { 
+MaterialDef Test Material 123 {
   MaterialParameters {
     Float m_Shininess
     Texture2D m_MyTex
@@ -201,7 +201,7 @@ MaterialDef Test Material 123 {
     RenderState {
       Blend Alpha
     }
-  } 
+  }
 }
 ----
 
@@ -219,18 +219,18 @@ All J3M files begin with the word `Material` followed by the name of the materia
 Material MyGrass : Common/MatDefs/Misc/TestMaterial.j3md {
 ----
 
-The material definition is a required component, depending on the material definition being used, the appearance and functionality of the material changes completely. Whereas the material definition provided the “logic for the material, the material instance provides the configuration for how this logic operates.
+The material definition is a required component, depending on the material definition being used, the appearance and functionality of the material changes completely. Whereas the material definition provided the "`logic`" for the material, the material instance provides the configuration for how this logic operates.
 
 The J3M file includes only a single structure; MaterialParameters, analogous to the same-named structure in the J3MD file. Whereas the J3MD file specified the parameter names and types, the J3M file specifies the values for these parameters. By changing the parameters, the configuration of the parent J3MD changes, allowing a different effect to be achieved.
 
-To specify a value for a parameter, one must specify first the parameter name, followed by a colon, and then followed by the parameter value. For texture parameters, the value is an absolute asset path pointing to the image file. Optionally, the path can be prefixed with the word “Flip in order to flip the image along the Y-axis, this may be needed for some models.
+To specify a value for a parameter, one must specify first the parameter name, followed by a colon, and then followed by the parameter value. For texture parameters, the value is an absolute asset path pointing to the image file. Optionally, the path can be prefixed with the word "`Flip`" in order to flip the image along the Y-axis, this may be needed for some models.
 
 *Example of a MaterialParameters block in J3M:*
 
 [source]
 ----
 MaterialParameters {
-  m_Shininess : 20.0 
+  m_Shininess : 20.0
 }
 ----
 [cols="2", options="header"]
@@ -269,7 +269,7 @@ The formatting of the value, depends on the type of the value that was specified
 
 [source]
 ----
-Material MyGrass : Common/MatDefs/Misc/TestMaterial.j3md { 
+Material MyGrass : Common/MatDefs/Misc/TestMaterial.j3md {
   MaterialParameters {
     m_MyTex : Flip Textures/GrassTex.jpg
     m_Shininess : 20.0
@@ -300,4 +300,4 @@ mat.setFloat("Shininess", 20.0f);
 
 == Conclusion
 
-Congratulations on being able to read this entire document! To reward your efforts, jMonkeyEngine.com will offer a free prize, please contact Momoko_Fan aka “Kirill Vainer with the password “bananapie to claim.
+Congratulations on being able to read this entire document! To reward your efforts, jMonkeyEngine.com will offer a free prize, please contact Momoko_Fan aka "`Kirill`" Vainer with the password "`bananapie`" to claim.