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


Java DepthShader类代码示例

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


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

示例1: init

import com.badlogic.gdx.graphics.g3d.shaders.DepthShader; //导入依赖的package包/类
public void init() {
        vertexShaderArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_CPLUSPLUS);
        vertexShaderArea.setCodeFoldingEnabled(true);

        fragmentShaderArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_CPLUSPLUS);
        fragmentShaderArea.setCodeFoldingEnabled(true);

        shaderInfo = new ArrayList();

        newShaderBtn.addActionListener(e -> add());
        shaderCompileBtn.addActionListener(e -> {
            displayDetectedUniforms();
            save();
        });
        applyShaderBtn.addActionListener(e -> apply());
        deleteShaderBtn.addActionListener(e -> delete());

        uniformList.setModel(new DefaultListModel<>());

        // TREE

        DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Editor");

//        collectionTree.setModel(new DefaultTreeModel(rootNode));

        collectionTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        collectionTree.addTreeSelectionListener(e -> select());

        DefaultMutableTreeNode autoWireNode = new DefaultMutableTreeNode("Autowired Uniforms");
        UNIFORMS().keySet().stream().sorted((o1, o2) -> o1.alias.compareToIgnoreCase(o2.alias)).forEach(k -> {
            autoWireNode.add(new DefaultMutableTreeNode(k.alias));
        });

        shaderNode = new DroppableTreeNode("Shaders");
        DefaultTreeModel model = new DefaultTreeModel(rootNode);

        collectionTree.setModel(model);

        premadeNode = new DefaultMutableTreeNode("Native Shaders");
        // Uber Shader
        DynamicShader.Info uberShaderInfo = new DynamicShader.Info(false);
        uberShaderInfo.name = "Uber Shader";
        uberShaderInfo.desc = "The default LibGdx shader";
        uberShaderInfo.vertex = DefaultShader.getDefaultVertexShader();
        uberShaderInfo.fragment = DefaultShader.getDefaultFragmentShader();
        premadeNode.add(new DefaultMutableTreeNode(uberShaderInfo));
        DynamicShader.Info uberDepthShaderInfo = new DynamicShader.Info(false);
        uberDepthShaderInfo.name = "Uber Depth Shader";
        uberDepthShaderInfo.desc = "The default LibGdx Depth Shader";
        uberDepthShaderInfo.vertex = DepthShader.getDefaultVertexShader();
        uberDepthShaderInfo.fragment = DepthShader.getDefaultFragmentShader();
        premadeNode.add(new DefaultMutableTreeNode(uberDepthShaderInfo));

        rootNode.add(autoWireNode);
        rootNode.add(premadeNode);
        rootNode.add(shaderNode);

        DefaultComboBoxModel<DynamicShader.GLPrimitiveType> primitiveModel = new DefaultComboBoxModel<>();
        for (DynamicShader.GLPrimitiveType type : DynamicShader.GLPrimitiveType.values())
            primitiveModel.addElement(type);
        shaderPrimitiveSelect.setModel(primitiveModel);

//        readFromDisk();



        finalRendererText.setText(getFinalShader() != null ? getFinalShader().name : "");

        collectionTree.addTreeSelectionListener(e -> {
            DynamicShader.Info info = getFinalShader();
            finalRendererText.setText(info != null ? info.name : "Error");
            if (realtime)
                if (info != null)
                    Gdx.app.postRunnable(editorController::compile);
        });
    }
 
开发者ID:ncguy2,项目名称:Argent,代码行数:77,代码来源:ShaderForm.java

示例2: DepthShaderProvider

import com.badlogic.gdx.graphics.g3d.shaders.DepthShader; //导入依赖的package包/类
public DepthShaderProvider (final DepthShader.Config config) {
	this.config = (config == null) ? new DepthShader.Config() : config;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:4,代码来源:DepthShaderProvider.java

示例3: createShader

import com.badlogic.gdx.graphics.g3d.shaders.DepthShader; //导入依赖的package包/类
@Override
protected Shader createShader (final Renderable renderable) {
	return new DepthShader(renderable, config);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:DepthShaderProvider.java

示例4: GameLevelScreen

import com.badlogic.gdx.graphics.g3d.shaders.DepthShader; //导入依赖的package包/类
public GameLevelScreen(LevelFile levelDef) {
  this.gameObjectsTweenManager = new TweenManager();
  this.uiTweenManager          = new TweenManager();
  this.renderContext      = new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1));
  this.entities           = new ArrayList<Entity>();
  this.perspectiveCamera  = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

  levelDefinition         = levelDef;

  this.map                = new Map(levelDefinition.geometryFile());
  perspectiveCamera.position.set(0, 0, 0);
  perspectiveCamera.near = 0.1f;
  perspectiveCamera.far = 50f;
  perspectiveCamera.update(true);

  this.cameraController = new RTSCameraController();
  cameraController.setCamera(perspectiveCamera);
  cameraController.setCenter(0, 0);
  cameraController.setEnabled(true);

  environment = new Environment();
  environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.3f, 0.3f, 0.3f, 1f));

  this.cellShadingCompositor = new LevelCompositor(renderContext);

  this.robot = BotLogic.entities.robot();
  this.robot.led = BotLogic.entities.led();

  addEntity(this.robot);
  addEntity(this.robot.led);

  colorModelBatch = new ModelBatch(renderContext);
  decalBatch      = new DecalBatch();

  decalBatch.setGroupStrategy(new CameraGroupStrategy(perspectiveCamera));

  DepthShader.Config depthConfig     = new DepthShader.Config(Gdx.files.internal("shaders/depth.vertex").readString(), Gdx.files.internal("shaders/depth.frag").readString());
  depthConfig.defaultCullFace        = GL20.GL_BACK;
  depthConfig.depthBufferOnly        = false;
  depthModelBatch = new ModelBatch(renderContext, new DepthShaderProvider(depthConfig));

  map.environment = environment;
  this.controller = new GameController(this);
  reset();

  environment.set(new ColorAttribute(ColorAttribute.Fog, 0f, 0f, 0f, 1f));
  environment.add(new DirectionalLight().set(new Color(.4f,.4f, .4f, 0.1f), new Vector3(1,-1,0)));
  BotLogic.audio.mainMenuMusic.play();
}
 
开发者ID:macbury,项目名称:BotLogic,代码行数:50,代码来源:GameLevelScreen.java


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