[PR]
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
プログラミング、3DCGとその他いろいろについて
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
どうも紛糾してきたのでMicrosoft.Xna.Framework.Graphics.RenderStateのプロパティについてまとめたいと思います。
1.Alpha Blending
public bool AlphaBlendEnable { get; set; }
public Blend SourceBlend { get; set; }
public Blend DestinationBlend { get; set; }
public BlendFunction BlendFunction { get; set; }
public Color BlendFactor { get; set; }
public bool SeparateAlphaBlendEnabled { get; set; }
public Blend AlphaSourceBlend { get; set; }
public Blend AlphaDestinationBlend { get; set; }
public BlendFunction AlphaBlendOperation { get; set; }
2.Alpha Testing
public bool AlphaTestEnable { get; set; }
public CompareFunction AlphaFunction { get; set; }
public ReferenceAlpha { get; set; }
3.Point Sprite
public bool PointSpriteEnable { get; set; }
public float PointSize { get; set; }
public float PointSizeMax { get; set; }
public float PointSizeMin { get; set; }
4.Culling
public CullMode CullMode { get; set; }
5.Depth Buffering
public DepthBufferEnable { get; set; }
public CompareFunction DepthBufferFunction { get; set; }
public bool DepthBufferWriteEnable { get; set; }
public float DepthBias { get; set; }
public float SlopeScaleDepthBias { get; set; }
6.Fog
public bool FogEnable { get; set; }
public float FogStart { get; set; }
public float FogEnd { get; set; }
public Color FogColor { get; set; }
public float FogDensity { get; set; }
public FogMode FogTableMode { get; set; }
public FogMode FogVertexMode { get; set; }
public bool RangeFogEnable { get; set; }
7.Outline and Fill
public FillMode FillMode { get; set; }
8.Stencil Buffer
public bool StencilEnable { get; set; }
public int ReferenceStencil { get; set; }
public StencilOperation StencilDepthBufferFail { get; set; }
public StencilOperation StencilFail { get; set; }
public CompareFunction StencilFunction { get; set; }
public int StencilMask { get; set; }
public StencilOperation StencilPass { get; set; }
public int StencilWriteMask { get; set; }
public bool TwoSidedStencilMode { get; set; }
public StencilOperation CounterClockwiseStencilDepthBufferFail { get; set; }
public StencilOperation CounterClockwiseStencilFail { get; set; }
public StencilOperation CounterClockwiseStencilFunction { get; set; }
public StencilOperation CounterClockwiseStencilPass { get; set; }
9.Scissor Test
public bool ScissorTestEnable { get; set; }
10.MultiSample
public bool MultiSampleAntiAlias { get; set; }
public int MultiSampleMask { get; set; }
11.Color Write Channels
public ColorWriteChannels ColorWriteChannels { get; set; }
public ColorWriteChannels ColorWriteChannels1 { get; set; }
public ColorWriteChannels ColorWriteChannels2 { get; set; }
public ColorWriteChannels ColorWriteChannels3 { get; set; }
12.Texture Wrapping
public TextureWrapCoordinates Wrap0 { get; set; }
public TextureWrapCoordinates Wrap1 { get; set; }
public TextureWrapCoordinates Wrap2 { get; set; }
public TextureWrapCoordinates Wrap3 { get; set; }
public TextureWrapCoordinates Wrap4 { get; set; }
public TextureWrapCoordinates Wrap5 { get; set; }
public TextureWrapCoordinates Wrap6 { get; set; }
public TextureWrapCoordinates Wrap7 { get; set; }
public TextureWrapCoordinates Wrap8 { get; set; }
public TextureWrapCoordinates Wrap9 { get; set; }
public TextureWrapCoordinates Wrap10 { get; set; }
public TextureWrapCoordinates Wrap11 { get; set; }
public TextureWrapCoordinates Wrap12 { get; set; }
public TextureWrapCoordinates Wrap13 { get; set; }
public TextureWrapCoordinates Wrap14 { get; set; }
public TextureWrapCoordinates Wrap15 { get; set; }
む・・・・・・{ get; set; }はいらなかったかな・・・・・・
セットできないRenderStateに意味は無いわけですし、
セットできてゲットが出来ないプロパティと言うのもあまりないですからね。
久々にJavaを使っていると(JOGL)、
列挙型の使い方がわからなくなったので
今後のためメモしておきます。
まず文脈を話しておくと、
Java用のOpenGL(JOGL)を使っていたのですが、
この定数が汚いんですね。
多くの定数がGLというクラスの中に定義されていて、
しかもその定数の種類というのが、
プリミティブのタイプもカリングモードも
行列の種類もアルファブレンディングも
なにもかもごっちゃになっています。
//プリミティブのタイプを表す定数
GL.GL_POINTS
GL.GL_LINES
GL.GL_LINE_STRIP
GL.GL_LINE_LOOP
GL.GL_TRIANGLES
GL.GL_TRIANGLE_FAN
...
//行列
GL.GL_PROJECTION
GL.GL_MODELVIEW
...(以下略)
ごちゃごちゃです。
まず第一、"GL"をなぜ2度も書かなければならないのか、
そこが不条理です。
そして第二に、目的の異なる定数を1つのクラスに
大量に詰め込むのはよくありません。
どのくらい大量かというと、このくらいです。
もうわけがわかりません。
こんなときには列挙型を使って用途別に分別すべきです。
(そしてGLクラス全体のラッパーを作り始めたのですが、
ここではあまり関係ありません)
とりあえず最初は描画する図形のタイプを
表す定数を列挙型にすることにしました。
しくじってしまったのはここで、
C#のようなやり方をしてはいけません。
Compile Error!
import javax.media.opengl.*; public enum PrimitiveType { Points = GL.GL_POINTS, Lines = GL.GL_LINES, LineStrip = GL.GL_LINE_STRIP, LineLoop = GL.GL_LINE_LOOP, Triangles = GL.GL_TRIANGLES, TriangleFan = GL.GL_TRIANGLE_FAN, Quads = GL.GL_QUADS, QuadStrip = GL.GL_QUAD_STRIP, Polygon = GL.GL_POLYGON }
import javax.media.opengl.*; public enum PrimitiveType { Points(GL.GL_POINTS), Lines(GL.GL_LINES), LineStrip(GL.GL_LINE_STRIP), LineLoop(GL.GL_LINE_LOOP), Triangles(GL.GL_TRIANGLES), TriangleFan(GL.GL_TRIANGLE_FAN), Quads(GL.GL_QUADS), QuadStrip(GL.GL_QUAD_STRIP), Polygon(GL.GL_POLYGON); private int value; PrimitiveType(int value){ this.value = value; } public int value(){ return value; } }