当前位置: 首页>>代码示例>>C#>>正文


C# Channel.getWidth方法代码示例

本文整理汇总了C#中Procedurality.Channel.getWidth方法的典型用法代码示例。如果您正苦于以下问题:C# Channel.getWidth方法的具体用法?C# Channel.getWidth怎么用?C# Channel.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Procedurality.Channel的用法示例。


在下文中一共展示了Channel.getWidth方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Layer

		public Layer(Channel r, Channel g, Channel b) {
			this.width = r.getWidth();
			this.height = r.getHeight();
			this.r = r;
			this.g = g;
			this.b = b;
			this.a = null;
		}
开发者ID:N3X15,项目名称:VoxelSim,代码行数:8,代码来源:Layer.cs

示例2: tile

 public Layer tile(int new_width, int new_height)
 {
     r = r.tile(new_width, new_height);
     g = g.tile(new_width, new_height);
     b = b.tile(new_width, new_height);
     if (a != null) {
         a = a.tile(new_width, new_height);
     }
     width = r.getWidth();
     height = r.getHeight();
     return this;
 }
开发者ID:N3X15,项目名称:Procedurality4NET,代码行数:12,代码来源:Layer.cs

示例3: rotate

 public Layer rotate(int degrees)
 {
     r = r.rotate(degrees);
     g = g.rotate(degrees);
     b = b.rotate(degrees);
     if (a != null) {
         a = a.rotate(degrees);
     }
     width = r.getWidth();
     height = r.getHeight();
     return this;
 }
开发者ID:N3X15,项目名称:Procedurality4NET,代码行数:12,代码来源:Layer.cs

示例4: cropWrap

 public Layer cropWrap(int x_lo, int y_lo, int x_hi, int y_hi)
 {
     r = r.cropWrap(x_lo, y_lo, x_hi, y_hi);
     g = g.cropWrap(x_lo, y_lo, x_hi, y_hi);
     b = b.cropWrap(x_lo, y_lo, x_hi, y_hi);
     if (a != null) {
         a = a.cropWrap(x_lo, y_lo, x_hi, y_hi);
     }
     width = r.getWidth();
     height = r.getHeight();
     return this;
 }
开发者ID:N3X15,项目名称:Procedurality4NET,代码行数:12,代码来源:Layer.cs

示例5: bumpSpecular

 public Layer bumpSpecular(Channel bumpmap, float lx, float ly, float lz, float shadow, float light_r, float light_g, float light_b, int specular)
 {
     if(!(bumpmap.getWidth() == width && bumpmap.getHeight() == height))
         throw new Exception("bumpmap size does not match layer size");
     float lnorm = (float)Math.Sqrt(lx*lx + ly*ly + lz*lz);
     float nz = 4*(1f/Math.Min(width, height));
     float nzlz = nz*lz;
     float nz2 = nz*nz;
     int power = 2<<specular;
     for (int y = 0; y < height; y++) {
         for (int x = 0; x < width; x++) {
             float nx = bumpmap.getPixelWrap(x + 1, y) - bumpmap.getPixelWrap(x - 1, y);
             float ny = bumpmap.getPixelWrap(x, y + 1) - bumpmap.getPixelWrap(x, y - 1);
             float brightness = nx*lx + ny*ly;
             float costheta = (brightness + nzlz)/((float)Math.Sqrt(nx*nx + ny*ny + nz2)*lnorm);
             float highlight;
             if (costheta > 0) {
                 highlight = (float)Math.Pow(costheta, power);
             } else {
                 highlight = 0;
             }
             putPixelClip(x, y,
                 (r.getPixel(x, y) + highlight*light_r)*(bumpmap.getPixel(x, y)*shadow + 1 - shadow),
                 (g.getPixel(x, y) + highlight*light_g)*(bumpmap.getPixel(x, y)*shadow + 1 - shadow),
                 (b.getPixel(x, y) + highlight*light_b)*(bumpmap.getPixel(x, y)*shadow + 1 - shadow));
         }
     }
     return this;
 }
开发者ID:N3X15,项目名称:Procedurality4NET,代码行数:29,代码来源:Layer.cs

示例6: bumpFast

 public Layer bumpFast(Channel bumpmap, float lx, float light, float ambient)
 {
     if(!(bumpmap.getWidth() == width && bumpmap.getHeight() == height))
         throw new Exception("bumpmap size does not match layer size");
     ambient = 1f - ambient;
     for (int y = 0; y < height; y++) {
         for (int x = 0; x < width; x++) {
             float brightness = lx*(bumpmap.getPixelWrap(x + 1, y) - bumpmap.getPixelWrap(x - 1, y));
             if (brightness >= 0) {
                 brightness = brightness*light;
                 putPixel(x, y, r.getPixel(x, y) + brightness,
                     g.getPixel(x, y) + brightness,
                     b.getPixel(x, y) + brightness);
             } else {
                 brightness = brightness*ambient;
                 putPixel(x, y, r.getPixel(x, y) + brightness,
                     g.getPixel(x, y) + brightness,
                     b.getPixel(x, y) + brightness);
             }
         }
     }
     return this;
 }
开发者ID:N3X15,项目名称:Procedurality4NET,代码行数:23,代码来源:Layer.cs

