• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DefaultShaderProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider的典型用法代码示例。如果您正苦于以下问题:Java DefaultShaderProvider类的具体用法?Java DefaultShaderProvider怎么用?Java DefaultShaderProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DefaultShaderProvider类属于com.badlogic.gdx.graphics.g3d.utils包,在下文中一共展示了DefaultShaderProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: GameRenderer

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
public GameRenderer(Viewport viewport, Camera camera, GameEngine engine) {
	this.viewport = viewport;
	this.camera = camera;
	this.engine = engine;

	shapeRenderer = new MyShapeRenderer();
	shapeRenderer.setAutoShapeType(true);

	spriteBatch = new SpriteBatch();
	font = new BitmapFont();
	font.setColor(Color.WHITE);
	font.setUseIntegerPositions(false);
	font.getData().setScale(0.01f);
	shadowBatch = new ModelBatch(new DepthShaderProvider());

	ShaderProgram.pedantic = false;
	final String vertUber = Gdx.files.internal("shaders/uber.vert").readString();
	final String fragUber = Gdx.files.internal("shaders/uber.frag").readString();
	modelBatch = new ModelBatch(new DefaultShaderProvider(vertUber, fragUber) {
		@Override
		protected Shader createShader(final Renderable renderable) {
			return new UberShader(renderable, config);
		}
	});
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:26,代码来源:GameRenderer.java


示例2: create

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
@Override
	public void create () {
		modelBatch = new ModelBatch(new DefaultShaderProvider());
// modelBatch = new ModelBatch();
		environment = new Environment();
		environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
		environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

		cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
		cam.position.set(10f, 10f, 10f);
		cam.lookAt(0, 0, 0);
		cam.near = 0.1f;
		cam.far = 300f;
		cam.update();

		ModelBuilder modelBuilder = new ModelBuilder();
		model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position
			| Usage.Normal);
		instance = new ModelInstance(model);

// model = new G3dModelLoader(new UBJsonReader()).loadModel(Gdx.files.internal("data/g3d/knight.g3db"));
// instance = new ModelInstance(model);

		Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
	}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:26,代码来源:Basic3DTest.java


示例3: initialize

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
@Override
protected void initialize() {
  displayableCollections = new Array<Array<? extends Displayable>>();

  modelDisplayables = new Array<ModelDisplayable>();
  displayableCollections.add(modelDisplayables);

  decalDisplayables = new Array<DecalDisplayable>();
  displayableCollections.add(decalDisplayables);

  renderContext = new RenderContext(
      new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED));
  renderContext.setCullFace(GL20.GL_BACK);

  modelBatch = new ModelBatch(renderContext,
                              new DefaultShaderProvider(),
                              new HelixRenderableSorter());

  decalBatch = new DecalBatch(new CameraGroupStrategy(camera));

  spriteBatch = new SpriteBatch();
}
 
开发者ID:fauu,项目名称:HelixEngine,代码行数:23,代码来源:RenderingSystem.java


示例4: create

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
@Override
public void create() {
	assets = new AssetManager();
	String model = "Bambo_House.g3db";
	assets.load(model, Model.class);
	assets.finishLoading();
	modelInstance = new ModelInstance(assets.get(model, Model.class), new Matrix4().setToScaling(0.6f, 0.6f, 0.6f));

	DefaultShader.Config config = new Config();
	config.defaultCullFace = GL20.GL_NONE;
	ShaderProvider shaderProvider = new DefaultShaderProvider(config);
	modelBatch = new ModelBatch(shaderProvider);

	ModelBuilder builder = new ModelBuilder();
	float groundSize = 1000f;
	ground = new ModelInstance(builder.createRect(-groundSize, 0, groundSize, groundSize, 0, groundSize, groundSize, 0, -groundSize, -groundSize, 0, -groundSize, 0,
			1, 0, new Material(), Usage.Position | Usage.Normal), new Matrix4().setToTranslation(0, -0.01f, 0));
	environment = new Environment();
	environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
	environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

	VirtualReality.renderer.listeners.add(this);
	// VirtualReality.head.setCyclops(true);
}
 
开发者ID:nooone,项目名称:gdx-vr,代码行数:25,代码来源:SimpleRoom.java


示例5: initShaders

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
private void initShaders() {
	FileHandle vertexFile = Gdx.files.internal("shaders/vertex.glsl");
	FileHandle fragFile = Gdx.files.internal("shaders/frag.glsl");
	shaderProvider = new DefaultShaderProvider(vertexFile, fragFile);

	shaderProvider.config.numPointLights = 10;
	shaderProvider.config.numDirectionalLights = 2;


	// check shader compile logs

	/*shader = new ShaderProgram(vertexFile, fragFile);
	ShaderProgram.pedantic = false;
	String log = shader.getLog();
	if (!shader.isCompiled())
		throw new GdxRuntimeException(log);
	if (log!=null && log.length()!=0)
		System.out.println("Shader Log: "+log);*/
}
 
开发者ID:jrenner,项目名称:gdx-proto,代码行数:20,代码来源:View.java