示例7: bump

 public Layer bump(Channel bumpmap, float lx, float ly, float shadow, float light_r, float light_g, float light_b, float ambient_r, float ambient_g, float ambient_b)
 {
     if(!(bumpmap.getWidth() == width && bumpmap.getHeight() == height))
         throw new Exception("bumpmap size does not match layer size");
     for (int y = 0; y < height; y++) {
         for (int x = 0; x < width; x++) {
             float nx = bumpmap.getPixelWrap(x + 1, y) - bumpmap.getPixelWrap(x - 1, y);
             float ny = bumpmap.getPixelWrap(x, y + 1) - bumpmap.getPixelWrap(x, y - 1);
             float brightness = nx*lx + ny*ly;
             if (brightness >= 0) {
                 putPixelClip(x, y, (r.getPixel(x, y) + brightness*light_r)*(bumpmap.getPixel(x, y)*shadow + 1 - shadow),
                     (g.getPixel(x, y) + brightness*light_g)*(bumpmap.getPixel(x, y)*shadow + 1 - shadow),
                     (b.getPixel(x, y) + brightness*light_b)*(bumpmap.getPixel(x, y)*shadow + 1 - shadow));
             } else {
                 putPixelClip(x, y, (r.getPixel(x, y) + brightness*(1 - ambient_r))*(bumpmap.getPixel(x, y)*shadow + 1 - shadow),
                     (g.getPixel(x, y) + brightness*(1 - ambient_g))*(bumpmap.getPixel(x, y)*shadow + 1 - shadow),
                     (b.getPixel(x, y) + brightness*(1 - ambient_b))*(bumpmap.getPixel(x, y)*shadow + 1 - shadow));
             }
         }
     }
     return this;
 }
开发者ID:N3X15,项目名称:Procedurality4NET,代码行数:22,代码来源:Layer.cs

示例8: placeDarkest

		public Channel placeDarkest(Channel sprite, int x_offset, int y_offset) {
			for (int y = y_offset; y < y_offset + sprite.getHeight(); y++) {
				for (int x = x_offset; x < x_offset + sprite.getWidth(); x++) {
					putPixelWrap(x, y, Math.Min(getPixelWrap(x, y), sprite.getPixelWrap(x - x_offset, y - y_offset)));
				}
			}
			return this;
		}
开发者ID:N3X15,项目名称:VoxelSim,代码行数:8,代码来源:Channel.cs

示例9: place

		public Channel place(Channel sprite, Channel alpha, int x_offset, int y_offset) {
			float alpha_val;
			for (int y = y_offset; y < y_offset + sprite.getHeight(); y++) {
				for (int x = x_offset; x < x_offset + sprite.getWidth(); x++) {
					alpha_val = alpha.getPixel(x - x_offset, y - y_offset);
					putPixelWrap(x, y, alpha_val*sprite.getPixelWrap(x - x_offset, y - y_offset) + (1 - alpha_val)*getPixelWrap(x, y));
				}
			}
			return this;
		}
开发者ID:N3X15,项目名称:VoxelSim,代码行数:10,代码来源:Channel.cs

示例10: bump

		public Channel bump(Channel bumpmap, float lx, float ly, float shadow, float light, float ambient) {
			if(!(bumpmap.getWidth() == width && bumpmap.getHeight() == height))
				throw new Exception("bumpmap does not match channel size");
			Channel channel = new Channel(width, height);
			for (int y = 0; y < height; y++) {
				for (int x = 0; x < width; x++) {
					float nx = bumpmap.getPixelWrap(x + 1, y) - bumpmap.getPixelWrap(x - 1, y);
					float ny = bumpmap.getPixelWrap(x, y + 1) - bumpmap.getPixelWrap(x, y - 1);
					float brightness = nx*lx + ny*ly;
					if (brightness >= 0) {
						channel.putPixelClip(x, y, (getPixel(x, y) + brightness*light)*(bumpmap.getPixel(x, y)*shadow + 1 - shadow));
					} else {
						channel.putPixelClip(x, y, (getPixel(x, y) + brightness*(1 - ambient))*(bumpmap.getPixel(x, y)*shadow + 1 - shadow));
					}
				}
			}
			pixels = channel.getPixels();
			return this;
		}
开发者ID:N3X15,项目名称:VoxelSim,代码行数:19,代码来源:Channel.cs

示例11: LoadTerrain

 public static Channel LoadTerrain(String file)
 {
     using (FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
     {
         Bitmap bitmap = new Bitmap(stream);
         try
         {
             Channel terrain = new Channel(bitmap.Width, bitmap.Height);
             Console.WriteLine("LOADED {0}x{1} BITMAP!", bitmap.Height, bitmap.Width);
             for (int x = 0; x < bitmap.Width; x++)
             {
                 for (int y = 0; y < bitmap.Height; y++)
                 {
                     terrain.putPixel(x, y, bitmap.GetPixel(x, y).GetBrightness());
                 }
             }
             Console.WriteLine("LOADED {0}x{1} CHANNEL!", terrain.getHeight(), terrain.getWidth());
             return terrain;//.invert();
         }
         catch (IOException)
         {
             Console.WriteLine("Cannot find " + file + ", using blank channel.");
             return new Channel(256, 256);
         }
     }
 }
开发者ID:N3X15,项目名称:Procedurality4NET,代码行数:26,代码来源:Main.cs


注:本文中的Procedurality.Channel.getWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。