示例6: setup

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
@Override
public boolean setup() {

	modelBatch = new ModelBatch(new DefaultShaderProvider());

	lights = new Environment();
	lights.set(new ColorAttribute(ColorAttribute.AmbientLight, 1.0f, 1.0f, 1.0f, 1.f));
	lights.add(new DirectionalLight().set(0.3f, 0.3f, 0.3f, 0, 1, -0.2f));

	cam = new MapCamera(mMap);

	renderContext =
	        new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1));

	// shader = new DefaultShader(renderable.material,
	// renderable.mesh.getVertexAttributes(), true, false, 1, 0, 0, 0);
	// shader.init();

	return true;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:21,代码来源:GdxModelRenderer.java


示例7: setup

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
@Override
public boolean setup() {

	// if (assets == null)
	// assets = new AssetManager();

	// assets.load("data/g3d/invaders.g3dj", Model.class);
	// loading = true;

	modelBatch = new ModelBatch(new DefaultShaderProvider());

	lights = new Environment();
	// lights.ambientLight.set(1.0f, 1.0f, 1.0f, 1f);
	// lights.ambientLight.set(215 / 255f,
	// 240 / 255f,
	// 51 / 255f, 1f);

	lights.add(new DirectionalLight().set(0.9f, 0.9f, 0.9f, 0, 1, -0.2f));

	cam = new MapCamera(mMap);

	return true;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:24,代码来源:GdxRenderer3D2.java


示例8: compileShader

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
public void compileShader() {
    try { getRawShader(); } catch (Exception e) { e.printStackTrace(); }
    String frag = rawFragShader;
    String vert = rawVertShader;

    vert = TextUtils.replaceLine("#version", "", vert);

    vert = "#version 120\n" +
            "\n" +
            "#define LIGHT_COUNT "+lightPoints.size()+"\n" +
            "\n" +
            vert;

    shaderProgram = new ShaderProgram(vert, frag);

    if(!shaderProgram.isCompiled()) {
        System.out.println(shaderProgram.getLog());
        System.out.println();
        System.out.println("Vertex");
        System.out.println(shaderProgram.getVertexShaderSource());
        System.out.println();
        System.out.println("Fragment");
        System.out.println(shaderProgram.getFragmentShaderSource());
        System.out.println();
    }

    for(int i = 0; i < lightPoints.size(); i++){
        Quaternion quat = lightPoints.get(i);
        int loc = shaderProgram.getUniformLocation("u_lightPos[" + i + "]");
        float[] pack = new float[]{quat.x, quat.y, quat.z, quat.w};
        shaderProgram.setUniform4fv(loc, pack, 0, pack.length);
    }

    modelBatch = new ModelBatch(new DefaultShaderProvider(){
        @Override
        protected Shader createShader(Renderable renderable) {
            return new DepthMapShader(renderable, shaderProgram);
        }
    });
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:41,代码来源:LightRenderer.java


示例9: LightWrapper

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
public LightWrapper(T light) {
    this.light = light;
    shaderProgram = WorldRenderer.setupShader("depth/light");
    if(!shaderProgram.isCompiled())
        throw new GdxRuntimeException("Unable to compile shader: "+shaderProgram.getLog());
    batch = new ModelBatch(new DefaultShaderProvider() {
        @Override
        protected Shader createShader(Renderable renderable) {
            return new DepthMapShader(renderable, shaderProgram);
        }
    });
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:13,代码来源:LightWrapper.java


示例10: ModelBatch

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
/** Construct a ModelBatch, using this constructor makes you responsible for calling context.begin() and context.end() yourself.
 * @param context The {@link RenderContext} to use.
 * @param shaderProvider The {@link ShaderProvider} to use, will be disposed when this ModelBatch is disposed.
 * @param sorter The {@link RenderableSorter} to use. */
public ModelBatch (final RenderContext context, final ShaderProvider shaderProvider, final RenderableSorter sorter) {
	this.sorter = (sorter == null) ? new DefaultRenderableSorter() : sorter;
	this.ownContext = (context == null);
	this.context = (context == null) ? new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1)) : context;
	this.shaderProvider = (shaderProvider == null) ? new DefaultShaderProvider() : shaderProvider;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:11,代码来源:ModelBatch.java


示例11: create

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
@Override
public void create () {
	Gdx.gl.glClearColor(0.2f, 0.3f, 1.0f, 0.f);
	
	atlas = new TextureAtlas(Gdx.files.internal("data/testpack"));
	regions = atlas.getRegions();

	modelBatch = new ModelBatch(new DefaultShaderProvider());

	environment = new Environment();
	environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
	environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

	cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	cam.position.set(10f, 10f, 10f);
	cam.lookAt(0, 0, 0);
	cam.near = 0.1f;
	cam.far = 300f;
	cam.update();

	ModelBuilder modelBuilder = new ModelBuilder();
	final Material material = new Material(ColorAttribute.createDiffuse(1f, 1f, 1f, 1f), new TextureAttribute(TextureAttribute.Diffuse));
	model = modelBuilder.createBox(5f, 5f, 5f, material, Usage.Position | Usage.Normal | Usage.TextureCoordinates);
	instance = new ModelInstance(model);
	attribute = instance.materials.get(0).get(TextureAttribute.class, TextureAttribute.Diffuse);

	Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:29,代码来源:TextureRegion3DTest.java


示例12: createBatchs

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
public static void createBatchs() {
	Config modelConfigShader = new Config(Gdx.files.classpath(VERTEX_SHADER).readString(),
			Gdx.files.classpath(FRAGMENT_SHADER).readString());

	modelConfigShader.numBones = MAX_BONES;
	modelConfigShader.numDirectionalLights = 0;
	modelConfigShader.numPointLights = 0;
	modelConfigShader.numSpotLights = 0;

	modelBatch = new ModelBatch(new DefaultShaderProvider(modelConfigShader));

	shadowBatch = new ModelBatch(new DepthShaderProvider());
	floorBatch = new ModelBatch(new DefaultShaderProvider(Gdx.files.classpath(VERTEX_SHADER),
			Gdx.files.classpath(FLOOR_FRAGMENT_SHADER)));
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:16,代码来源:Sprite3DRenderer.java


示例13: initialize

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
@Override
public void initialize(AssetManager manager) {
    ShaderLoader.Pedantic = false;
    ShaderProgram.pedantic = false;

    /** LOAD SHADER PROGRAMS WITH ASSET MANAGER **/
    manager.load("shader/star.vertex.glsl", ShaderProgram.class);
    manager.load("shader/gal.vertex.glsl", ShaderProgram.class);
    manager.load("shader/font.vertex.glsl", ShaderProgram.class);
    manager.load("shader/sprite.vertex.glsl", ShaderProgram.class);
    manager.load("atmgrounddefault", GroundShaderProvider.class, new AtmosphereGroundShaderProviderParameter("shader/default.vertex.glsl", "shader/default.fragment.glsl"));
    manager.load("spsurface", DefaultShaderProvider.class, new DefaultShaderProviderParameter("shader/starsurface.vertex.glsl", "shader/starsurface.fragment.glsl"));
    manager.load("spbeam", DefaultShaderProvider.class, new DefaultShaderProviderParameter("shader/default.vertex.glsl", "shader/beam.fragment.glsl"));
    manager.load("spdepth", DefaultShaderProvider.class, new DefaultShaderProviderParameter("shader/normal.vertex.glsl", "shader/depth.fragment.glsl"));
    manager.load("spopaque", DefaultShaderProvider.class, new DefaultShaderProviderParameter("shader/normal.vertex.glsl", "shader/opaque.fragment.glsl"));
    manager.load("atm", AtmosphereShaderProvider.class, new AtmosphereShaderProviderParameter("shader/atm.vertex.glsl", "shader/atm.fragment.glsl"));
    if (!Constants.webgl) {
        manager.load("atmground", GroundShaderProvider.class, new AtmosphereGroundShaderProviderParameter("shader/normal.vertex.glsl", "shader/normal.fragment.glsl"));
    }

    stars = new Array<IRenderable>();

    pixelRenderSystems = new AbstractRenderSystem[3];

    renderProcesses = new Array<IRenderSystem>();

    blendNoDepthRunnable = new RenderSystemRunnable() {
        @Override
        public void run(AbstractRenderSystem renderSystem, Array<IRenderable> renderables, ICamera camera) {
            Gdx.gl.glEnable(GL20.GL_BLEND);
            Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);
            Gdx.gl.glDepthMask(false);
        }
    };
    blendDepthRunnable = new RenderSystemRunnable() {
        @Override
        public void run(AbstractRenderSystem renderSystem, Array<IRenderable> renderables, ICamera camera) {
            Gdx.gl.glEnable(GL20.GL_BLEND);
            Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
            Gdx.gl.glDepthMask(true);
        }
    };

    if (GlobalConf.scene.SHADOW_MAPPING) {
        // Shadow map camera
        cameraLight = new PerspectiveCamera(0.5f, GlobalConf.scene.SHADOW_MAPPING_RESOLUTION, GlobalConf.scene.SHADOW_MAPPING_RESOLUTION);

        // Aux vectors
        aux1 = new Vector3();
        aux1d = new Vector3d();

        // Build frame buffers and arrays
        buildShadowMapData();
    }

    if (GlobalConf.postprocess.POSTPROCESS_LIGHT_SCATTERING) {
        buildGlowData();
    }
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:60,代码来源:SceneGraphRenderer.java


示例14: loadAsync

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file, T parameter) {
    shaderProvider = new DefaultShaderProvider(Gdx.files.internal(parameter.vertexShader), Gdx.files.internal(parameter.fragmentShader));
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:5,代码来源:DefaultShaderProviderLoader.java


示例15: loadSync

import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider; //导入依赖的package包/类
@Override
public DefaultShaderProvider loadSync(AssetManager manager, String fileName, FileHandle file, DefaultShaderProviderParameter parameter) {
    return shaderProvider;
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:5,代码来源:DefaultShaderProviderLoader.java



注:本文中的com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HARole类代码示例发布时间:2022-05-22
下一篇:
Java SQLiteProgram类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap